.nav a.active {
    color: #ffffff;
    background: linear-gradient(
        90deg,
        rgba(141, 124, 255, 0.22),
        rgba(94, 108, 255, 0.10)
    );
    border: 1px solid rgba(141, 124, 255, 0.28);
    box-shadow: inset 3px 0 0 #8d7cff;
}

.operation-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.operation-tab {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-weight: 700;
}

.operation-tab:hover,
.operation-tab.active {
    color: #ffffff;
    border-color: rgba(141, 124, 255, .48);
    background: rgba(141, 124, 255, .18);
}

.operation-panel {
    max-width: 900px;
    margin-bottom: 18px;
}

.recommendation-prefill {
    max-width: 900px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-color: rgba(141, 124, 255, .38);
}

.recommendation-prefill h2 {
    margin-bottom: 4px;
}

.recommended-price {
    flex: 0 0 auto;
    font-size: 1.25rem;
    font-weight: 900;
    color: #ffffff;
}

.operation-history {
    margin-top: 18px;
}

.operation-history-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.quick-periods {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.quick-periods a {
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: .84rem;
}

.quick-periods a:hover {
    color: #ffffff;
    border-color: rgba(141, 124, 255, .42);
}

.operation-filter {
    display: grid;
    grid-template-columns:
        minmax(160px, 1fr)
        minmax(160px, 1fr)
        minmax(180px, .8fr)
        auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(8, 14, 28, .45);
    border: 1px solid var(--border);
}

.operation-filter label,
.bond-sort-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.operation-filter label > span,
.bond-sort-form label > span {
    color: var(--muted);
    font-size: .78rem;
}

.operation-filter input,
.operation-filter select,
.bond-sort-form select {
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #0c1324;
    color: #ffffff;
}

.operation-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.positive {
    color: var(--green) !important;
}

.negative {
    color: var(--danger) !important;
}

.market-hint {
    margin: 6px 0 12px;
    color: #b8c1dc;
    font-size: .9rem;
    line-height: 1.5;
}

.purchase-calculation {
    display: grid;
    gap: 5px;
    margin: 10px 0 16px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #0c1221;
    color: var(--muted);
}

.purchase-calculation.ok {
    border-color: rgba(94, 230, 168, .42);
    color: #d8ffeb;
}

.purchase-calculation.insufficient {
    border-color: rgba(255, 113, 133, .55);
    background: rgba(255, 113, 133, .06);
    color: #ffd3d9;
}

.pagination {
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.pagination span {
    color: var(--muted);
    font-size: .88rem;
}

.recommendation-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.recommendation-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.bond-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 10px;
}

.bond-sort-form {
    min-width: 250px;
}

.strategy-row {
    background: rgba(141, 124, 255, .035);
}

.table-action {
    white-space: nowrap;
    font-weight: 800;
    color: #b8afff;
}

.table-action:hover {
    color: #ffffff;
}

.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

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

/* Месячный календарь из предыдущего патча */

.calendar-head {
    align-items: center;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.calendar-nav strong {
    min-width: 150px;
    text-align: center;
}

.calendar-metrics {
    margin-bottom: 14px;
}

.month-calendar-wrap {
    padding: 10px;
    overflow-x: auto;
}

.month-calendar {
    min-width: 930px;
    display: grid;
    grid-template-columns:
        repeat(7, minmax(105px, 1fr))
        minmax(135px, .85fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.calendar-weekday {
    padding: 10px 8px;
    background: #0d1425;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.week-total-head {
    color: #c1baff;
}

.calendar-day {
    min-height: 92px;
    padding: 8px;
    background: #11182b;
}

.calendar-day.outside {
    opacity: .4;
}

.calendar-day.today {
    box-shadow: inset 0 0 0 2px rgba(141, 124, 255, .65);
}

.calendar-day.has-events {
    min-height: 112px;
    background: #141d33;
}

.calendar-date-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 7px;
}

.calendar-date {
    display: inline-grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 999px;
    color: #e9edfa;
    font-weight: 800;
}

.today .calendar-date {
    background: var(--accent);
    color: #fff;
}

.calendar-day-total {
    color: var(--green);
    font-size: .78rem;
    white-space: nowrap;
}

.coupon-events {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.coupon-chip {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 7px;
    padding: 6px 7px;
    border-radius: 8px;
    background: rgba(141, 124, 255, .12);
    border: 1px solid rgba(141, 124, 255, .22);
    font-size: .75rem;
}

.coupon-chip strong {
    color: #d7d2ff;
}

.coupon-chip span {
    color: var(--green);
}

.coupon-chip small {
    width: 100%;
    color: var(--muted);
}

.calendar-week-total {
    min-height: 92px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    background: #0f172b;
}

.calendar-week-total span {
    color: var(--muted);
    font-size: .75rem;
}

.calendar-week-total strong {
    color: var(--green);
}

.calendar-week-total.empty-week strong {
    color: var(--muted);
}

@media (max-width: 900px) {
    .operation-filter {
        grid-template-columns: 1fr 1fr;
    }

    .recommendation-action,
    .recommendation-prefill,
    .operation-history-head {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .operation-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .operation-filter {
        grid-template-columns: 1fr;
    }
}

/* Core v5 */
:root {
    --green: #5ee6a8;
}

.operation-stats,
.portfolio-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .8rem;
    margin-bottom: 1rem;
}

.operation-stats .metric-card,
.portfolio-metrics .metric-card {
    min-height: 92px;
}

.strategy-strip {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.strategy-strip > div {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.strategy-strip > div > span:not(.eyebrow) {
    color: var(--muted);
    font-size: .8rem;
}

.strategy-strip > a {
    color: #c8c1ff;
    font-weight: 800;
}

.settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 650px) minmax(320px, 1fr);
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
}

.settings-explainer {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}

.setting-rule {
    padding-bottom: .8rem;
    border-bottom: 1px solid var(--border);
}

.setting-rule:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.setting-rule p {
    margin: .3rem 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.settings-live {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.settings-live > div {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.settings-live span {
    color: var(--muted);
    font-size: .8rem;
}

/* Нормальные уведомления по центру экрана */
.toast-stack {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    pointer-events: none;
}

.toast {
    width: min(390px, calc(100vw - 32px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .95rem 1rem;
    border-radius: .95rem;
    border: 1px solid rgba(141, 124, 255, .45);
    background: #11182b;
    color: var(--text);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
    pointer-events: auto;
    animation: toast-in .18s ease-out;
}

.toast.success {
    border-color: rgba(94, 230, 168, .45);
}

.toast.error {
    border-color: rgba(255, 113, 133, .55);
}

.toast.warning {
    border-color: rgba(255, 196, 92, .55);
}

.toast-close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0c1221;
    color: var(--muted);
    cursor: pointer;
}

.toast-hide {
    opacity: 0;
    transform: scale(.97);
    transition: opacity .22s ease, transform .22s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.today-button {
    min-width: 86px;
}

@media (max-width: 1000px) {
    .operation-stats,
    .portfolio-metrics,
    .settings-live {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .strategy-strip,
    .settings-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .operation-stats,
    .portfolio-metrics,
    .settings-live {
        grid-template-columns: 1fr;
    }
}

.recommendation-buttons .btn {
    margin-top: 0;
}

/* Goal & Strategy v6 */
.goal-settings-form {
    margin-bottom: 1rem;
}

.goal-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
}

.goal-form-card,
.goal-plan-card {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}

.goal-form-card h2,
.goal-plan-card h2,
.goal-summary-card h2,
.goal-steps-card h2 {
    margin: 0;
}

.goal-field {
    display: flex;
    flex-direction: column;
    gap: .42rem;
}

.goal-field label {
    font-weight: 800;
    color: var(--text);
}

.goal-field input,
.goal-field select {
    width: 100%;
    min-height: 44px;
    padding: .72rem .8rem;
    border: 1px solid var(--border);
    border-radius: .75rem;
    background: #0c1324;
    color: #fff;
}

.goal-field small,
.goal-check small {
    color: var(--muted);
    line-height: 1.45;
}

.goal-field .errorlist,
.goal-error .errorlist {
    margin: .25rem 0 0;
    padding-left: 1.1rem;
    color: var(--danger);
}

.goal-check {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .8rem;
    border: 1px solid var(--border);
    border-radius: .8rem;
    background: rgba(141, 124, 255, .05);
    cursor: pointer;
}

.goal-check input {
    margin-top: .25rem;
    width: 18px;
    height: 18px;
}

.goal-check span {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.goal-summary-card {
    margin-bottom: 1rem;
}

.goal-summary-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.goal-progress-number {
    font-size: 1.7rem;
    color: #c9c3ff;
}

.goal-progress-track {
    width: 100%;
    height: 12px;
    margin: .9rem 0 .7rem;
    border-radius: 999px;
    overflow: hidden;
    background: #0b1120;
    border: 1px solid var(--border);
}

.goal-progress-track span {
    display: block;
    height: 100%;
    max-width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7565ff, #9f92ff);
}

.goal-progress-track.compact {
    height: 8px;
    margin: .65rem 0 .45rem;
}

.goal-explain {
    margin-bottom: 0;
}

.goal-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.goal-result-grid {
    margin-top: 0;
}

.goal-plan-lines {
    display: grid;
    gap: .7rem;
}

.goal-plan-lines > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid var(--border);
}

.goal-plan-lines > div:last-child {
    border-bottom: 0;
}

.goal-plan-lines span {
    color: var(--muted);
}

.goal-warning-block,
.goal-success {
    padding: .85rem 1rem;
    border-radius: .8rem;
    border: 1px solid rgba(255, 196, 92, .45);
    background: rgba(255, 196, 92, .06);
    line-height: 1.5;
}

.goal-success {
    border-color: rgba(94, 230, 168, .45);
    background: rgba(94, 230, 168, .06);
}

.goal-advice-list {
    display: grid;
    gap: .65rem;
}

.goal-advice-item {
    padding: .78rem .9rem;
    border-radius: .75rem;
    background: #0d1528;
    border: 1px solid var(--border);
    line-height: 1.5;
}

.goal-steps-card {
    margin-bottom: 1rem;
}

.goal-step-list {
    display: grid;
    gap: .55rem;
}

.goal-step-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .8rem;
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: .8rem;
    background: #0e1628;
}

.goal-step-number {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(141, 124, 255, .18);
    color: #d7d2ff;
    font-weight: 900;
}

.goal-step-main {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.goal-step-main span,
.goal-step-date {
    color: var(--muted);
    font-size: .86rem;
}

.goal-allocation-card {
    margin-bottom: 1rem;
}

.goal-allocation-card summary {
    cursor: pointer;
    font-weight: 800;
}

.goal-allocation-list {
    display: grid;
    gap: .45rem;
    margin-top: .9rem;
}

.goal-allocation-list > div {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto auto;
    gap: .8rem;
    align-items: center;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border);
}

.goal-allocation-list span,
.goal-allocation-list small {
    color: var(--muted);
}

.goal-week-status {
    margin-top: 1rem;
}

.dashboard-goal-widget {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    margin-bottom: 1rem;
    border-color: rgba(141, 124, 255, .32);
}

.dashboard-goal-widget > div {
    min-width: 0;
    flex: 1 1 auto;
}

.dashboard-goal-value {
    display: block;
    margin-top: .3rem;
    font-size: 1.15rem;
}

@media (max-width: 1000px) {
    .goal-settings-grid,
    .goal-metric-grid {
        grid-template-columns: 1fr;
    }

    .goal-step-row {
        grid-template-columns: 34px minmax(0, 1fr) auto;
    }

    .goal-step-row .btn {
        grid-column: 2 / -1;
        justify-self: start;
    }
}

@media (max-width: 650px) {
    .goal-summary-head,
    .dashboard-goal-widget {
        flex-direction: column;
        align-items: stretch;
    }

    .goal-step-row {
        grid-template-columns: 30px minmax(0, 1fr);
    }

    .goal-step-date,
    .goal-step-row .btn {
        grid-column: 2;
    }

    .goal-allocation-list > div {
        grid-template-columns: 1fr;
        gap: .25rem;
    }
}
