/* InvestForge Custom Styles */

/* ========================================
   Icon Utilities
   ======================================== */

/* Поворот иконки выхода на 180° (чтобы смотрела вправо) */
.bx-flip-horizontal {
    transform: scaleX(-1);
    display: inline-block;
}

/* ========================================
   Global Font Size Adjustments
   ======================================== */

/* Increase base font size for better readability */
body {
    font-size: 15px;
}

/* Card style — unified Slate Minimal */
.card {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Card titles */
.card-title {
    font-size: 1.1rem;
}

/* Card body text */
.card-body {
    font-size: 0.9375rem;
}

/* Form labels */
.form-label {
    font-size: 0.9375rem;
}

/* Form inputs */
.form-control,
.form-select {
    font-size: 0.9375rem;
    padding: 0.5rem 0.875rem;
}

/* Buttons */
.btn {
    font-size: 0.9375rem;
}

/* Table text */
.table {
    font-size: 0.9375rem;
}

/* Alert text */
.alert {
    font-size: 0.9375rem;
}

/* Badge text */
.badge {
    font-size: 0.8125rem;
}

/* Dropdown items */
.dropdown-item {
    font-size: 0.9375rem;
}

/* Navigation links */
.nav-link {
    font-size: 0.9375rem;
}

/* ========================================
   Logo styles
   ======================================== */

/* --- Горизонтальный layout (основной сайт) --- */
body[data-layout="horizontal"] .navbar-brand-box {
    display: flex;
    align-items: center;
    height: 70px;
    padding: 0 0 0 1rem !important;
    width: auto !important;
}

body[data-layout="horizontal"] .navbar-brand-box .logo {
    line-height: 1;
    display: flex;
    align-items: center;
}

body[data-layout="horizontal"] .navbar-brand-box .logo.logo-light {
    display: none !important;
}

body[data-layout="horizontal"] .navbar-brand-box .logo-sm {
    display: none !important;
}

body[data-layout="horizontal"] .navbar-brand-box .logo-lg {
    display: flex !important;
    line-height: 1;
}

body[data-layout="horizontal"] .navbar-brand-box .logo-lg span {
    letter-spacing: 0.5px;
}

/* --- Вертикальный sidebar (админка): фикс стрелок и цветов --- */

/* Стрелки подменю: заменяем MDI на Font Awesome */
.has-arrow::after {
    font-family: "Font Awesome 6 Free" !important;
    content: "\f078" !important;
    font-weight: 900 !important;
    font-size: 9px !important;
}

/* Пункты меню сайдбара: белый текст + hover-эффект */
body[data-sidebar="dark"] #side-menu > li > a {
    color: rgba(255, 255, 255, 0.85) !important;
    transition: all 0.2s ease;
}

body[data-sidebar="dark"] #side-menu > li > a i {
    color: rgba(255, 255, 255, 0.6) !important;
    transition: all 0.2s ease;
}

body[data-sidebar="dark"] #side-menu > li > a:hover {
    color: #fff !important;
    padding-left: 28px;
}

body[data-sidebar="dark"] #side-menu > li > a:hover i {
    color: #fff !important;
}

body[data-sidebar="dark"] #side-menu .sub-menu li a {
    color: rgba(255, 255, 255, 0.65) !important;
    transition: all 0.2s ease;
}

body[data-sidebar="dark"] #side-menu .sub-menu li a:hover {
    color: #fff !important;
    padding-left: 70px;
}

/* Font size utility (same as landing) */
.font-size-22 {
    font-size: 22px !important;
}

/* Stats cards */
.mini-stats-wid .card-body {
    padding: 1rem;
}

.mini-stats-wid .mini-stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   Portfolio — Journal-style Stats & Groups
   ======================================== */

/* Stats Bar */
.va-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 20px;
}
.va-stat-group {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.va-stat-item { text-align: center; }
.va-stat-label { font-size: 11px; color: #6b7280; white-space: nowrap; }
.va-stat-value { font-size: 16px; font-weight: 700; color: #1f2937; }
.va-stat-value.accent { color: #6366f1; }
.va-stat-value.profit { color: #10b981; }
.va-stat-value.loss { color: #ef4444; }

/* Hint icon & popup */
.va-hint {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 2px;
}
.va-hint > i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    font-size: 9px;
    font-style: normal;
    font-weight: 600;
    color: #94a3b8;
    line-height: 1;
    transition: all 0.15s;
}
.va-hint:hover > i,
.va-hint.is-active > i {
    border-color: #6366f1;
    color: #6366f1;
    background: #eef2ff;
}
.va-hint-popup {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.5;
    padding: 8px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.va-hint-popup::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #1e293b;
}
.va-hint:hover .va-hint-popup,
.va-hint.is-active .va-hint-popup {
    display: block;
}

/* P&L box */
.va-pnl-box {
    display: flex;
    align-items: stretch;
    padding: 10px 16px;
    border-radius: 8px;
    gap: 12px;
    border: 1px solid;
    transition: box-shadow 0.2s;
}
.va-pnl-box:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.va-pnl-box.is-profit { background: #ecfdf5; border-color: #a7f3d0; }
.va-pnl-box.is-loss { background: #fef2f2; border-color: #fecaca; }
.va-pnl-box.is-neutral { background: #f9fafb; border-color: #e5e7eb; }
.va-pnl-col { display: flex; flex-direction: column; justify-content: flex-end; }
.va-pnl-value { font-size: 20px; font-weight: 800; line-height: 1.2; }
.va-pnl-value.primary { color: #10b981; }
.va-pnl-box.is-loss .va-pnl-value.primary { color: #ef4444; }
.va-pnl-box.is-neutral .va-pnl-value.primary { color: #6b7280; }
.va-pnl-label { font-size: 11px; font-weight: 500; color: #6b7280; margin-top: 2px; }
.va-pnl-divider {
    width: 1px;
    align-self: stretch;
}
.va-pnl-box.is-profit .va-pnl-divider { background: #a7f3d0; }
.va-pnl-box.is-loss .va-pnl-divider { background: #fecaca; }
.va-pnl-box.is-neutral .va-pnl-divider { background: #e5e7eb; }

/* Positions table */
.pos-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}
.pos-table thead th:nth-child(1) { width: 25%; } /* Инструмент */
.pos-table thead th:nth-child(2) { width: 12%; } /* Направление */
.pos-table thead th:nth-child(3) { width: 8%; }  /* Кол-во */
.pos-table thead th:nth-child(4) { width: 13%; } /* Ср. вход */
.pos-table thead th:nth-child(5) { width: 13%; } /* Текущая цена */
.pos-table thead th:nth-child(6) { width: 14%; } /* Стоимость */
.pos-table thead th:nth-child(7) { width: 15%; } /* P&L */
.pos-table thead th {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 16px;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
    white-space: nowrap;
}
.pos-table thead th:first-child { text-align: left; }
.pos-table tbody tr {
    cursor: pointer;
    transition: background 0.12s;
}
.pos-table tbody tr:hover { background: #f8fafc; }
.pos-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
    font-size: 14px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pos-table tbody td:first-child { text-align: left; }
.pos-table tbody tr:last-child td { border-bottom: none; }

/* Instrument cell */
.instrument-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.instrument-logo-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    letter-spacing: -0.02em;
    overflow: hidden;
}
.instrument-logo-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.instrument-info { min-width: 0; }
.instrument-ticker {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
    display: inline;
}
.instrument-name {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Direction badges */
.badge-direction {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
}
.badge-direction.is-long {
    background: #dcfce7;
    color: #16a34a;
}
.badge-direction.is-short {
    background: #fee2e2;
    color: #dc2626;
}
.badge-direction i { font-size: 10px; }

/* P&L cell */
.pnl-value { font-weight: 700; font-size: 14px; }
.pnl-percent { font-size: 12px; font-weight: 500; }
.pnl-positive { color: #10b981; }
.pnl-negative { color: #ef4444; }

/* P&L tags (coupons, commissions) */
.pnl-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin-top: 5px;
}
.pnl-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}
.pnl-tag-coupon {
    color: #059669;
    background: #ecfdf5;
}
.pnl-tag-commission {
    color: #64748b;
    background: #f1f5f9;
}

/* Price sub */
.price-main { font-weight: 600; color: #334155; }
.price-sub { font-size: 11px; }

/* Card wrapper */
.card-wrap {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

/* Table header */
.va-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}
.va-table-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}
.va-table-title i { color: #6366f1; font-size: 14px; }

/* Filter bar & pills */
.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.filter-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 14px;
    height: 36px;
    font-size: 13px;
    color: #64748b;
    transition: all 0.15s;
}
.filter-pill:hover { border-color: #cbd5e1; }
.filter-pill select,
.filter-pill input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    font-family: inherit;
    color: #334155;
    min-width: 100px;
}
.filter-pill i { font-size: 11px; color: #94a3b8; }

/* Type group card */
.type-group { margin-bottom: 16px; }
.type-group:last-child { margin-bottom: 0; }
.type-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
}
.type-group-header .type-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.type-group-header .type-count {
    font-weight: 500;
    color: #94a3b8;
    font-size: 12px;
    margin-left: 2px;
}

/* Responsive stats */
@media (max-width: 768px) {
    .va-stats {
        flex-direction: column;
    }
    .va-table-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    .filter-bar {
        width: 100%;
    }
    .filter-pill {
        flex: 1;
    }
}

/* Position number badge */
.position-number {
    font-size: 0.75rem;
    color: #74788d;
}

/* PnL colors */
.text-profit {
    color: #34c38f !important;
}

.text-loss {
    color: #f46a6a !important;
}

/* Badge adjustments */
.badge-soft-success {
    color: #34c38f;
    background-color: rgba(52, 195, 143, 0.18);
}

.badge-soft-danger {
    color: #f46a6a;
    background-color: rgba(244, 106, 106, 0.18);
}

.badge-soft-info {
    color: #50a5f1;
    background-color: rgba(80, 165, 241, 0.18);
}

.badge-soft-warning {
    color: #f1b44c;
    background-color: rgba(241, 180, 76, 0.18);
}

/* Chart container */
.chart-container {
    position: relative;
    min-height: 250px;
}

/* Card hover effect */
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

/* Table improvements */
.table > :not(caption) > * > * {
    padding: 0.75rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(30, 41, 59, 0.04);
}

/* Terminal Path — page header */
.if-terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 20px;
}

.if-terminal-path {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.if-term-seg-home {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.12s;
}

.if-term-seg-home:hover {
    color: #475569;
}

.if-term-sep {
    color: #cbd5e1;
    margin: 0 8px;
    font-weight: 300;
}

.if-term-seg-link {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.12s;
}

.if-term-seg-link:hover {
    color: #475569;
}

.if-term-seg-current {
    color: #1e293b;
    font-weight: 700;
}

.if-term-cursor {
    display: none;
}

.if-term-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e5ea;
    border-radius: 8px;
    padding: 7px 14px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'DM Sans', sans-serif;
    line-height: 1;
    white-space: nowrap;
}

.if-term-btn:hover {
    color: #334155;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.if-term-btn i {
    font-size: 0.6875rem;
}

/* Page headers */
h1, .h1 { font-size: 2rem; }
h2, .h2 { font-size: 1.75rem; }
h3, .h3 { font-size: 1.5rem; }
h4, .h4 { font-size: 1.25rem; }
h5, .h5 { font-size: 1.1rem; }
h6, .h6 { font-size: 1rem; }

/* Stats card values */
.mini-stats-wid h4 {
    font-size: 1.375rem;
}

/* Top navbar items */
.topnav .nav-link {
    font-size: 0.9375rem;
    font-weight: 500;
}

/* ========================================
   Slate Minimal Theme
   ======================================== */

/* Переопределяем глобальные CSS-переменные акцентного цвета */
:root {
    --bs-primary: #1e293b;
    --bs-primary-rgb: 30, 41, 59;
    --bs-link-color: #334155;
    --bs-link-hover-color: #1e293b;
    --bs-menu-item-active-color: #fff;
}

/* --- Global Bootstrap primary → Slate overrides --- */

/* btn-primary */
.btn-primary {
    --bs-btn-bg: #1e293b;
    --bs-btn-border-color: #1e293b;
    --bs-btn-hover-bg: #334155;
    --bs-btn-hover-border-color: #334155;
    --bs-btn-active-bg: #0f172a;
    --bs-btn-active-border-color: #0f172a;
    --bs-btn-disabled-bg: #94a3b8;
    --bs-btn-disabled-border-color: #94a3b8;
    --bs-btn-focus-shadow-rgb: 30, 41, 59;
}

/* btn-outline-primary */
.btn-outline-primary {
    --bs-btn-color: #1e293b;
    --bs-btn-border-color: #1e293b;
    --bs-btn-hover-bg: #1e293b;
    --bs-btn-hover-border-color: #1e293b;
    --bs-btn-active-bg: #1e293b;
    --bs-btn-active-border-color: #1e293b;
    --bs-btn-disabled-color: #94a3b8;
    --bs-btn-disabled-border-color: #94a3b8;
}

/* btn-soft-primary (global) */
.btn-soft-primary {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}
.btn-soft-primary:hover {
    background-color: #e2e8f0 !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}

/* text-primary → slate */
.text-primary {
    color: #475569 !important;
}

/* bg-soft-primary → slate light */
.bg-soft-primary {
    background-color: #f1f5f9 !important;
}

/* Pagination */
.page-item.active .page-link {
    background-color: #1e293b;
    border-color: #1e293b;
}
.page-link {
    color: #475569;
}
.page-link:hover {
    color: #1e293b;
}

/* Spinner */
.spinner-border.text-primary {
    color: #475569 !important;
}

/* Period picker button — badge-стиль как в макете Slate Minimal */
#periodPickerBtn {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-weight: 500;
    box-shadow: none !important;
}
#periodPickerBtn:hover {
    background: #e2e8f0 !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}

/* Date range apply button */
#dateRangeApply {
    background: #1e293b !important;
    border-color: #1e293b !important;
    color: #fff !important;
}
#dateRangeApply:hover {
    background: #334155 !important;
    border-color: #334155 !important;
}

/* Period picker presets — slate вместо фиолетового */
.period-preset-btn:hover {
    background: rgba(30, 41, 59, 0.08) !important;
    color: #1e293b !important;
}
.period-preset-btn:hover .preset-icon {
    color: #1e293b !important;
}
.period-preset-btn.active {
    background: rgba(30, 41, 59, 0.12) !important;
    color: #1e293b !important;
}
.period-preset-btn.active .preset-icon {
    color: #1e293b !important;
}

/* Datepicker range colors — slate */
.datepicker table tr td.in-range:not(.range-start):not(.range-end) {
    background: rgba(30, 41, 59, 0.12) !important;
}
.datepicker table tr td.in-range:not(.range-start):not(.range-end):hover {
    background: rgba(30, 41, 59, 0.2) !important;
}
.datepicker table tr td.range-start,
.datepicker table tr td.range-end {
    background: #1e293b !important;
}
.datepicker table tr td.range-start:hover,
.datepicker table tr td.range-end:hover {
    background: #334155 !important;
}
/* Datepicker active day */
.datepicker table tr td.active,
.datepicker table tr td.active:hover {
    background: #1e293b !important;
}

/* Навбар: тёмный slate вместо фиолетового #556ee6 */
body[data-layout=horizontal][data-topbar=light] .topnav {
    background-color: #1e293b !important;
}
body[data-layout=horizontal] .topnav {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}
body[data-layout=horizontal] .topnav .container-fluid {
    padding-left: 0;
    padding-right: 1rem;
}
body[data-layout=horizontal] .topnav .topnav-menu,
body[data-layout=horizontal] .topnav #topnav-menu-content {
    width: 100%;
}
/* Отступы между пунктами меню */
body[data-layout=horizontal] .topnav .navbar-nav .nav-item {
    margin: 0 3px;
}
body[data-layout=horizontal] .topnav .navbar-nav:first-child .nav-item:first-child {
    margin-left: 0;
}
body[data-layout=horizontal] .topnav .navbar-nav:last-child .nav-item:last-child {
    margin-right: 0;
}
/* Первый пункт меню: левый край иконки совпадает с левым краем логотипа */
body[data-layout=horizontal] .topnav .navbar-nav:first-child .nav-item:first-child .nav-link {
    padding-left: 1rem;
}

body[data-layout=horizontal][data-topbar=light] .topnav .navbar-nav .nav-item .nav-link {
    color: rgba(255, 255, 255, 0.65) !important;
    transition: all 0.2s ease;
    border-radius: 8px;
    padding: 8px 16px;
}
body[data-layout=horizontal][data-topbar=light] .topnav .navbar-nav .nav-item .nav-link i {
    color: rgba(255, 255, 255, 0.65) !important;
}

body[data-layout=horizontal][data-topbar=light] .topnav .navbar-nav .nav-item .nav-link:hover,
body[data-layout=horizontal][data-topbar=light] .topnav .navbar-nav .nav-item .nav-link:focus {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
}
body[data-layout=horizontal][data-topbar=light] .topnav .navbar-nav .nav-item .nav-link:hover i {
    color: #fff !important;
}

body[data-layout=horizontal][data-topbar=light] .topnav .navbar-nav .nav-item .nav-link.active {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
    border-radius: 8px;
}
body[data-layout=horizontal][data-topbar=light] .topnav .navbar-nav .nav-item .nav-link.active i {
    color: #fff !important;
}

/* Кнопки в хедере: нейтральный серый вместо синего btn-soft-primary */
.navbar-header .btn-soft-primary {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}

.navbar-header .btn-soft-primary:hover {
    background-color: #e2e8f0 !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}

.navbar-header .btn-soft-primary:focus {
    box-shadow: 0 0 0 0.2rem rgba(30, 41, 59, 0.15) !important;
}

/* Аватар пользователя: нейтральный серый вместо синего */
#page-header-user-dropdown .bg-soft-primary {
    background-color: #f1f5f9 !important;
}

#page-header-user-dropdown .text-primary {
    color: #64748b !important;
}

/* (page-title-box styles moved to unified section above) */

/* Header user name */
#page-header-user-dropdown span {
    font-size: 0.9375rem;
}

/* Modal titles */
.modal-title {
    font-size: 1.125rem;
}

/* Small text adjustments */
small, .small {
    font-size: 0.8125rem;
}

/* Text muted slightly larger */
.text-muted {
    font-size: inherit;
}

/* Responsive admin — mobile header + sidebar */
@media (max-width: 991.98px) {
    /* Fix: d-flex !important on logo-lg overrides Skote display:none */
    .logo span.logo-lg {
        display: none !important;
    }

    /* Fix: dark sidebar theme leaks dark bg into mobile topbar */
    body[data-sidebar=dark] .navbar-brand-box {
        background: transparent;
    }
    /* Show dark logo on light mobile topbar (override data-sidebar=dark specificity) */
    body[data-sidebar=dark] .navbar-brand-box .logo-dark {
        display: block !important;
    }
    body[data-sidebar=dark] .navbar-brand-box .logo-light {
        display: none !important;
    }

    /* Sidebar: slide-in from left */
    .vertical-menu {
        display: block !important;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 250px;
        z-index: 1005;
        margin-top: 0;
        padding-top: 70px;
    }

    body.sidebar-enable .vertical-menu {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    /* Dark overlay behind sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1004;
    }

    body.sidebar-enable .sidebar-overlay {
        display: block;
    }
}

/* ========================================
   Portfolio Switcher
   ======================================== */
.portfolio-switcher-btn {
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    border: 1px solid #dee2e6 !important;
    background-color: #fff !important;
    transition: all 0.2s ease;
    height: auto;
}

.portfolio-switcher-btn:hover {
    background-color: #f8f9fa !important;
    border-color: #ced4da !important;
}

.portfolio-switcher-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(30, 41, 59, 0.12);
}

.portfolio-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    flex-shrink: 0;
}

.portfolio-name {
    font-weight: 500;
    font-size: 0.875rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portfolio-dropdown {
    min-width: 280px;
    padding: 0.5rem 0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.portfolio-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    gap: 0.75rem;
    transition: background-color 0.15s ease;
}

.portfolio-item:hover {
    background-color: rgba(30, 41, 59, 0.06);
}

.portfolio-item.active {
    background-color: rgba(30, 41, 59, 0.08);
}

/* Переопределяем цвет текста для активного элемента (Bootstrap делает его белым) */
.dropdown-item.portfolio-item.active .portfolio-item-name {
    color: #343a40 !important;
}

.dropdown-item.portfolio-item.active .portfolio-item-type {
    color: #74788d !important;
}

.portfolio-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}

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

.portfolio-item-name {
    font-weight: 500;
    font-size: 0.9375rem;
    color: #343a40;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portfolio-item-type {
    font-size: 0.75rem;
    color: #74788d;
}

.portfolio-add-icon {
    background-color: transparent !important;
    border: 2px dashed #ced4da;
    color: #74788d !important;
}

.portfolio-add:hover .portfolio-add-icon {
    border-color: #475569;
    color: #475569 !important;
}

.portfolio-add:hover .portfolio-item-name {
    color: #475569;
}

/* ========================================
   Icon Picker (настройки портфеля)
   ======================================== */
.portfolio-icon-preview {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.color-option {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option.active {
    border-color: #343a40;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor;
}

.icon-option {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #495057;
    flex-shrink: 0;
}

.icon-option:hover {
    border-color: #475569;
    color: #475569;
    background: #f1f5f9;
}

.icon-option.active {
    border-color: #1e293b;
    background: #1e293b;
    color: #fff;
}

/* Icon Picker Grid (edit form) */
.icon-picker-grid {
    display: grid;
    gap: 8px;
}

.icon-picker-grid.colors {
    grid-template-columns: repeat(12, 28px);
}

.icon-picker-grid.icons {
    grid-template-columns: repeat(7, 40px);
}

.color-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: #343a40;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0,0,0,0.2);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    background: #fff;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #495057;
    transition: all 0.15s ease;
}

.icon-btn:hover {
    border-color: var(--icon-picker-color, #1e293b);
    color: var(--icon-picker-color, #1e293b);
    background: #f8f9ff;
}

.icon-btn.active {
    border-color: var(--icon-picker-color, #1e293b);
    background: var(--icon-picker-color, #1e293b);
    color: #fff;
}

/* ========================================
   INVESTFORGE PREMIUM DESIGN SYSTEM
   Position Detail Modal
   ======================================== */

:root {
    /* Neutral Palette (Slate) */
    --if-slate-50: #f8fafc;
    --if-slate-100: #f1f5f9;
    --if-slate-200: #e2e8f0;
    --if-slate-300: #cbd5e1;
    --if-slate-400: #94a3b8;
    --if-slate-500: #64748b;
    --if-slate-600: #475569;
    --if-slate-700: #334155;
    --if-slate-800: #1e293b;
    --if-slate-900: #0f172a;
    --if-slate-950: #020617;

    /* Semantic Colors */
    --if-profit: #22c55e;
    --if-profit-light: #4ade80;
    --if-profit-glow: 0 0 30px rgba(34, 197, 94, 0.4);

    --if-loss: #ef4444;
    --if-loss-light: #f87171;
    --if-loss-glow: 0 0 30px rgba(239, 68, 68, 0.4);

    /* Accent */
    --if-accent: #6366f1;
    --if-accent-light: #818cf8;

    /* Transitions */
    --if-transition-fast: 150ms ease;
    --if-transition-base: 200ms ease;
}

/* === Hero Card (Frosted Style) === */
.if-hero-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.if-hero-card--profit {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.1);
}

.if-hero-card--loss {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.1);
}

/* Instrument Logo - Minimal Style */
.if-instrument-logo {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.if-instrument-logo img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.if-instrument-logo i {
    font-size: 48px;
    color: var(--if-slate-700);
}

/* Instrument Info */
.if-instrument-name {
    color: var(--if-slate-800);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.if-instrument-meta {
    color: var(--if-slate-500);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.if-instrument-meta .separator {
    width: 4px;
    height: 4px;
    background: var(--if-slate-400);
    border-radius: 50%;
}

/* P&L Display */
.if-pnl-display {
    text-align: right;
}

.if-pnl-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--if-slate-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.if-pnl-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    line-height: 1.1;
}

.if-pnl-value--profit {
    color: var(--if-profit);
}

.if-pnl-value--loss {
    color: var(--if-loss);
}

.if-pnl-value--neutral {
    color: var(--if-slate-500);
}

.if-pnl-percent {
    font-size: 1rem;
    font-weight: 500;
    margin-top: 2px;
}

.if-pnl-percent--profit {
    color: var(--if-profit);
}

.if-pnl-percent--loss {
    color: var(--if-loss);
}

/* Tags Row */
.if-tags-row {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.if-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Position Number Tag */
.if-tag--number {
    background: rgba(255, 255, 255, 0.6);
    color: var(--if-slate-600);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Direction Tags */
.if-tag--long {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.if-tag--short {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Status Tags */
.if-tag--open {
    background: rgba(99, 102, 241, 0.15);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.if-tag--closed {
    background: rgba(255, 255, 255, 0.6);
    color: var(--if-slate-500);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* === Metrics Grid === */
.if-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
}

@media (max-width: 576px) {
    .if-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.if-metric-card {
    background: var(--if-slate-50);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--if-slate-300);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.if-metric-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--if-slate-800);
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

.if-metric-label {
    font-size: 0.6875rem;
    color: var(--if-slate-500);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === Timeline === */
.if-timeline {
    background: var(--if-slate-50);
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    border: 1px solid var(--if-slate-300);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.if-timeline::before {
    content: '';
    position: absolute;
    left: 140px;
    right: 140px;
    top: 50%;
    height: 2px;
    background: linear-gradient(90deg, var(--if-slate-300), var(--if-slate-300));
    transform: translateY(-50%);
}

@media (max-width: 576px) {
    .if-timeline::before {
        left: 100px;
        right: 100px;
    }
}

.if-timeline-point {
    z-index: 1;
    background: var(--if-slate-50);
    padding: 0 8px;
}

.if-timeline-point--start {
    text-align: left;
    padding-left: 0;
}

.if-timeline-point--end {
    text-align: right;
    padding-right: 0;
}

.if-timeline-time {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--if-slate-700);
}

.if-timeline-label {
    font-size: 0.75rem;
    color: var(--if-slate-500);
}

.if-timeline-duration {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid var(--if-slate-200);
    z-index: 2;
}

.if-timeline-duration-value {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--if-slate-700);
}

.if-timeline-duration-icon {
    color: var(--if-slate-400);
    margin-right: 4px;
}

/* === Pill Tabs === */
.if-tabs {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: var(--if-slate-50);
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid var(--if-slate-300);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.if-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--if-slate-600);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--if-transition-fast);
}

.if-tab:hover {
    color: var(--if-slate-800);
    background: rgba(255, 255, 255, 0.5);
}

.if-tab--active {
    background: white !important;
    color: var(--if-accent) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.if-tab-icon {
    font-size: 1rem;
}

.if-tab-badge {
    background: rgba(99, 102, 241, 0.1);
    color: var(--if-accent);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.if-tab--active .if-tab-badge {
    background: var(--if-accent);
    color: white;
}

.if-tab-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #06b6d4;
}

/* === Tab Content === */
.if-tab-content {
    padding-top: 20px;
}

.if-tab-pane {
    display: none;
}

.if-tab-pane--active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Operations table scrollable container */
#positionDetailModal .if-tab-pane[data-tab-content="operations"] .table-responsive {
    max-height: 400px;
    overflow-y: auto;
}

#positionDetailModal .if-tab-pane[data-tab-content="operations"] thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--if-slate-100);
}

/* Modal styling override */
#positionDetailModal .modal-dialog {
    max-height: calc(100vh - 60px);
    margin: 30px auto;
}

#positionDetailModal .modal-content {
    border: none;
    border-radius: 16px;
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
}

#positionDetailModal .modal-header {
    background: var(--if-slate-50);
    border-bottom: 1px solid var(--if-slate-200);
    padding: 16px 24px;
}

#positionDetailModal .modal-title {
    font-weight: 600;
    color: var(--if-slate-800);
}

#positionDetailModal .modal-body {
    padding: 24px;
    background: white;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

/* Aura effect - gradient background behind hero card */
#positionDetailModal .modal-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 600px;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#positionDetailModal .modal-body.aura-profit::before {
    background: linear-gradient(180deg,
        rgba(134, 239, 172, 0.6) 0%,
        rgba(187, 247, 208, 0.4) 30%,
        rgba(220, 252, 231, 0.2) 60%,
        rgba(255, 255, 255, 0) 100%);
    opacity: 1;
}

#positionDetailModal .modal-body.aura-loss::before {
    background: linear-gradient(180deg,
        rgba(252, 165, 165, 0.6) 0%,
        rgba(254, 202, 202, 0.4) 30%,
        rgba(254, 226, 226, 0.2) 60%,
        rgba(255, 255, 255, 0) 100%);
    opacity: 1;
}

/* Ensure content is above the aura */
#positionDetailModal .modal-body > * {
    position: relative;
    z-index: 1;
}

/* ========================================
   Filter Bar (Journal Page)
   ======================================== */

.if-filters-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.if-filters-left {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.if-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    transition: all 0.2s;
    height: 40px;
}

.if-filter-item:hover {
    border-color: #475569;
}

.if-filter-item i {
    color: #9ca3af;
    font-size: 12px;
}

.if-filter-select {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: #1f2937;
    min-width: 120px;
}

.if-filter-search {
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: #1f2937;
    min-width: 200px;
}

.if-filter-search::placeholder {
    color: #d1d5db;
}

/* Pagination */
.if-pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.if-pagination-info {
    font-size: 13px;
    color: #6b7280;
}

/* Type badges */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.type-badge-long {
    background: #dbeafe;
    color: #1e40af;
}

.type-badge-short {
    background: #fee2e2;
    color: #991b1b;
}

/* Trade cards (mobile) */
.trade-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 12px;
    background: white;
    transition: box-shadow 0.2s;
}

.trade-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Position cards (mobile) */
@media (max-width: 991.98px) {
    #positionsContainer { margin-bottom: 32px; }
}
.position-card {
    background: white;
}
.position-card + .position-card {
    border-top: 2px solid #e5e7eb;
}
.position-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
}
.position-card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2px;
    padding: 10px 14px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
}
.position-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 10px 14px;
    font-size: 12px;
}
.position-card-label {
    color: #94a3b8;
    font-size: 11px;
    margin-bottom: 2px;
}
.position-card-val {
    font-weight: 600;
    color: #1e293b;
}
.position-card-pnl {
    text-align: right;
}
.position-card-pnl-main {
    font-size: 16px;
    font-weight: 700;
}
.position-card-sub {
    font-size: 11px;
    color: #94a3b8;
}

/* Inline note editing */
.note-editable {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: text;
    transition: all 0.2s;
    min-height: 36px;
    outline: none;
    display: inline-block;
    word-break: break-word;
}

.note-editable:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.note-editable:focus {
    background: white;
    border-color: #475569;
    box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.1);
}

.note-editable:empty:before {
    content: 'Добавить заметку...';
    color: #d1d5db;
    font-style: italic;
}

/* Toast notification */
.if-save-indicator {
    position: fixed;
    top: 90px; /* Ниже sticky-меню */
    right: 24px;
    background: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 1052;
    animation: slideInDown 0.3s ease;
}

.if-save-indicator.show {
    display: flex;
}

@keyframes slideInDown {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Адаптив для Toast */
@media (max-width: 768px) {
    .if-save-indicator {
        top: 70px; /* Меньший отступ для мобильных */
        right: 16px;
        left: 16px;
        max-width: calc(100% - 32px);
        font-size: 13px;
        padding: 10px 16px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .if-filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .if-filters-left {
        flex-direction: column;
        align-items: stretch;
    }

    .if-filter-item {
        width: 100%;
    }

    .if-filter-select,
    .if-filter-search {
        min-width: auto;
    }
}

/* ============================================
   Auth Pages (Light Theme)
   ============================================ */

.if-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: #f8f8fb;
    position: relative;
}

.if-auth-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 40px;
    position: relative;
    z-index: 1;
    box-shadow: 0 0.75rem 1.5rem rgba(18, 38, 63, 0.03);
}

.if-auth-logo {
    text-align: center;
    margin-bottom: 8px;
}

.if-auth-logo img {
    height: 40px;
}

.if-auth-title {
    text-align: center;
    margin-bottom: 4px;
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
}

.if-auth-subtitle {
    text-align: center;
    margin-bottom: 28px;
    font-size: 14px;
    color: #64748b;
}

.if-auth-card .form-label {
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.if-auth-card .form-control {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #1e293b;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.if-auth-card .form-control:focus {
    background-color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    color: #1e293b;
}

.if-auth-card .form-control::placeholder {
    color: #94a3b8;
}

.if-auth-card .input-group .btn {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-left: none;
    color: #64748b;
    border-radius: 0 10px 10px 0;
}

.if-auth-card .input-group .btn:hover {
    color: #1e293b;
    background-color: #f1f5f9;
}

.if-auth-card .input-group .form-control {
    border-radius: 10px 0 0 10px;
}

.if-auth-card .form-check-input {
    background-color: #f9fafb;
    border-color: #cbd5e1;
}

.if-auth-card .form-check-input:checked {
    background-color: #1e293b;
    border-color: #1e293b;
}

.if-auth-card .form-check-label {
    color: #64748b;
    font-size: 13px;
}

.if-auth-btn {
    width: 100%;
    padding: 11px;
    background: #1e293b;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.if-auth-btn:hover {
    background: #334155;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 41, 59, 0.2);
    color: #fff;
}

.if-auth-btn:active {
    transform: translateY(0);
}

.if-auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.if-auth-alert {
    border-radius: 10px;
    font-size: 13px;
    padding: 12px 16px;
}

.if-auth-alert.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.if-auth-alert.alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.if-auth-alert.alert-warning {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.if-auth-alert.alert-warning .if-auth-link {
    color: #92400e;
    text-decoration: underline;
    font-weight: 600;
}

.if-auth-link {
    color: #1e293b;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.if-auth-link:hover {
    color: #6366f1;
    text-decoration: none;
}

.if-auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.if-auth-footer p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.if-auth-bottom {
    text-align: center;
    margin-top: 24px;
    position: relative;
    z-index: 1;
}

.if-auth-bottom p {
    margin: 0 0 4px;
    font-size: 13px;
    color: #94a3b8;
}

.if-auth-forgot {
    display: inline-block;
    margin-top: 2px;
    font-size: 13px;
    color: #6366f1;
    text-decoration: none;
}

.if-auth-forgot:hover {
    color: #4f46e5;
}

/* Auth pages responsive */
@media (max-width: 480px) {
    .if-auth-card {
        padding: 28px 20px;
        border-radius: 12px;
    }

    .if-auth-title {
        font-size: 20px;
    }
}

/* ========================================
   Onboarding Widget — Illustration Hero
   ======================================== */

.if-onboarding {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* --- Hero section --- */
.if-onboarding-hero {
    position: relative;
    padding: 48px 40px;
    min-height: 260px;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%);
}

.if-onboarding-hero-content {
    position: relative;
    z-index: 2;
    max-width: 460px;
}

.if-onboarding-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px;
}

.if-onboarding-subtitle {
    font-size: 0.9375rem;
    color: #64748b;
    margin: 0 0 24px;
    line-height: 1.5;
}

.if-onboarding-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background: #1e293b;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.if-onboarding-cta:hover {
    background: #334155;
    color: #fff;
    text-decoration: none;
}

.if-onboarding-badge {
    margin-top: 14px;
    font-size: 0.8125rem;
    color: #64748b;
}

.if-onboarding-badge i {
    font-size: 0.75rem;
}

/* --- Illustration (SVG chart) --- */
.if-onboarding-illustration {
    position: absolute;
    right: 20px;
    bottom: 0;
    width: 340px;
    height: 220px;
    z-index: 1;
}

.if-onboarding-illustration svg {
    width: 100%;
    height: 100%;
}

/* --- Steps section (Variant 10: connector dots) --- */
.if-onboarding-steps {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    position: relative;
    border-top: 1px solid #e5e7eb;
}

.if-onboarding-step {
    padding: 24px 20px 24px 12px;
    position: relative;
    overflow: visible;
    display: flex;
    align-items: center;
    gap: 0;
}

.if-onboarding-step:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 60%;
    border-right: 2px dashed #e5e7eb;
}

.if-onboarding-step-connector {
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.if-onboarding-step-connector-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    font-size: 11px;
}

.if-onboarding-step-num {
    position: relative;
    flex-shrink: 0;
    font-size: 96px;
    font-weight: 900;
    color: rgba(30, 41, 59, 0.17);
    line-height: 1;
    user-select: none;
    width: 80px;
    text-align: center;
}

.if-onboarding-step-content {
    position: relative;
    z-index: 1;
    text-align: left;
}

.if-onboarding-step-icon {
    font-size: 22px;
    color: #6366f1;
    margin-bottom: 8px;
    display: block;
}

.if-onboarding-step-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.if-onboarding-step-desc {
    font-size: 13px;
    color: #64748b;
    line-height: 1.45;
}

.if-onboarding-step-desc a {
    color: #1e293b;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.if-onboarding-step-desc a:hover {
    color: #6366f1;
}

/* --- Features section --- */
.if-onboarding-features {
    display: flex;
    gap: 24px;
    padding: 24px 40px;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
}

.if-onboarding-feature {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.if-onboarding-feature > i {
    font-size: 1rem;
    flex-shrink: 0;
}

.if-onboarding-feature-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #1e293b;
}

.if-onboarding-feature-desc {
    font-size: 0.6875rem;
    color: #64748b;
    line-height: 1.4;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .if-onboarding-hero {
        padding: 36px 20px 28px;
        min-height: auto;
    }

    .if-onboarding-illustration {
        display: none;
    }

    .if-onboarding-hero-content {
        max-width: 100%;
    }

    .if-onboarding-title {
        font-size: 1.25rem;
    }

    .if-onboarding-steps {
        grid-template-columns: 1fr;
        border-top: 1px solid #e5e7eb;
    }

    .if-onboarding-step {
        padding: 20px 16px;
        border-bottom: 1px solid #e5e7eb;
    }

    .if-onboarding-step:last-child {
        border-bottom: none;
    }

    .if-onboarding-step:not(:last-child)::after {
        display: none;
    }

    .if-onboarding-step-connector {
        display: none;
    }

    .if-onboarding-features {
        flex-direction: column;
        padding: 20px;
        gap: 16px;
    }
}

/* ========================================
   Preview Block (Portfolio Onboarding)
   ======================================== */

.if-preview {
    margin-top: 32px;
}

.if-preview-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
    margin-bottom: 24px;
}

.if-preview-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.if-preview-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.if-preview-placeholder {
    aspect-ratio: 16 / 10;
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #94a3b8;
    margin: 12px;
    border-radius: 8px;
}

.if-preview-placeholder i {
    font-size: 1.5rem;
}

.if-preview-placeholder span {
    font-size: 0.75rem;
}

.if-preview-card-body {
    padding: 0 16px 16px;
}

.if-preview-card-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.if-preview-card-desc {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .if-preview-cards {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   FAQ Block (Portfolio Onboarding)
   ======================================== */

.if-faq {
    margin-top: 32px;
    margin-bottom: 40px;
    background: #fff;
    border-radius: 12px;
    padding: 32px 40px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.if-faq-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
    margin-bottom: 24px;
}

.if-faq-item {
    border-bottom: 1px solid #e5e7eb;
}

.if-faq-item:last-child {
    border-bottom: none;
}

.if-faq-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border: none;
    background: none;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    text-align: left;
}

.if-faq-btn:hover {
    color: #334155;
}

.if-faq-chevron {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 12px;
}

.if-faq-btn[aria-expanded="true"] .if-faq-chevron {
    transform: rotate(180deg);
}

.if-faq-answer {
    padding: 0 0 16px;
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0;
}

.if-faq-answer a {
    color: #1e293b;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.if-faq-answer a:hover {
    color: #6366f1;
}

@media (max-width: 768px) {
    .if-faq {
        padding: 24px 20px;
    }
}

/* ========================================
   Settings Page — Unified Card (Variant A)
   ======================================== */

.if-settings {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* Header */
.if-settings-header {
    padding: 28px 32px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.if-settings-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.if-settings-back {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--if-slate-600);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s;
}
.if-settings-back:hover {
    background: var(--if-slate-100);
    color: var(--if-slate-800);
}

.if-settings-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--if-slate-800);
    margin: 0;
}

.if-settings-subtitle {
    font-size: 0.8125rem;
    color: var(--if-slate-500);
    margin: 2px 0 0;
}

.if-settings-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    background: var(--if-slate-800);
    color: #fff;
    border: none;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.if-settings-add-btn:hover {
    background: var(--if-slate-700);
}
.if-settings-add-btn i {
    font-size: 11px;
}

/* Loading */
.if-settings-loading {
    padding: 40px 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--if-slate-500);
    font-size: 0.875rem;
}

/* Empty State */
.if-settings-empty {
    padding: 48px 32px;
    text-align: center;
}

.if-settings-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--if-slate-100);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--if-slate-400);
    font-size: 22px;
}

.if-settings-empty-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--if-slate-800);
    margin-bottom: 4px;
}

.if-settings-empty-desc {
    font-size: 0.8125rem;
    color: var(--if-slate-500);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Connection Row */
.if-settings-conn {
    padding: 20px 32px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: background 0.15s;
}
.if-settings-conn:hover {
    background: var(--if-slate-50);
}
.if-settings-conn:last-child {
    border-bottom: none;
}

.if-settings-conn-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}

.if-settings-conn-info {
    flex: 1;
    min-width: 0;
}

.if-settings-conn-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--if-slate-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.if-settings-conn-meta {
    font-size: 0.75rem;
    color: var(--if-slate-500);
    margin-top: 2px;
}

.if-settings-conn-status {
    font-size: 0.6875rem;
    color: #3b82f6;
    margin-top: 4px;
}
.if-settings-conn-status i {
    font-size: 0.625rem;
}

.if-settings-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.if-settings-badge-active {
    background: #ecfdf5;
    color: #059669;
}
.if-settings-badge-inactive {
    background: var(--if-slate-100);
    color: var(--if-slate-500);
}

.if-settings-conn-stats {
    display: flex;
    gap: 24px;
    flex-shrink: 0;
}

.if-settings-conn-stat {
    text-align: center;
}

.if-settings-conn-stat-val {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--if-slate-800);
}

.if-settings-conn-stat-label {
    font-size: 0.6875rem;
    color: var(--if-slate-400);
}

.if-settings-conn-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.if-settings-conn-action {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--if-slate-500);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.if-settings-conn-action:hover {
    border-color: var(--if-slate-400);
    color: var(--if-slate-800);
    background: var(--if-slate-50);
}
.if-settings-conn-action.danger:hover {
    border-color: #fca5a5;
    color: #dc2626;
    background: #fef2f2;
}

/* Footer — How to get token */
.if-settings-footer {
    padding: 20px 32px;
    background: var(--if-slate-50);
    border-top: 1px solid #f1f5f9;
}

.if-settings-footer-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--if-slate-700);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.if-settings-footer-title i {
    color: var(--if-slate-400);
}

.if-settings-footer-steps {
    display: flex;
    gap: 20px;
}

.if-settings-footer-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
}

.if-settings-footer-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--if-slate-200);
    color: var(--if-slate-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.if-settings-footer-step-text {
    font-size: 0.75rem;
    color: var(--if-slate-600);
    line-height: 1.45;
}
.if-settings-footer-step-text a {
    color: var(--if-slate-800);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.if-settings-footer-step-text a:hover {
    color: #6366f1;
}

.if-settings-security-note {
    margin-top: 16px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--if-slate-500);
    display: flex;
    align-items: center;
    gap: 8px;
}
.if-settings-security-note i {
    color: #22c55e;
}

@media (max-width: 768px) {
    .if-settings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }

    .if-settings-conn {
        flex-wrap: wrap;
        padding: 16px 20px;
        gap: 12px;
    }

    .if-settings-conn-stats {
        display: none;
    }

    .if-settings-footer {
        padding: 20px;
    }

    .if-settings-footer-steps {
        flex-direction: column;
        gap: 12px;
    }

    .if-settings-empty,
    .if-settings-loading {
        padding: 32px 20px;
    }
}

/* ========================================
   Modal — Slate Minimal Style
   ======================================== */

.if-modal {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.if-modal-header {
    background: var(--if-slate-50);
    border-bottom: 1px solid var(--if-slate-200);
    padding: 20px 24px;
}

.if-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--if-slate-800);
}

.if-modal .modal-body {
    padding: 24px;
}

.if-modal .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--if-slate-700);
}

.if-modal .form-control,
.if-modal .form-select {
    border-radius: 8px;
    border: 1px solid var(--if-slate-200);
    font-size: 0.875rem;
    padding: 10px 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.if-modal .form-control:focus,
.if-modal .form-select:focus {
    border-color: var(--if-slate-400);
    box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.08);
}

.if-modal .form-control::placeholder {
    color: var(--if-slate-400);
}

.if-modal .input-group .btn {
    border-radius: 0 8px 8px 0;
    border: 1px solid var(--if-slate-200);
    border-left: none;
    color: var(--if-slate-500);
    background: var(--if-slate-50);
}
.if-modal .input-group .btn:hover {
    color: var(--if-slate-800);
    background: var(--if-slate-100);
}
.if-modal .input-group .form-control {
    border-radius: 8px 0 0 8px;
}

.if-modal .form-text {
    font-size: 0.75rem;
    color: var(--if-slate-400);
}

.if-modal .form-check-input:checked {
    background-color: var(--if-slate-800);
    border-color: var(--if-slate-800);
}

.if-modal .alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    border-radius: 10px;
    font-size: 0.875rem;
}

.if-modal .btn-primary,
.if-modal-btn-primary {
    background: var(--if-slate-800) !important;
    border-color: var(--if-slate-800) !important;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 10px 20px;
    transition: background 0.15s;
}
.if-modal .btn-primary:hover,
.if-modal-btn-primary:hover {
    background: var(--if-slate-700) !important;
    border-color: var(--if-slate-700) !important;
}

.if-modal .btn-outline-secondary,
.if-modal-btn-secondary {
    border: 1px solid var(--if-slate-200) !important;
    color: var(--if-slate-600) !important;
    background: #fff !important;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 10px 20px;
}
.if-modal .btn-outline-secondary:hover,
.if-modal-btn-secondary:hover {
    background: var(--if-slate-50) !important;
    border-color: var(--if-slate-300) !important;
    color: var(--if-slate-800) !important;
}

.if-modal-footer {
    background: var(--if-slate-50);
    border-top: 1px solid var(--if-slate-200);
    padding: 16px 24px;
}

/* ========================================
   Header: Avatar Tier Ring
   ======================================== */

.if-avatar-ring {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 2px;
    background: var(--if-slate-200);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.if-avatar-ring[data-tier="pro"] {
    background: linear-gradient(135deg, #6366f1, #a78bfa, #6366f1);
    background-size: 200% 200%;
    animation: if-ring-shimmer 3s ease infinite;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.if-avatar-ring[data-tier="vip"] {
    background: linear-gradient(135deg, #f59e0b, #fbbf24, #f59e0b);
    background-size: 200% 200%;
    animation: if-ring-shimmer 3s ease infinite;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.if-avatar-ring[data-tier="basic"] {
    background: var(--if-slate-300);
}

@keyframes if-ring-shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.if-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--if-slate-500);
}

/* Subscription line under username in header button */
.if-header-sub {
    font-size: 0.6875rem;
    line-height: 1.2;
    color: var(--if-slate-400);
    white-space: nowrap;
    font-weight: 400;
    letter-spacing: 0.01em;
}

/* ========================================
   Header: User Dropdown
   ======================================== */

.if-user-dropdown {
    min-width: 260px;
    padding: 0;
    border: 1px solid var(--if-slate-200);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.if-user-dropdown .dropdown-item {
    padding: 10px 20px;
    font-size: 0.875rem;
    color: var(--if-slate-700);
    transition: background 0.15s, color 0.15s;
}

.if-user-dropdown .dropdown-item:hover {
    background: var(--if-slate-50);
    color: var(--if-slate-900);
}

.if-user-dropdown .dropdown-item i {
    width: 20px;
    text-align: center;
}

.if-user-dropdown .dropdown-divider {
    margin: 0;
    border-color: var(--if-slate-100);
}

/* ========================================
   Header: Subscription Card (dropdown)
   ======================================== */

.if-sub-card {
    border-bottom: 1px solid var(--if-slate-100);
}

.if-sub-card-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.if-sub-card-inner:hover {
    background: var(--if-slate-50);
    color: inherit;
    text-decoration: none;
}

.if-sub-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: var(--if-slate-100);
    color: var(--if-slate-500);
}

.if-sub-card-icon[data-tier="pro"] {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
}

.if-sub-card-icon[data-tier="vip"] {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.if-sub-card-icon[data-tier="basic"] {
    background: var(--if-slate-100);
    color: var(--if-slate-600);
}

.if-sub-card-body {
    flex: 1;
    min-width: 0;
}

.if-sub-card-plan {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--if-slate-800);
    line-height: 1.3;
}

.if-sub-card-meta {
    font-size: 0.6875rem;
    color: var(--if-slate-400);
    line-height: 1.3;
    margin-top: 1px;
}

.if-sub-card-arrow {
    color: var(--if-slate-300);
    font-size: 11px;
    flex-shrink: 0;
    transition: transform 0.15s, color 0.15s;
}

.if-sub-card-inner:hover .if-sub-card-arrow {
    color: var(--if-slate-500);
    transform: translateX(2px);
}

/* ========================================
   Trial CTA Chip (header)
   ======================================== */
.if-trial-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 10px;
    background: linear-gradient(135deg, #eff6ff, #eef2ff);
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    text-decoration: none;
    color: #1e40af;
    margin-right: 8px;
    transition: all 0.2s;
    animation: if-chip-pulse 3s ease-in-out infinite;
}
.if-trial-chip:hover {
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
    border-color: #93c5fd;
    color: #1e3a8a;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.if-trial-chip-icon {
    font-size: 14px;
    color: #6366f1;
    flex-shrink: 0;
}

.if-trial-chip-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.if-trial-chip-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #4338ca;
}
.if-trial-chip-days {
    font-size: 0.625rem;
    font-weight: 700;
    color: #6366f1;
}

@keyframes if-chip-pulse {
    0%, 100% { border-color: #bfdbfe; }
    50% { border-color: #818cf8; }
}

@media (max-width: 991.98px) {
    .if-trial-chip { display: none !important; }
}

/* Mobile trial banner — hidden on desktop, shown on mobile via .is-visible */
.if-mobile-trial-banner {
    display: none;
}
.if-mobile-trial-banner.is-visible {
    display: none;
}
@media (max-width: 991.98px) {
    .if-mobile-trial-banner.is-visible {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 16px;
        background: linear-gradient(135deg, #eef2ff, #eff6ff);
        border-bottom: 1px solid #c7d2fe;
        text-decoration: none;
        color: #4338ca;
        font-size: 0.8125rem;
        line-height: 1.3;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        z-index: 1001;
    }
    .if-mobile-trial-banner.is-visible i:first-child {
        color: #6366f1;
        font-size: 14px;
        flex-shrink: 0;
    }
    .if-mobile-trial-banner.is-visible span {
        flex: 1;
    }
    .if-mobile-trial-banner.is-visible i:last-child {
        color: #a5b4fc;
        font-size: 10px;
        flex-shrink: 0;
    }
}

/* ========================================
   Mobile — Journal Page (iPhone 12 Pro 390px)
   ======================================== */

/* Навбар: предотвращаем overflow */
@media (max-width: 767.98px) {
    .navbar-header {
        padding: 0 8px 0 4px;
    }

    /* Логотип: только иконка, скрываем текст "ИнвестФордж" */
    body[data-layout="horizontal"] .navbar-brand-box .logo-lg {
        display: none !important;
    }
    body[data-layout="horizontal"] .navbar-brand-box .logo-sm {
        display: inline-block !important;
    }
    body[data-layout="horizontal"] .navbar-brand-box {
        padding: 0 0 0 8px !important;
    }

    /* Portfolio switcher: компактнее */
    #portfolioSwitcher {
        margin-left: 4px !important;
    }

    #portfolioSwitcher .btn-group {
        margin-left: 4px !important;
    }

    #portfolioSwitcher .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 13px;
    }

    /* Скрываем кнопку настроек (gear) — доступна в профиле */
    #portfolioSwitcher .btn-group a[href="/journal/settings"] {
        display: none;
    }

    /* Скрываем «Последнее обновление» */
    #lastSyncTime {
        display: none !important;
    }

    /* Уменьшаем page-content padding */
    body[data-layout=horizontal] .page-content {
        padding-left: 8px;
        padding-right: 8px;
    }

    /* Terminal header: компактнее */
    .if-terminal-header {
        padding: 0 0 12px;
        gap: 8px;
    }

    .if-terminal-path {
        font-size: 1rem;
    }

    /* Cards: меньше скругления и отступы */
    .card .card-body {
        padding: 12px;
    }

    /* Stats widget mobile */
    .stats-widget-top {
        gap: 8px;
    }

    .stats-section {
        gap: 10px;
        padding: 8px 10px;
    }

    .stats-label {
        font-size: 10px;
    }

    .stats-value {
        font-size: 14px;
    }

    .stats-pnl {
        padding: 8px 12px;
        gap: 10px;
    }

    .stats-pnl-value {
        font-size: 17px;
    }

    .stats-pnl-label {
        font-size: 10px;
    }

    .stats-bar-header {
        font-size: 11px;
    }

    /* Графики: компактнее */
    .card-title {
        font-size: 0.95rem;
    }

    #pnlGroupingFilter .btn {
        padding: 4px 8px;
        font-size: 12px;
    }

    #pnlChartContainer {
        height: 220px !important;
    }

    /* Фильтры */
    .if-filters-bar .d-flex.align-items-center.gap-2 {
        width: 100%;
        justify-content: space-between;
    }
}

/* Period Picker mobile стили в <style> тега Index.cshtml */
