/* Glass & Cards */
.glass {
    background: var(--surface-1);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.card {
    padding: 18px 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--surface-1);
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-card-hover);
}

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 18px 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
}

@media (max-width: 768px) {
    .card,
    .glass-panel {
        padding: 14px 16px;
    }
}

/* ============================================================
   GLOBAL UTILITY CLASSES
   ============================================================ */

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* --- Empty States --- */
.empty-state {
    text-align: center;
    padding: 20px 0;
    color: var(--text-dim, #4b5563);
    font-size: 0.8rem;
}

/* --- Section Headers --- */
.section-header {
    color: var(--text-secondary);
    margin-top: 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--divider-subtle);
    padding-bottom: 6px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* --- Page Headers (glass wrapper title rows) --- */
.page-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--glass-bg-strong);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.page-header-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-bg-strong);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.page-header-title {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.page-header-subtitle {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* --- Support Section Titles --- */
.support-section-title {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

/* --- Dividers --- */
.divider {
    border: none;
    border-bottom: 1px solid var(--divider);
    margin: 0;
}

/* --- Form Labels --- */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* --- Glass Input (dark form controls) --- */
.glass-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-medium);
    background: var(--glass-bg-input);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.glass-input:focus {
    outline: none;
    border-color: var(--border-strong);
}

.glass-input option {
    background: var(--surface-3);
}

/* --- Data Tables (JS-rendered) --- */
.data-table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 100%;
}

.data-table th {
    color: var(--text-dim);
    border-bottom: 1px solid var(--divider);
    padding-bottom: 5px;
    font-weight: 600;
    font-size: 0.78rem;
}

.data-table td {
    padding: 8px 0;
    font-size: 0.84rem;
    line-height: 1.5;
}

/* --- Inline Labels (for key:value pairs in JS) --- */
.inline-label {
    color: var(--text-subtle);
    display: inline-block;
    width: 80px;
    font-size: 0.82rem;
}

/* --- Text Utilities --- */
.text-xs { font-size: 0.7rem; }
.text-sm { font-size: 0.85rem; }
.text-md { font-size: 0.95rem; }
.text-dim { color: var(--text-dim); }
.text-bold { font-weight: 700; color: var(--text); }
.text-accent { color: var(--accent); }
.text-danger { color: #ef4444; }
.text-success { color: #10b981; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-white { color: var(--text); }
.text-green { color: #10b981; }
.text-red { color: #ef4444; }
.text-blue { color: #38bdf8; }
.text-muted { color: var(--text-muted); }
.text-upper { text-transform: uppercase; letter-spacing: 0.5px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowrap { white-space: nowrap; }
.fw-900 { font-weight: 900; }
.fw-700 { font-weight: 700; }
.fw-600 { font-weight: 600; }
.font-mono { font-family: monospace; }

/* --- Spacing Utilities --- */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.p-2 { padding: 10px; }
.p-3 { padding: 15px; }
.p-4 { padding: 18px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }
.gap-4 { gap: 20px; }
.pad-sm { padding: 12px; }
.pad-md { padding: 16px; }
.pad-lg { padding: 22px; }
.pt-2 { padding-top: 8px; }
.mr-1 { margin-right: 0.25rem; }
.cursor-pointer { cursor: pointer; }
.text-xxs { font-size: 0.65rem; }
.label-uppercase {
    font-size: 0.67rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    text-align: center;
}
.pad-btn { padding: 6px 14px; }

/* --- Flex Layout Utilities --- */
.flex-col { display: flex; flex-direction: column; }
.flex-row { display: flex; flex-direction: row; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-start { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.min-h-0 { min-height: 0; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.d-none { display: none; }

/* --- Settings Section Divider --- */
.settings-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--divider);
}

/* --- Section Heading (settings/forms) --- */
.section-heading {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text);
}

/* --- Status Badge (ticket status, tags) --- */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.status-badge-open { background: rgba(46, 204, 113, 0.1); color: #2ecc71; }
.status-badge-replied { background: rgba(241, 196, 15, 0.1); color: #f1c40f; }
.status-badge-closed { background: rgba(231, 76, 60, 0.1); color: #e74c3c; }

/* --- Alert Boxes (flash messages) --- */
.alert-box {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
}
.alert-box-error { background: rgba(239, 68, 68, 0.1); border: 1px solid #ef4444; color: #ef4444; }
.alert-box-success { background: rgba(34, 197, 94, 0.1); border: 1px solid #22c55e; color: #22c55e; }

/* --- Auth Layout (login/register centering) --- */
.auth-center {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 30px;
}

/* --- Disabled Button (pricing current plan) --- */
.btn-disabled {
    opacity: 0.7;
    cursor: default;
    width: 100%;
    margin-top: 15px;
}

/* --- Skeleton Loading Bars --- */
.skel-bar {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 3px;
}
.skel-bar-wide { width: 90%; }
.skel-bar-narrow { width: 80%; }
.skel-bar-mid { width: 85%; }

/* --- Legal Page Section Heading --- */
.legal-heading {
    color: var(--text);
    margin-top: 30px;
    margin-bottom: 15px;
}

/* --- Admin Table Cell (centered, padded) --- */
.td-center {
    padding: 6px 8px;
    text-align: center;
}

/* --- Chart Inline Tag (ticker metadata badges) --- */
.chart-inline-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 8px;
    white-space: nowrap;
}

/* --- Chart Meta Row (key-value flex rows) --- */
.chart-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* --- Tabular Numbers (financial data) --- */
.tabular-nums {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* --- Accent Bold (ticker symbols) --- */
.accent-bold {
    font-weight: bold;
    color: var(--accent);
}

/* --- Link Accent (primary links, no underline) --- */
.link-accent {
    color: var(--primary-light);
    text-decoration: none;
}

/* --- Full-Width Submit Button (auth forms) --- */
.btn-submit-full {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 1.05rem;
}

/* .btn-ghost — REMOVED: replaced by .tab-btn default state */

/* --- Close/Delete Button (× icon) --- */
.btn-close-x {
    background: none;
    border: none;
    color: #ff4500;
    cursor: pointer;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.btn-close-x:hover {
    opacity: 1;
}

/* --- Sidebar Sub-Label --- */
.sidebar-label {
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--text-dim);
    margin-bottom: 10px;
}

/* --- Stat Pill (metric display) --- */
.stat-pill {
    background: var(--glass-bg-strong);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* --- Chart Data Panel (tabbed sections) --- */
.chart-panel {
    display: none;
    flex: 1;
}

.chart-panel.active {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Admin Grid Cell --- */
.admin-cell {
    padding: 10px;
    min-height: 0;
}

/* --- Pill Buttons (small glass-style) --- */
.btn-pill {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    line-height: 1;
}

.btn-pill:hover {
    background: var(--glass-bg-active);
    color: var(--text);
}

/* --- Notification Cards --- */
.notif-card {
    padding: 10px;
    border-radius: 8px;
    background: var(--glass-bg);
    border-left: 3px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.notif-card-unread {
    border-left-color: var(--primary-light);
}

/* --- Scrollable Containers --- */
.scroll-y {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- List Items (interactive rows) --- */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--border-subtle);
    text-decoration: none;
    transition: all 0.2s;
    color: inherit;
}

.list-item:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border);
}

/* --- Dropdown Header --- */
.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--divider);
    padding-bottom: 8px;
}

.dropdown-header-title {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

/* --- Modal System --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--overlay-bg);
    z-index: 200000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 1rem;
    box-sizing: border-box;
}

.modal-card {
    max-width: 520px;
    width: 95%;
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    display: flex;
    flex-direction: column;
    padding: 0;
    animation: fadeIn 0.2s ease;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    /* Suppress .card hover lift effect on modals */
    transform: none !important;
}

.modal-card:hover {
    transform: none !important;
    box-shadow: none;
}

@media (max-height: 700px) {
    .modal-overlay {
        align-items: flex-start;
        padding-top: 8px;
    }
    .modal-card {
        max-height: calc(100vh - 32px);
        max-height: calc(100dvh - 32px);
    }
}

.modal-header {
    padding: 0.375rem 1.25rem;
    border-bottom: 1px solid var(--divider-subtle);
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    flex-shrink: 0;
}

.modal-body {
    padding: 0.875rem 1.25rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    word-wrap: break-word;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
}

.modal-actions {
    padding: 0.625rem 1.25rem 0.875rem;
    border-top: 1px solid var(--divider-subtle);
    display: flex;
    gap: 0.625rem;
    justify-content: flex-end;
    flex-shrink: 0;
    background: var(--surface-1);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 4px;
    line-height: 1;
    flex-shrink: 0;
}

.modal-close:hover {
    color: var(--text);
}

/* Settings modals: pin to top (just below navbar) instead of centering */
#notifSettingsModal.modal-overlay,
#acctSettingsModal.modal-overlay {
    align-items: flex-start;
    padding: 72px 16px 16px;
}

/* Mobile: settings modals use centered popup card (consistent with other popups) */
@media (max-width: 640px) {
    #acctSettingsModal.modal-overlay,
    #notifSettingsModal.modal-overlay {
        padding: 1rem;
        align-items: center;
        justify-content: center;
    }
    #acctSettingsModal .modal-card,
    #notifSettingsModal .modal-card {
        width: 95%;
        max-width: 26rem;
        height: auto;
        max-height: calc(100vh - 2rem);
        max-height: calc(100dvh - 2rem);
        border-radius: 1rem !important;
    }
}


/* Feature Cards */
.feature-card {
    text-align: left;
    padding: 15px;
}

.feature-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.feature-title {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.feature-description {
    color: var(--text-dim);
    line-height: 1.5;
    font-size: 0.95rem;
}

/* Dashboard Cards */
.stat-card {
    background: var(--surface-1);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.stat-label {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--text);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(220, 38, 38, 0.2);
}

.btn-secondary {
    background: var(--surface-5);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-6);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--primary-light);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
    background: var(--primary);
    color: white;
}

/* Compact button variant for toolbars and dense UI */
.btn-sm {
    padding: 4px 8px;
    font-size: 0.72rem;
    border-radius: 6px;
    gap: 4px;
}

/* Navigation bar button sizing */
.nav-btn {
    padding: 5px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
}

/* Single notification mark-read button */
.btn-mark-single {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.btn-mark-single:hover {
    background: rgba(16, 185, 129, 0.25);
}

/* Horizontal scrolling button row — prevents stacking on mobile */
.btn-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════
   Extra Button Modifiers
   ═══════════════════════════════════════════ */

/* Extra-small button (inline controls, tight spaces) */
.btn-xs {
    padding: 2px 8px;
    font-size: 0.7rem;
    border-radius: 4px;
    gap: 3px;
}

/* Full-width button */
.btn-full {
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
}

/* Warning variant (amber) */
.btn-warning {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #f59e0b;
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.35);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════
   Unified Tab System
   ═══════════════════════════════════════════
   Usage:
     <div class="tab-bar">
       <button class="tab-btn active">Tab 1</button>
       <button class="tab-btn">Tab 2</button>
     </div>

   Variants:
     .tab-bar--segment  → underline indicator (no container bg)
     .tab-bar--sm       → smaller font + padding
     .tab-bar--compact  → tightest (timeframe buttons)
     .tab-bar--flush    → no bg/border/padding (inline rows)
   ═══════════════════════════════════════════ */

/* ─── Tab Bar — base (pill/chip style for dense toolbars) ──────────────── */
.tab-bar {
    display: flex;
    gap: 2px;
    background: var(--glass-bg-strong);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-medium);
    flex-shrink: 0;
}

/* Base tab button */
.tab-btn {
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.18s, background 0.18s, border-color 0.18s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.tab-btn:hover {
    background: var(--glass-bg-hover);
    color: var(--text);
}

.tab-btn.active {
    background: var(--glass-bg-active);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ─── Segment variant — underline indicator (profile ptab style) ─────── */
/* Fully standalone: can be used without .tab-bar base class.              */
.tab-bar--segment {
    display: flex;
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    /* Reserve scrollbar gutter space so layout never shifts when bar appears */
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
    background: none;
    border: none;
    padding: 10px 14px 0;
    gap: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--glass-bg-active);
}

/* Thin 2px scrollbar on webkit browsers */
.tab-bar--segment::-webkit-scrollbar {
    height: 2px;
}
.tab-bar--segment::-webkit-scrollbar-track {
    background: transparent;
}
.tab-bar--segment::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 2px;
}

.tab-bar--segment .tab-btn {
    padding: 8px 14px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px 6px 0 0;
    background: none;
    color: var(--text-dim);
    /* No border-bottom — use inset box-shadow for active indicator instead.
       border-bottom + margin-bottom: -1px gets clipped by overflow-x: auto. */
    border: none;
    flex-shrink: 0;
    letter-spacing: 0.01em;
    transition: color 0.18s, box-shadow 0.18s, background 0.15s;
}

.tab-bar--segment .tab-btn:hover {
    color: var(--text);
    background: var(--glass-bg-hover);
    transform: none;
}

.tab-bar--segment .tab-btn.active {
    color: var(--text);
    /* Inset bottom shadow = 2px red underline that never clips in overflow-x containers */
    box-shadow: inset 0 -2px 0 var(--primary);
    background: var(--glass-bg-input);
}

/* ─── Small variant (sub-tabs, dense rows) ──────────────────────────── */
.tab-bar--sm {
    gap: 3px;
}

.tab-bar--sm .tab-btn {
    padding: 4px 10px;
    font-size: 0.72rem;
}

/* Segment + sm combo */
.tab-bar--segment.tab-bar--sm {
    padding: 6px 10px 0;
}

.tab-bar--segment.tab-bar--sm .tab-btn {
    padding: 5px 10px 7px;
    font-size: 0.75rem;
}

/* ─── Compact variant (timeframe pickers, chart type toggles) ─────────── */
.tab-bar--compact {
    gap: 2px;
    padding: 2px;
    border-radius: 6px;
}

.tab-bar--compact .tab-btn {
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* ─── Flush variant (no chrome, inline button rows) ──────────────────── */
.tab-bar--flush {
    background: none;
    border: none;
    padding: 0;
    gap: 5px;
}

.tab-bar--flush .tab-btn {
    background: var(--surface-5);
    color: var(--text);
    padding: 4px 8px;
    font-size: 0.72rem;
    border-radius: 6px;
}

.tab-bar--flush .tab-btn:hover {
    background: var(--surface-6);
}

.tab-bar--flush .tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: none;
}

@media (max-width: 768px) {
    /* Global button scaling on mobile */
    .btn {
        padding: 5px 10px;
        font-size: 0.75rem;
        gap: 5px;
    }

    .btn-sm {
        padding: 3px 7px;
        font-size: 0.7rem;
    }

    .btn-xs {
        padding: 2px 6px;
        font-size: 0.65rem;
    }

    /* Button rows: horizontal scroll on mobile instead of wrapping */
    .btn-row {
        gap: 4px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        mask-image: linear-gradient(to right, #000 88%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, #000 88%, transparent 100%);
        padding-bottom: 4px;
        scrollbar-width: none; /* Firefox */
    }
    .btn-row::-webkit-scrollbar { display: none; } /* Chrome/Safari */

    .btn-row .btn {
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Tab bar mobile: horizontal scroll */
    .tab-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tab-bar::-webkit-scrollbar { display: none; }

    .tab-btn {
        flex-shrink: 0;
        padding: 4px 10px;
        font-size: 0.72rem;
    }

    .tab-bar--segment .tab-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .tab-bar--sm .tab-btn {
        padding: 3px 8px;
        font-size: 0.68rem;
    }

    /* Card & heading scaling on mobile */
    .card.glass,
    .stat-card {
        padding: 12px;
    }

    .card.glass h3,
    .stat-card h3 {
        font-size: 0.95rem;
    }

    /* Modal scaling */
    .modal-card {
        padding: 16px;
        max-height: 85vh;
    }

    .modal-header {
        gap: 8px;
    }

    /* Glass panel headings */
    .glass-panel h3 {
        font-size: 0.9rem;
    }

    /* Section headers */
    .section-header h3 {
        font-size: 1rem;
    }
}

/* Forms & Inputs */
.form-control {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-medium);
    color: var(--text);
    padding: 10px;
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.form-control option {
    background: var(--input-option-bg);
}

/* ── Global <select> theme ─────────────────────────────────────────────
   Native <select> popups are OS-rendered and ignore most CSS, but we can
   force a themed background on the element + options so the popup reads
   correctly on Chromium/Firefox (the primary target browsers). */
select {
    background-color: var(--select-bg);
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 8px center;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 28px;
    transition: border-color 0.2s, background-color 0.2s;
}

select:hover {
    border-color: var(--border-strong);
    background-color: var(--select-hover-bg);
}

select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

select option {
    background-color: var(--select-option-bg);
    color: var(--text-secondary);
}

select option:checked,
select option:hover {
    background-color: var(--select-option-active-bg);
    color: var(--text);
}

/* Override .btn { border: none } and .btn-secondary { background } for select elements
   so sort dropdowns still look like dark glass inputs, not borderless buttons. */
select.btn {
    border: 1px solid var(--border-medium) !important;
    background-color: var(--select-bg);
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 8px center;
    color: var(--text-secondary);
    padding-right: 28px;
    font-weight: normal;
    transform: none !important;
}

select.btn:hover {
    border-color: var(--border-strong) !important;
    background-color: var(--select-hover-bg);
    transform: none !important;
}

.input-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-dim);
}

/* Navigation System */
nav.nav-bar {
    border-bottom: 1px solid var(--glass-border);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin: 0;
    padding: 9px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

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

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
    justify-content: flex-end;
    flex: 1;
}

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

.logo {
    font-weight: 900;
    font-size: 1.6rem;
    letter-spacing: -1px;
    color: var(--primary);
    text-transform: uppercase;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    line-height: 1;
}

.logo-text {
    white-space: nowrap;
}

.logo img {
    height: 24px;
    width: auto;
    display: block;
}

.logo span {
    color: inherit;
}

.nav-socials {
    display: flex;
    gap: 12px;
    margin-left: 10px;
    align-items: center;
    height: 32px;
}

.nav-social-link {
    color: var(--text-dim);
    display: flex;
    align-items: center;
}

.nav-social-link:hover {
    color: var(--text);
}

.nav-discord-link {
    color: #5865F2;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.nav-discord-link:hover {
    text-decoration: underline;
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 10px;
    background-color: var(--surface-1);
    min-width: 320px;
    max-width: 90vw;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--glass-border);
    z-index: 1001;
    overflow-y: auto;
}

.nav-dropdown:not(.click-only):hover .nav-dropdown-content,
.nav-dropdown.active .nav-dropdown-content {
    display: block;
    animation: fadeIn 0.15s ease-in-out;
}

/* Hover bridge for hover-based dropdowns */
.nav-dropdown:not(.click-only)::after {
    content: '';
    position: absolute;
    top: 100%;
    left: -10px;
    right: -10px;
    height: 20px;
    background: transparent;
}

.nav-dropdown-item {
    color: var(--text);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    transition: background 0.2s;
    border-bottom: 1px solid var(--divider-subtle);
}

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

.nav-dropdown-item:hover {
    background-color: var(--glass-bg-hover);
    color: var(--primary-light);
}

.nav-dropdown-item.active {
    color: var(--primary-light);
    background: rgba(220, 38, 38, 0.08);
    font-weight: 700;
}

.nav-dropdown-item.danger:hover {
    background-color: rgba(220, 38, 38, 0.1);
    color: #ef4444;
}

/* Global hover feedback for all interactive elements inside dropdowns */
.nav-dropdown-content a:hover,
.nav-dropdown-content button:hover {
    filter: brightness(1.3);
    background-color: var(--glass-bg-active) !important;
}

.nav-notif-card:hover {
    background: var(--glass-bg-active) !important;
}

.nav-search-container {
    display: flex;
    align-items: center;
    background: var(--glass-bg-strong);
    border: 1px solid var(--border-medium);
    border-radius: 20px;
    padding: 4px 12px;
    margin: 0 20px;
    transition: all 0.2s ease;
    flex: 0 1 300px;
    width: 100%;
}

.nav-search-container:focus-within {
    border-color: var(--primary);
    background: var(--glass-bg-active);
}

.nav-search-input {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.85rem;
    width: 100%;
    outline: none;
    text-transform: uppercase;
}

.nav-search-input::placeholder {
    color: var(--text-faint);
    text-transform: none;
}

/* Notifications Badge */
.nav-notif-link {
    text-decoration: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.nav-notif-link:hover {
    color: var(--text);
}

.nav-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    display: none;
    border: 1px solid var(--nav-badge-border);
}

.notif-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    transition: all 0.2s;
}

.notif-item:hover {
    background: var(--glass-bg-hover);
}

.notif-unread {
    border-left: 3px solid var(--primary);
    background: rgba(16, 185, 129, 0.05);
}

/* Mobile Bottom Nav */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid var(--glass-border);
    z-index: 2000;
    padding: 12px 0;
    padding-bottom: env(safe-area-inset-bottom, 15px);
}

.mobile-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-dim);
    font-size: 0.7rem;
    gap: 4px;
    text-decoration: none;
    transition: color 0.2s;
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
    color: var(--primary);
}

.desktop-only {
    display: flex;
}

.desktop-only-inline {
    display: inline-flex;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    body {
        padding-bottom: 5rem;
    }

    nav.nav-bar {
        padding: 0.5rem 0.625rem;
        flex-wrap: nowrap;
    }

    .nav-left {
        gap: 8px;
    }

    .logo {
        font-size: 0.9rem;
        gap: 6px;
        letter-spacing: -0.5px;
    }

    .logo img {
        height: 20px;
    }

    .nav-socials {
        gap: 6px !important;
        margin-left: 6px;
    }

    .nav-social-link svg {
        width: 20px !important;
        height: 20px !important;
    }

    .nav-actions {
        width: auto;
        flex-wrap: nowrap;
    }

    .nav-user-group {
        gap: 8px;
    }

    nav.nav-bar .nav-dropdown-content {
        position: fixed !important;
        right: auto !important;
        left: 50% !important;
        top: 50px !important;
        transform: translateX(-50%);
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: calc(100vh - 70px) !important;
        max-height: calc(100dvh - 70px) !important;
        margin-top: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    html, body {
        overflow-x: hidden;
    }

    .nav-search-container {
        display: none !important;
    }

    .mobile-nav {
        display: block;
    }

    .desktop-only {
        display: none !important;
    }

    .desktop-only-inline {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .mobile-only.flex-col {
        display: flex !important;
        flex-direction: column;
    }

    /* Profile page: stack stat cards vertically */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Page titles */
    h1,
    .page-title {
        font-size: 1.8rem;
        letter-spacing: -1px;
    }

    .page-subtitle,
    .subtitle {
        font-size: 1rem;
    }
}

/* Mobile auth button (top-right user icon for logged-out users) */
.mobile-auth-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.mobile-auth-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--primary);
    color: var(--primary-light);
}

@media (max-width: 768px) {
    .mobile-auth-btn {
        display: flex;
    }
}

/* Mobile Auth Modal */
.mobile-auth-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    z-index: 100001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.15s ease;
    padding: 1rem;
    box-sizing: border-box;
}

.mobile-auth-modal.open {
    display: flex;
}

.mobile-auth-modal-card {
    background: var(--surface-1);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem 1.25rem;
    width: 92%;
    max-width: 20rem;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    text-align: center;
    animation: fadeInUp 0.25s ease;
    position: relative;
    box-sizing: border-box;
}

.mobile-auth-modal-card .auth-modal-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem auto;
}

.mobile-auth-modal-card .auth-modal-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.mobile-auth-modal-card .auth-modal-icon img {
    width: 2.75rem !important;
    height: 2.75rem !important;
    border-radius: 50%;
}

.mobile-auth-modal-card h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.mobile-auth-modal-card p {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
}

.mobile-auth-modal-card .auth-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-auth-modal-card .auth-actions .btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    border-radius: 0.5rem;
    width: 100%;
}

.mobile-auth-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}

.mobile-auth-modal-close:hover {
    color: var(--text);
}
/* Extra-small screens — even more compact modal */
@media (max-height: 600px), (max-width: 360px) {
    .mobile-auth-modal {
        padding: 0.5rem;
    }
    .mobile-auth-modal-card {
        padding: 1rem 1rem;
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
        border-radius: 0.75rem;
    }
    .mobile-auth-modal-card .auth-modal-icon {
        width: 2.5rem;
        height: 2.5rem;
        margin-bottom: 0.5rem;
    }
    .mobile-auth-modal-card .auth-modal-icon img {
        width: 2.25rem !important;
        height: 2.25rem !important;
    }
    .mobile-auth-modal-card h3 {
        font-size: 1rem;
    }
    .mobile-auth-modal-card p {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }
    .mobile-auth-modal-card .auth-actions {
        gap: 0.375rem;
    }
    .mobile-auth-modal-card .auth-actions .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    .theme-toggle-mobile {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Modals — see primary .modal-overlay definition above (line ~493) */

.modal-glass {
    padding: 1.5rem;
    width: 90%;
    max-width: 25rem;
    background: var(--surface-1);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    animation: fadeIn 0.2s ease;
    text-align: center;
}

.modal-close-btn {
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--primary);
}

/* Card Headers */
.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.card-title-icon {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

/* Tables & Data Rows */
.data-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--divider-subtle);
}

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

.data-label {
    color: var(--text-dim);
}

.data-val {
    font-weight: 600;
    color: var(--text);
    text-align: right;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.user-table th {
    text-align: left;
    border-bottom: 1px solid var(--divider);
    padding: 10px;
}

.user-table td {
    border-bottom: 1px solid var(--divider-subtle);
    padding: 10px;
}

/* Prices and Badges */
.price-tag {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 5px;
}

.price-period {
    font-size: 1rem;
    color: var(--text-dim);
    font-weight: 400;
}

.tier-badge {
    background: var(--glass-bg-active);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

.tier-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-top: 12px;
}

/* ─── Mobile Search FAB ────────────────────────────────────────────────── */
.mobile-search-fab {
    position: fixed;
    bottom: 85px;
    right: 12px;
    z-index: 2000;
    display: none;
    background: var(--surface-1);
    border: 1px solid var(--primary);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
    color: var(--primary-light);
    opacity: 0.7;
    transition: opacity 0.2s;
    text-decoration: none;
}

.mobile-search-fab:hover {
    opacity: 1;
}

/* ─── Mobile Search Modal (mirrors desktop nav-search pill) ────────────── */
.mobile-search-modal {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
}

.mobile-search-modal-inner {
    width: 100%;
    max-width: 520px;
    padding: 24px 20px;
    padding-top: calc(env(safe-area-inset-top, 16px) + 16px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mobile-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 16px;
}

.mobile-search-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.mobile-search-modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
    flex-shrink: 0;
}

.mobile-search-modal-close:hover {
    color: var(--text);
}

.mobile-search-form {
    width: 100%;
    margin: 0;
}

.mobile-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--glass-bg-strong);
    border: 1px solid var(--border-medium);
    border-radius: 20px;
    padding: 10px 16px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.mobile-search-wrap:focus-within {
    border-color: var(--primary);
    background: var(--glass-bg-active);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.mobile-search-field {
    font-size: 1rem !important;
    padding-right: 36px;
}

.mobile-search-icon {
    color: var(--text-dim);
    position: absolute;
    right: 16px;
    flex-shrink: 0;
    pointer-events: none;
}

.mobile-search-hint {
    color: var(--text-dim);
    margin-top: 14px;
    font-size: 0.82rem;
    text-align: center;
    opacity: 0.7;
}

/* Specific overrides from base.html */
@media (max-width: 768px) {
    .mobile-search-fab {
        display: flex !important;
    }
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, var(--skeleton-from) 25%, var(--skeleton-via) 50%, var(--skeleton-from) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

.skeleton-box {
    border-radius: 8px;
    height: 100%;
    width: 100%;
}

.skeleton-text {
    border-radius: 4px;
    height: 1rem;
    width: 60%;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.long {
    width: 90%;
}

.skeleton-circle {
    border-radius: 50%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

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

/* --- AI Analysis Feedback Bar --- */

.ai-feedback-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    transition: opacity 0.5s ease;
}

.ai-feedback-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: -0.2px;
}

.ai-feedback-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-dim);
}

.ai-feedback-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-medium, rgba(255, 255, 255, 0.15));
    transform: scale(1.05);
}

.ai-feedback-up:hover {
    border-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}

.ai-feedback-down:hover {
    border-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.15);
}
/* ════════════════════════════════════════════════════════════
   Settings Hub Modal — global (available on all pages)
   ════════════════════════════════════════════════════════════ */

/* Small count badge (green) */
.badge-count-green {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Override modal-card sizing for the settings hub */
#acctSettingsModal .settings-hub-card {
    width: min(820px, calc(100vw - 32px));
    height: min(660px, calc(100vh - 80px));
    height: min(660px, calc(100dvh - 80px));
    max-width: none;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
}

.settings-hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.settings-hub-title {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
}

.settings-hub-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.settings-hub-nav {
    width: 175px;
    flex-shrink: 0;
    border-right: 1px solid var(--glass-border);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
}

.settings-tab-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    background: none;
    border: none;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--text-dim);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
    font-weight: 500;
}

.settings-tab-btn i {
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.settings-tab-btn:hover {
    background: var(--glass-bg-hover);
    color: var(--text);
}

.settings-tab-btn.active {
    background: var(--glass-bg-input);
    color: var(--text);
    font-weight: 600;
}

.settings-tab-btn.active i {
    color: var(--primary-light);
}

.settings-hub-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

.settings-panel {
    display: none;
    padding: 20px 24px;
    flex-direction: column;
    gap: 0;
}

.settings-panel.active {
    display: flex;
}

.sh-section {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.sh-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sh-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.sh-plan-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass-bg-input);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 14px 16px;
    gap: 12px;
    margin-bottom: 12px;
}

.sh-plan-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.sh-plan-sub  { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }

.sh-plan-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

/* ── Sidebar preview mini-rows (linked accounts) ── */
.linked-accounts-sidebar-preview {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 4px;
}

.la-preview-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    padding: 4px 0;
}

.la-preview-label {
    flex: 1;
    color: var(--text);
    font-weight: 500;
}

.la-preview-badge {
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 7px;
}

.la-preview-badge--ok   { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.la-preview-badge--warn { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.la-preview-badge--off  { background: var(--glass-bg-strong); color: var(--text-dim); border: 1px solid var(--border-medium); }

/* Linked Accounts — la-* */
.la-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--glass-bg-input);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 13px 14px;
    transition: border-color 0.18s, background 0.18s;
}

.la-card:hover:not(.la-card--coming):not(.la-card--empty) {
    border-color: var(--border-medium);
    background: var(--glass-bg-hover);
}

.la-card--coming { opacity: 0.65; }

.la-card-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.la-card-info { flex: 1; min-width: 0; }
.la-card-name { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }

.la-card-status { font-size: 0.78rem; display: flex; align-items: flex-start; gap: 5px; flex-wrap: wrap; word-break: break-word; }
.la-card-status--ok   { color: #10b981; }
.la-card-status--warn { color: #f59e0b; }
.la-card-status--off  { color: var(--text-dim); }

.la-card-meta { font-size: 0.73rem; color: var(--text-dim); margin-top: 3px; }
.la-card-meta code {
    font-family: monospace;
    font-size: 0.72rem;
    background: var(--glass-bg-strong);
    padding: 1px 4px;
    border-radius: 3px;
    color: var(--text);
}

.la-card-action {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
    align-items: flex-end;
}

.la-badge-ok {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.72rem; font-weight: 600; color: #10b981;
    background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3);
    border-radius: 20px; padding: 4px 10px; white-space: nowrap;
}

.la-badge-soon {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.7rem; font-weight: 600; color: var(--text-dim);
    background: var(--glass-bg-strong); border: 1px solid var(--border-medium);
    border-radius: 20px; padding: 4px 10px; white-space: nowrap;
}

.la-badge-locked {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.7rem; font-weight: 600; color: #f59e0b;
    background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3);
    border-radius: 20px; padding: 4px 10px; white-space: nowrap;
}

/* Linked-accounts quick dropdown (on Live Holdings header) */
.linked-accts-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 230px;
    background: var(--surface-3);
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    z-index: 200;
    overflow: hidden;
    animation: wl-menu-in 0.12s ease;
}

.linked-accts-header {
    padding: 8px 12px 7px;
    font-size: 0.65rem; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border-medium);
}

.linked-accts-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 12px; gap: 10px;
    border-bottom: 1px solid var(--border-medium);
}
.linked-accts-row:last-of-type { border-bottom: none; }
.linked-accts-name { font-size: 0.82rem; color: var(--text); }
.linked-accts-footer { padding: 8px 10px; border-top: 1px solid var(--border-medium); }

.linked-accts-add-btn {
    width: 100%;
    background: rgba(var(--primary-rgb), 0.08);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    color: var(--primary-light);
    border-radius: 6px; padding: 7px 10px;
    font-size: 0.78rem; font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-align: center;
}
.linked-accts-add-btn:hover {
    background: rgba(var(--primary-rgb), 0.15);
    border-color: rgba(var(--primary-rgb), 0.4);
}

@media (max-width: 640px) {
    #acctSettingsModal .settings-hub-card {
        width: 95%;
        max-width: 26rem;
        height: calc(100vh - 2rem);
        height: calc(100dvh - 2rem);
        max-height: calc(100vh - 2rem);
        max-height: calc(100dvh - 2rem);
        border-radius: 1rem;
        margin: 0;
    }
    .settings-hub-body { flex-direction: column; }
    /* Tab bar: horizontal scrollable row */
    .settings-hub-nav {
        width: 100%; flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 0; overflow-x: auto;
        gap: 0; flex-shrink: 0;
        background: var(--glass-bg);
        -webkit-overflow-scrolling: touch;
    }
    .settings-tab-btn {
        flex: 1;
        flex-direction: column; align-items: center; justify-content: center;
        gap: 2px; padding: 0.5rem 0.25rem;
        font-size: 0.55rem; white-space: nowrap;
        border-radius: 0;
        border-bottom: 2px solid transparent;
        text-align: center; overflow: hidden; text-overflow: ellipsis;
        min-width: 0;
    }
    .settings-tab-btn i { font-size: 0.85rem; width: auto; flex-shrink: 0; }
    .settings-tab-btn.active {
        background: transparent;
        border-bottom-color: var(--primary-light, #818cf8);
        color: var(--text);
    }
    .settings-tab-btn:hover { background: var(--glass-bg-hover); }
    .settings-panel { padding: 0.75rem; }
    .sh-section { padding-bottom: 0.75rem; margin-bottom: 0.75rem; }
    .sh-section-label { font-size: 0.62rem; margin-bottom: 0.5rem; }
    .la-card { flex-wrap: wrap; row-gap: 0.5rem; }
    .la-card-action {
        width: 100%; flex-direction: row;
        align-items: center; justify-content: flex-end;
        margin-top: 0;
    }
}
