:root {
    --bg-main: #0E0E10;
    --bg-card: #1C1C20;
    --bg-surface: #25252B;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --accent: #0A84FF;
    --positive: #30D158;
    --negative: #FF453A;
    --border: #2C2C30;
    --font-family: 'Inter', sans-serif;
    --tab-bar-height: 64px;
}

/* --- СВЕТЛАЯ ТЕМА (по настройкам Telegram) --- */
:root[data-theme="light"] {
    --bg-main: #F2F2F7;
    --bg-card: #FFFFFF;
    --bg-surface: #F2F2F7;
    --text-primary: #1C1C1E;
    --text-secondary: #6C6C70;
    --accent: #007AFF;
    --positive: #34C759;
    --negative: #FF3B30;
    --border: #E5E5EA;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    position: relative;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    padding-top: env(safe-area-inset-top);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        135deg,
        #D946EF 0%,
        #7C3AED 20%,
        #1E3A8A 50%,
        #0891B2 80%,
        #06B6D4 100%
    );
    filter: blur(80px);
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
}

:root[data-theme="light"] body::before {
    opacity: 0.15;
    filter: blur(60px);
}

/* --- LOADER --- */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-main);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- HEADER --- */
.portfolio-header {
    padding: 24px 20px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.balance-container .label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.total-balance {
    font-size: 38px;
    font-weight: 700;
    margin: 4px 0;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.currency-label {
    font-size: 22px;
    color: var(--text-secondary);
}

.profit-container {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}

.profit-container.positive {
    background: rgba(48, 209, 88, 0.15);
    color: var(--positive);
}

.profit-container.negative {
    background: rgba(255, 69, 58, 0.15);
    color: var(--negative);
}

.history-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 11px;
}

.history-item {
    color: var(--text-secondary);
}

.history-item.positive {
    color: var(--positive);
}

.history-item.negative {
    color: var(--negative);
}

.history-sep {
    color: var(--border);
}

.settings-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 18px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.settings-btn:hover {
    background: var(--bg-card);
}

.settings-btn svg {
    display: block;
}

.settings-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- TAB CONTENT --- */
.tab-content {
    display: none;
    padding: 16px 16px calc(var(--tab-bar-height) + 16px);
    min-height: calc(100vh - 140px);
}

.tab-content.active {
    display: block;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-title h2 {
    font-size: 17px;
    font-weight: 600;
}

.section-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.add-btn {
    background: var(--accent);
    color: white;
    border: none;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
    position: relative;
}

.add-btn svg {
    display: block;
}

.add-btn:active {
    transform: scale(0.95);
}

.add-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.add-btn.spinning {
    animation: spin 1s linear;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.add-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- CATEGORY ACCORDION --- */
.asset-category {
    margin-bottom: 10px;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-radius 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.category-header:active {
    background: var(--bg-surface);
}

.asset-category.open .category-header {
    border-radius: 14px 14px 0 0;
    border-bottom-color: transparent;
}

.category-header-left {
    display: flex;
    align-items: center;
    gap: 9px;
}

.category-emoji {
    font-size: 20px;
    line-height: 1;
    width: 28px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-emoji svg {
    display: block;
}

.category-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.category-count {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 2px;
}

.category-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.category-total {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.category-profit-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

.category-profit-badge.positive {
    background: rgba(48, 209, 88, 0.15);
    color: var(--positive);
}

.category-profit-badge.negative {
    background: rgba(255, 69, 58, 0.15);
    color: var(--negative);
}

.category-arrow {
    color: var(--text-secondary);
    font-size: 11px;
    transition: transform 0.22s ease;
    display: inline-block;
}

.asset-category.open .category-arrow {
    transform: rotate(180deg);
}

.category-body {
    display: none;
    flex-direction: column;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 14px 14px;
    padding: 8px 8px 8px;
    overflow: hidden;
}

.category-body .assets-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.asset-category.open .category-body {
    display: flex;
}

/* --- ASSET CARDS (single column) --- */
.assets-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.asset-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.asset-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.1);
}

.card-main {
    padding: 14px 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.card-left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.card-right {
    flex-shrink: 0;
    text-align: right;
}

/* Иконка актива */
.asset-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    color: white;
    overflow: hidden;
}

.asset-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.asset-info {
    flex: 1;
    min-width: 0;
}

.asset-ticker {
    font-size: 17px;
    font-weight: 700;
}

.asset-company-name {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
    line-height: 1.3;
    font-weight: 400;
}

.asset-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.5;
}

/* Бейдж доли в портфеле */
.allocation-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border-radius: 6px;
    padding: 2px 6px;
    margin-top: 4px;
}

.cagr-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    border-radius: 6px;
    padding: 2px 6px;
    margin-top: 4px;
}

.cagr-badge.pos {
    background: rgba(48, 209, 88, 0.15);
    color: var(--positive);
}

.cagr-badge.neg {
    background: rgba(255, 69, 58, 0.12);
    color: var(--negative);
}

/* Бейдж источника котировки (KASE, MOEX, LBMA спот, ...) */
.price-source-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border-radius: 6px;
    padding: 2px 6px;
    margin-top: 4px;
    opacity: 0.8;
    letter-spacing: 0.02em;
}

.asset-value {
    font-size: 17px;
    font-weight: 700;
}

.asset-profit {
    font-size: 12px;
    font-weight: 600;
    margin-top: 3px;
}

.asset-profit.positive {
    color: var(--positive);
}

.asset-profit.negative {
    color: var(--negative);
}

.asset-no-price {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 3px;
}

/* --- ALLOCATION BAR CHART --- */
.bubble-chart-container {
    padding: 10px 16px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.alloc-bar-wrap {
    display: flex;
    height: 8px;
    border-radius: 6px;
    overflow: hidden;
    gap: 2px;
    margin-bottom: 8px;
}

.alloc-bar-segment {
    border-radius: 3px;
    transition: flex 0.4s ease;
}

.alloc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.alloc-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-secondary);
}

.alloc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.alloc-legend-item span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

/* --- THEME SELECTOR --- */
.theme-options {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.theme-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--bg-surface);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-size: 11px;
    color: var(--text-secondary);
}

.theme-option:hover {
    border-color: var(--accent);
    background: rgba(10, 132, 255, 0.05);
}

.theme-option.active {
    border-color: var(--accent);
    background: rgba(10, 132, 255, 0.1);
    color: var(--accent);
}

.theme-option:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.theme-option .theme-emoji {
    font-size: 20px;
}

/* Sparkline */
.sparkline-wrapper {
    margin: 10px 0 0;
    height: 48px;
}

.sparkline-wrapper svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- LOTS SECTION --- */
.lots-section {
    padding: 8px 16px 12px;
}

.lots-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
}

.lots-toggle.open .lots-arrow {
    transform: rotate(180deg);
}

.lots-arrow {
    transition: transform 0.2s;
    display: inline-block;
    font-size: 10px;
}

.lots-list {
    display: none;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.lots-list.open {
    display: flex;
}

/* --- SWIPE TO DELETE --- */
.lot-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    /* скруглять только здесь */
    margin-bottom: 4px;
}

.lot-delete-bg {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 64px;
    background: var(--negative);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    cursor: pointer;
}

.lot-delete-bg .del-label {
    font-size: 10px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.3px;
}

.lot-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    background: var(--bg-surface);
    /* border-radius убран — у lot-row он создаёт зазоры у краёв,
       через которые пробивается красный фон */
    padding: 6px 10px;
    touch-action: pan-y;
    user-select: none;
    will-change: transform;
}

.lot-date {
    color: var(--text-secondary);
    min-width: 70px;
}

.lot-amount {
    font-weight: 600;
    min-width: 48px;
}

.lot-price {
    color: var(--text-primary);
    flex: 1;
    text-align: right;
    font-weight: 500;
}

/* --- SKELETON LOADING --- */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Плавное появление карточек */
@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.asset-card-enter {
    animation: cardFadeIn 0.28s ease both;
}

/* --- ПЕРЕКЛЮЧАТЕЛЬ ПОРТФЕЛЕЙ --- */
.portfolio-switcher {
    display: flex;
    gap: 6px;
    padding: 10px 16px 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.portfolio-switcher::-webkit-scrollbar { display: none; }

.pf-btn {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    padding: 5px 8px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
    line-height: 1;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.pf-btn .pf-icon-wrap {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pf-btn .pf-icon-wrap svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    stroke-width: 2.2;
}
.pf-btn .pf-label {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.pf-btn .pf-count {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.pf-btn .pf-count:empty { display: none; }
.pf-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 3px 12px rgba(10, 132, 255, 0.35);
}
.pf-btn.active .pf-count {
    background: rgba(255,255,255,0.25);
}

/* --- настройки: список портфелей --- */
.pf-settings-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
}
.pf-settings-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}
.pf-settings-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}
.pf-settings-label {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pf-delete-btn {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--negative);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.18s;
    padding: 0;
}
.pf-delete-btn:hover { background: rgba(255,69,58,0.15); }

/* --- пикер иконок портфеля --- */
.pf-icon-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.pf-icon-pick {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    padding: 0;
}
.pf-icon-pick svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}
.pf-icon-pick:hover { border-color: var(--accent); color: var(--accent); }
.pf-icon-pick.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

/* Бейдж портфеля в заголовке модала */
.portfolio-tag {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    vertical-align: middle;
    margin-left: 6px;
}

/* --- СОРТИРОВКА --- */
.sort-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.sort-bar::-webkit-scrollbar { display: none; }

.sort-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s;
    opacity: 0.6;
}

.sort-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    opacity: 1;
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
}

.sort-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.skel {
    background: linear-gradient(90deg,
            var(--bg-surface) 25%,
            var(--border) 50%,
            var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite ease-in-out;
    border-radius: 6px;
    flex-shrink: 0;
}

.skel-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
}

.skel-line {
    height: 12px;
}

.skel-spark {
    height: 48px;
    margin: 10px 0 0;
    border-radius: 0;
}

/* --- HISTORY TAB --- */

.history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px;
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border);
}

.hs-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hs-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.2px;
    font-weight: 500;
    line-height: 1.2;
}

.hs-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-date-group {
    margin-bottom: 4px;
}

.history-date-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    margin: 8px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.history-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    margin-bottom: 4px;
}

.hi-ticker {
    font-weight: 700;
    font-size: 14px;
    min-width: 56px;
}

.hi-mid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.hi-detail {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

.hi-time {
    font-size: 10px;
    color: var(--text-secondary);
}

.hi-price {
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

.hi-delete {
    background: none;
    border: none;
    color: var(--negative);
    cursor: pointer;
    font-size: 13px;
    opacity: 0.5;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    border-radius: 6px;
    transition: opacity 0.2s, background 0.2s;
}

.hi-delete svg {
    display: block;
}

.hi-delete:hover {
    opacity: 1;
    background: rgba(255, 69, 58, 0.1);
}

/* --- BOTTOM TAB BAR --- */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 500;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    position: relative;
    min-height: 44px;
}

.tab-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 32px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--accent);
    transition: transform 0.2s ease;
}

.tab-btn.active {
    color: var(--accent);
}

.tab-btn.active::after {
    transform: translateX(-50%) scaleX(1);
}

.tab-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.tab-icon {
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-icon svg {
    display: block;
}

.tab-label {
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-family);
}

/* --- MODALS --- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: flex-end;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 24px;
    animation: slideUp 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
}

.close-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-top: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
    font-family: var(--font-family);
}

.form-group input:focus,
.form-group select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-color: var(--accent);
}

.primary-btn {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
    transition: opacity 0.2s;
}

.primary-btn:hover {
    opacity: 0.9;
}

.primary-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.magic-btn {
    width: 100%;
    background: linear-gradient(135deg, #FF2E93 0%, #FF8000 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
}

.mt-1 {
    margin-top: 20px;
}

/* --- TICKER AUTOCOMPLETE --- */
.ticker-input-wrapper {
    position: relative;
}

.ticker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    z-index: 3000;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    margin-top: 4px;
}

.ticker-dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.ticker-dropdown-item:last-child {
    border-bottom: none;
}

.ticker-dropdown-item:hover {
    background: var(--bg-card);
}

.dd-ticker {
    font-weight: 700;
    font-size: 14px;
    min-width: 64px;
}

.dd-name {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dd-market {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(10, 132, 255, 0.2);
    color: var(--accent);
    white-space: nowrap;
}

/* --- EXPORT BUTTON --- */
.export-btn {
    flex: 1;
    padding: 10px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.export-btn svg {
    display: block;
}

.export-btn:hover {
    background: var(--bg-card);
    border-color: var(--accent);
}

.export-btn:active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.export-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- FULLSCREEN ASSET DETAIL PANEL --- */
.fullscreen-panel {
    position: fixed;
    inset: 0;
    background: var(--bg-main);
    z-index: 600;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fullscreen-panel.open {
    transform: translateX(0);
}

.fs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.fs-back {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--accent);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    line-height: 1;
}

.fs-back:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.fs-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.fs-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 32px;
    -webkit-overflow-scrolling: touch;
}

/* Period selector buttons */
.period-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.period-btn {
    padding: 8px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.period-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Chart inside fullscreen */
.detail-chart {
    width: 100%;
    height: 180px;
    margin-bottom: 16px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-surface);
}

.detail-chart svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Stats grid */
.detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.detail-stat {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px 14px;
    text-align: center;
}

.detail-stat .ds-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.detail-stat .ds-value {
    font-size: 15px;
    font-weight: 700;
}

/* Lots */
.detail-lots-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.detail-lot-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    background: var(--bg-card);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 5px;
}

.detail-lot-date {
    color: var(--text-secondary);
    min-width: 70px;
}

.detail-lot-qty {
    font-weight: 600;
    min-width: 50px;
}

.detail-lot-price {
    flex: 1;
    text-align: right;
    font-weight: 500;
}

/* News section */
.detail-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 18px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Asset type badge */
.asset-type-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}
.asset-type-bond {
    background: rgba(255, 195, 0, 0.15);
    color: #d4a017;
    border: 1px solid rgba(255, 195, 0, 0.3);
}
.asset-type-etf {
    background: rgba(10, 132, 255, 0.12);
    color: var(--accent);
    border: 1px solid rgba(10, 132, 255, 0.25);
}

/* Bond / ETF info card */
.bond-info-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 10px 0 0;
}
.bond-info-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.bond-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.bond-info-row:last-child {
    border-bottom: none;
}
.bond-info-row span:first-child {
    color: var(--text-secondary);
}
.bond-info-row span:last-child {
    font-weight: 600;
}
.bond-info-highlight span:last-child {
    color: var(--positive);
}


/* Asset detail accordion */
.det-accordion {
    margin-top: 14px;
}

.det-accordion-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: var(--bg-card);
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: background 0.18s ease;
}

.det-accordion-hdr:hover {
    background: var(--bg-surface);
}

.det-accordion-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.det-accordion-label svg {
    flex-shrink: 0;
}

.det-acc-arrow-wrap {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.det-acc-arrow {
    transition: transform 0.28s ease;
}

.det-accordion-body {
    padding-top: 8px;
}

.news-item {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 6px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-primary);
    border-left: 3px solid var(--accent);
}

/* Дата публикации новости */
.news-date {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    opacity: 0.75;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

.news-link {
    display: block;
    text-decoration: none;
    transition: all 0.2s ease;
}

.news-link:hover {
    background: var(--bg-surface);
    transform: translateX(2px);
}

.sentiment-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin: 8px 0 12px;
    border: 1px solid;
    backdrop-filter: blur(10px);
}

.sentiment-positive {
    background: rgba(48, 209, 88, 0.12);
    border-color: rgba(48, 209, 88, 0.3);
    color: var(--positive);
}

.sentiment-negative {
    background: rgba(255, 69, 58, 0.12);
    border-color: rgba(255, 69, 58, 0.3);
    color: var(--negative);
}

.sentiment-neutral {
    background: rgba(142, 142, 147, 0.12);
    border-color: rgba(142, 142, 147, 0.3);
    color: var(--text-secondary);
}

/* AI advice box */
.advice-box {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.08) 0%, rgba(48, 209, 88, 0.05) 100%);
    border: 1px solid var(--accent);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-top: 8px;
    white-space: pre-wrap;
}

.advice-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 12px 0;
}

.advice-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.ask-ai-btn {
    width: 100%;
    padding: 13px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ask-ai-btn svg {
    display: block;
    flex-shrink: 0;
}

.ask-ai-btn:hover {
    opacity: 0.9;
}

.ask-ai-btn:disabled {
    opacity: 0.6;
}

/* --- CUSTOM RANGE SLIDER --- */
.custom-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.custom-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-card);
}

.custom-range::-moz-range-track {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
}

/* --- TOGGLE SWITCH --- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: var(--bg-card);
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.3);
}

/* --- SUB-TABS (внутри вкладки История) --- */
.subtab-bar {
    display: flex;
    gap: 0;
    margin: 4px 0 14px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.subtab-bar::-webkit-scrollbar { display: none; }

.subtab-bar--stretch .subtab-btn { flex: 1; }

.subtab-btn {
    flex: 0 0 auto;
    padding: 8px 10px;
    border: none;
    border-bottom: 2.5px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    margin-bottom: -1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.subtab-btn svg {
    display: block;
}

.subtab-btn.active {
    border-bottom-color: var(--accent);
    color: var(--accent);
    background: transparent;
    box-shadow: none;
}

.subtab-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
}

/* --- CHART PERIOD SELECTOR --- */
.chart-period-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.chart-period-bar::-webkit-scrollbar { display: none; }

.period-btn {
    flex-shrink: 0;
    flex: 1;
    min-width: 44px;
    min-height: 36px;
    padding: 7px 8px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.period-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.period-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- PORTFOLIO CHART WRAPPER --- */
.portfolio-chart-wrap {
    position: relative;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.portfolio-chart-svg {
    width: 100%;
    height: 220px;
    display: block;
}

/* SVG chart elements */
.chart-grid-line {
    stroke: var(--border);
    stroke-width: 0.7;
    stroke-dasharray: 3, 3;
}

.chart-axis-line {
    stroke: var(--border);
    stroke-width: 1;
}

.chart-axis-label {
    fill: var(--text-secondary);
    font-size: 9px;
    font-family: var(--font-family);
}

/* Прозрачные хитзоны (hover-цели) */
.chart-hit {
    cursor: crosshair;
}

/* --- CHART TOOLTIP --- */
.chart-tooltip {
    position: absolute;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 7px 11px;
    pointer-events: none;
    z-index: 10;
    min-width: 110px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.ct-date {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 2px;
    font-weight: 500;
}

.ct-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

/* --- CHART PLACEHOLDER --- */
.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    gap: 8px;
}

/* --- CHART STATS ROW (под графиком) --- */
.chart-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.chart-stat {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 10px 6px;
    text-align: center;
    border: 1px solid var(--border);
}

.cs-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    font-weight: 600;
}

.cs-value {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

/* ===== ВКЛАДКА НАЛОГИ ===== */
.tax-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.tax-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.tax-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.tax-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.tax-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.tax-row:last-of-type {
    border-bottom: none;
}

.tax-label {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}

.tax-rate {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    white-space: nowrap;
}

.tax-hint {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 2px;
}

.tax-exempt {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(48, 209, 88, 0.1);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.exempt-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #30D158;
    flex-shrink: 0;
}

.tax-info-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tax-info-row:last-child {
    border-bottom: none;
}

.tax-info-bullet {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

/* Блок напоминаний */
.tax-reminders {
    margin-bottom: 14px;
}

.tax-reminders-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.tax-reminder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
}

.tri-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tri-icon svg {
    width: 20px;
    height: 20px;
}

.tri-body {
    flex: 1;
    min-width: 0;
}

.tri-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.tri-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.tri-days {
    flex-shrink: 0;
}

.tax-badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.tax-badge.urgent {
    background: rgba(255, 69, 58, 0.18);
    color: #FF453A;
}

.tax-badge.warn {
    background: rgba(255, 159, 10, 0.18);
    color: #FF9F0A;
}

.tax-badge.ok {
    background: rgba(48, 209, 88, 0.15);
    color: #30D158;
}

/* ===== P&L OVERVIEW GRID ===== */
.pnl-overview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.pnl-ov-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.18s, box-shadow 0.18s;
    -webkit-tap-highlight-color: transparent;
}

.pnl-ov-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.12);
}

.pnl-ov-card.active {
    border-color: var(--accent);
    background: rgba(10, 132, 255, 0.07);
}

.pnl-ov-period {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.pnl-ov-value {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.pnl-ov-pct {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
    opacity: 0.85;
}

/* ===== РИСК-АНАЛИТИКА ===== */

.risk-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    gap: 4px;
}

.risk-no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 24px 32px;
    color: var(--text-secondary);
    font-size: 14px;
    gap: 8px;
    line-height: 1.5;
}

.risk-no-data-hint {
    font-size: 12px;
    opacity: 0.7;
    max-width: 260px;
}

.risk-data-warn {
    margin: 16px 16px 0;
    padding: 10px 14px;
    background: color-mix(in srgb, #FFD60A 12%, transparent);
    border-left: 3px solid #FFD60A;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.risk-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 18px 16px 8px;
}

.risk-metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 4px 16px 0;
}

.risk-card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 14px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.risk-card-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.risk-card-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.risk-card-value.risk-green  { color: var(--positive); }
.risk-card-value.risk-yellow { color: #FFD60A; }
.risk-card-value.risk-red    { color: var(--negative); }
.risk-card-value.risk-muted  { color: var(--text-secondary); }

.risk-card-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.3;
}

.risk-conc-wrap {
    padding: 0 16px 20px;
}

.risk-conc-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.risk-conc-val {
    font-size: 20px;
    font-weight: 700;
}

.risk-conc-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.risk-conc-bar-track {
    height: 8px;
    background: var(--bg-surface);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.risk-conc-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.risk-conc-assets {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.risk-conc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.risk-conc-ticker {
    font-weight: 600;
    min-width: 52px;
}

.risk-conc-bar-mini-track {
    flex: 1;
    height: 5px;
    background: var(--bg-surface);
    border-radius: 3px;
    overflow: hidden;
}

.risk-conc-bar-mini {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.5s ease;
}

.risk-conc-pct {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 38px;
    text-align: right;
}

/* ===== ИИ ОБЗОР ПОРТФЕЛЯ ===== */

.ai-review-wrap {
    margin: 8px 16px 24px;
}

.ai-review-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--bg-card)), var(--bg-card));
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: 14px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    transition: border-color 0.2s, background 0.2s;
}

.ai-review-trigger:hover,
.ai-review-trigger:active {
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--bg-card)), var(--bg-card));
}

.ai-review-trigger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: 10px;
    color: var(--accent);
    flex-shrink: 0;
}

.ai-review-trigger-hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
}

.ai-review-trigger > span:not(.ai-review-trigger-icon):not(.ai-review-trigger-hint) {
    flex: 1;
}

/* Когда карточка открыта — прячем кнопку-триггер */
.ai-review-wrap.open .ai-review-trigger {
    display: none;
}

.ai-review-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.ai-review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}

.ai-review-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
}

.ai-review-ts {
    font-size: 10px;
    color: var(--text-secondary);
}

.ai-review-body {
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-primary);
    white-space: pre-line;
}

.ai-review-body.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 16px;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13px;
}

.ai-review-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 16px 14px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.ai-review-refresh:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== P&L ПО ПЕРИОДАМ ===== */
.pnl-period-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    padding: 4px;
    background: var(--bg-card);
    border-radius: 12px;
}

.pnl-period-btn {
    flex: 1;
    padding: 8px 4px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.pnl-period-btn.active {
    background: var(--accent);
    color: #fff;
}

.pnl-period-btn:focus { outline: none; }

.pnl-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
}

.pnl-card.pnl-pos { border-left: 4px solid var(--positive); }
.pnl-card.pnl-neg { border-left: 4px solid var(--negative); }

.pnl-card-period {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.pnl-card-change {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.pnl-card-pct {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.pnl-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pnl-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    font-weight: 600;
}

.pnl-meta-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
}

.pnl-no-data, .pnl-error, .pnl-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    gap: 6px;
}

.pnl-error { color: var(--negative); }

.pnl-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    padding: 0 2px;
}

.pnl-disclaimer svg { flex-shrink: 0; margin-top: 1px; }

/* ===== КАЛЬКУЛЯТОР ИПН ===== */
.tax-calc-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 14px;
}

.tax-calc-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.tax-calc-hint {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: auto;
}

.tax-calc-btn {
    width: 100%;
    padding: 11px 16px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: opacity 0.18s ease;
}

.tax-calc-btn:disabled { opacity: 0.6; cursor: default; }
.tax-calc-btn:hover:not(:disabled) { opacity: 0.88; }

.tax-calc-assets {
    margin-top: 14px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.tax-asset-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    gap: 8px;
}

.tax-asset-row:last-child { border-bottom: none; }

.tax-asset-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tax-asset-ticker {
    font-weight: 700;
    font-size: 13px;
}

.tax-asset-type {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tax-asset-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    font-weight: 600;
}

.tax-calc-total {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.tax-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.tax-total-row:last-child { border-bottom: none; }

.tax-total-main {
    font-weight: 700;
    font-size: 14px;
    background: var(--bg-surface);
}

/* =========================================================
   ��������� ������ / �������
   ========================================================= */

/* --- ����� �������� --- */
.sc-form-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
}

.sc-form-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.sc-form-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sc-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sc-label {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 80px;
    flex-shrink: 0;
}

.sc-input {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.sc-input:focus {
    border-color: var(--accent);
}

.sc-select {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    width: 90px;
    flex-shrink: 0;
    -webkit-appearance: none;
}

/* ������� ������� ��� */
.sc-presets {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.sc-preset-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.sc-preset-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 11px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.sc-preset-btn:hover,
.sc-preset-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* �������� */
.sc-range {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

.sc-range-marks {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 2px 4px 0;
    gap: 4px;
}
.sc-range-marks span {
    flex: 1;
    text-align: center;
}

.sc-pct-label {
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
    min-width: 38px;
    text-align: right;
}

/* ������ ������� */
.sc-run-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

.sc-run-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- ���������� ��� ���� --- */
.wi-result-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 14px;
}

.wi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.wi-ticker-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
}

.wi-date-badge {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 4px 8px;
    border-radius: 8px;
}

.wi-kpi-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.wi-kpi {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 10px 12px;
}

.wi-kpi-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 4px;
}

.wi-kpi-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.wi-kpi-value.positive { color: var(--positive); }
.wi-kpi-value.negative { color: var(--negative); }

.wi-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.wi-price-row .arrow {
    color: var(--text-tertiary);
}

/* ����-�������� ������ */
.wi-chart-wrap {
    border-radius: 10px;
    overflow: hidden;
    height: 80px;
}

.wi-chart-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- ���������� �������� --- */
.rb-result-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 14px;
}

.rb-compare-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.rb-compare-card {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.rb-compare-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rb-compare-value {
    font-size: 22px;
    font-weight: 700;
}

.rb-compare-value.positive { color: var(--positive); }
.rb-compare-value.negative { color: var(--negative); }

.rb-diff-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 14px;
    font-weight: 600;
    font-size: 14px;
}

.rb-diff-banner.positive {
    background: rgba(48, 209, 88, 0.12);
    color: var(--positive);
}

.rb-diff-banner.negative {
    background: rgba(255, 69, 58, 0.12);
    color: var(--negative);
}

.rb-diff-banner.neutral {
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.rb-alloc-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rb-alloc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.rb-alloc-ticker {
    font-weight: 600;
    min-width: 52px;
}

.rb-alloc-bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg-surface);
    border-radius: 3px;
    overflow: hidden;
}

.rb-alloc-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.4s ease;
}

.rb-alloc-bar-fill.new-asset {
    background: var(--positive);
}

.rb-alloc-pct {
    min-width: 38px;
    text-align: right;
    color: var(--text-secondary);
}

.rb-alloc-ret {
    min-width: 52px;
    text-align: right;
    font-size: 12px;
}

.rb-alloc-ret.positive { color: var(--positive); }
.rb-alloc-ret.negative { color: var(--negative); }

/* ����-��������� ������ ������ */
.rb-spark-wrap {
    border-radius: 10px;
    overflow: hidden;
    height: 60px;
    margin-top: 10px;
}

.rb-spark-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ��������� �������� �������� */
.sc-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13px;
}

.sc-error {
    background: rgba(255, 69, 58, 0.10);
    border-radius: 12px;
    padding: 14px;
    color: var(--negative);
    font-size: 13px;
    line-height: 1.5;
}

/* =========================================================
   Ребаланс портфеля (rebalance-plan subtab)
   ========================================================= */

.rbp-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
}

.rbp-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.rbp-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.5;
}

.rbp-asset-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--divider);
}
.rbp-asset-row:last-child { border-bottom: none; }

.rbp-asset-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.rbp-asset-ticker {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.rbp-asset-cur-pct {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 2px 6px;
}

.rbp-target-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.rbp-target-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.rbp-target-input {
    width: 60px;
    padding: 5px 7px;
    border-radius: 8px;
    border: 1.5px solid var(--divider);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    text-align: right;
    -webkit-appearance: none;
}
.rbp-target-input:focus {
    outline: none;
    border-color: var(--accent);
}

.rbp-pct-sign {
    font-size: 13px;
    color: var(--text-secondary);
}

.rbp-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 4px;
    margin-top: 4px;
    border-top: 1px solid var(--divider);
}

.rbp-total-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.rbp-total-val {
    font-size: 14px;
    font-weight: 700;
}
.rbp-total-val.ok   { color: var(--positive); }
.rbp-total-val.warn { color: var(--negative); }

.rbp-extra-row {
    margin-top: 12px;
}

.rbp-extra-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.rbp-extra-inputs {
    display: flex;
    gap: 8px;
}

.rbp-extra-input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1.5px solid var(--divider);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}
.rbp-extra-input:focus { outline: none; border-color: var(--accent); }

.rbp-extra-select {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1.5px solid var(--divider);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    -webkit-appearance: none;
}

.rbp-run-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity .15s;
}
.rbp-run-btn:disabled { opacity: .5; pointer-events: none; }
.rbp-run-btn:active   { opacity: .8; }

.rbp-loading {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 13px;
}
.rbp-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.rbp-result-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
}

.rbp-summary {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.rbp-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}
.rbp-summary-row.total-row {
    border-top: 1px solid var(--divider);
    padding-top: 6px;
    margin-top: 2px;
    color: var(--text-primary);
    font-weight: 600;
}
.rbp-summary-val { font-weight: 600; color: var(--text-primary); }
.rbp-summary-val.positive { color: var(--positive); }
.rbp-summary-val.negative { color: var(--negative); }

.rbp-result-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
}
.rbp-result-row:last-child { border-bottom: none; }

.rbp-result-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.rbp-result-ticker {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}

.rbp-result-action {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 8px;
}
.rbp-buy  { background: rgba(48,209,88,.15); color: var(--positive); }
.rbp-sell { background: rgba(255,69,58,.15);  color: var(--negative); }
.rbp-hold { background: var(--bg-secondary);  color: var(--text-secondary); }

.rbp-result-amount {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.rbp-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}
.rbp-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.rbp-bar-label {
    font-size: 11px;
    color: var(--text-secondary);
    width: 30px;
    flex-shrink: 0;
    text-align: right;
}
.rbp-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}
.rbp-bar-fill.current {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width .4s ease;
}
.rbp-bar-fill.target {
    height: 100%;
    background: rgba(255,255,255,.3);
    border-radius: 4px;
    transition: width .4s ease;
}
.rbp-bar-pct {
    font-size: 11px;
    color: var(--text-secondary);
    width: 38px;
    text-align: right;
    flex-shrink: 0;
}

.rbp-drift {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
}
.rbp-drift.overweight  { background: rgba(255,69,58,.12);  color: var(--negative); }
.rbp-drift.underweight { background: rgba(48,209,88,.12);  color: var(--positive); }
.rbp-drift.balanced    { background: var(--bg-secondary);  color: var(--text-secondary); }
