/* Local Persian & Monospace Fonts from WP-Hub */
@font-face {
    font-family: 'Vazirmatn';
    src: url('/static/fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('/static/fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('/static/fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('/static/fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('/static/fonts/JetBrainsMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('/static/fonts/JetBrainsMono-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ═══════════════════ WP-Hub Official Tokens ═══════════════════ */
:root {
    --bg: #090b0e;
    --surface: #11151a;
    --surface-2: #171c21;
    --surface-3: #20272d;
    --line: #293139;
    --line-strong: #38434e;
    --text: #edf1f2;
    --muted: #8b969d;
    --faint: #66727a;
    --white: #f7f9fa;
    --accent: #7ba38d;
    --accent-2: #8fa8b5;
    --glow: rgba(123, 163, 141, 0.16);
    --grad: linear-gradient(135deg, #7ba38d, #8fa8b5);
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    --btn-primary-bg: #edf1f2;
    --btn-primary-text: #090b0e;
    --btn-primary-hover: #ffffff;
    --card-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);

    /* Clean, human-engineered border-radius system */
    --radius-card: 12px;
    --radius-inner: 10px;
    --radius-control: 8px;
    --radius-badge: 5px;
    --radius-modal: 14px;

    /* Backwards compatibility aliases */
    --bg-page: var(--bg);
    --surface-card: var(--surface);
    --surface-alt: var(--surface-2);
    --surface-input: var(--surface-2);
    --surface-hover: var(--surface-3);
    --border-subtle: var(--line);
    --border-strong: var(--line-strong);
    --text-main: var(--text);
    --text-muted: var(--muted);
    --accent-glow: var(--glow);
}

:root[data-theme='light'], [data-theme='light'], html[data-theme='light'] {
    --bg: #f5f2eb;
    --surface: #ffffff;
    --surface-2: #ede7dc;
    --surface-3: #ded6c7;
    --line: #d6ccbe;
    --line-strong: #a89d8c;
    --text: #191715;
    --muted: #4e4841;
    --faint: #6e665d;
    --white: #191715;
    --accent: #15803d;
    --accent-2: #38332d;
    --glow: rgba(21, 128, 61, 0.14);
    --grad: linear-gradient(135deg, #15803d, #38332d);
    --shadow: 0 16px 40px -10px rgba(35, 30, 25, 0.10);
    --btn-primary-bg: #1c1917;
    --btn-primary-text: #ffffff;
    --btn-primary-hover: #2e2924;
    --card-shadow: 0 1px 3px rgba(35, 30, 25, 0.05), 0 8px 24px -4px rgba(35, 30, 25, 0.07), 0 0 0 1px rgba(35, 30, 25, 0.04);

    /* Backwards compatibility aliases */
    --bg-page: var(--bg);
    --surface-card: var(--surface);
    --surface-alt: var(--surface-2);
    --surface-input: #ffffff;
    --surface-hover: var(--surface-3);
    --border-subtle: var(--line);
    --border-strong: var(--line-strong);
    --text-main: var(--text);
    --text-muted: var(--muted);
    --accent-glow: var(--glow);
}

/* ═══════════════════ Base & Typography ═══════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: clip;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: "ss01" 1;
    font-variant-numeric: tabular-nums;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Universal Typography Rules & Native Control Font Inheritance */
*, button, input, select, textarea, optgroup {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Ensure Persian digits (Farsi Digits via OpenType ss01) on all Persian/RTL content */
[dir="rtl"], [dir="rtl"] *, .font-fa, .persian-num {
    font-feature-settings: "ss01" 1;
}

/* Normalize font weights - prevent browser artificial stroke bloating (faux-bold) on Persian script */
.font-black, .font-extrabold {
    font-weight: 700 !important;
}
.font-bold {
    font-weight: 700 !important;
}
.font-semibold {
    font-weight: 600 !important;
}
.font-medium {
    font-weight: 500 !important;
}
.font-normal {
    font-weight: 400 !important;
}

/* Monospace for code, hashes, tokens, technical keys, and LTR data.
   Falls back to Vazirmatn for Persian characters that appear inside mono contexts. */
.mono, .font-mono, input.font-mono, code, pre, kbd, samp {
    font-family: 'JetBrains Mono', 'Vazirmatn', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-feature-settings: "tnum" 1, "zero" 1;
}

/* Reset to Latin digits and English typography for LTR elements, domains, URLs, code, emails, passwords */
[dir="ltr"], [dir="ltr"] *, .font-en, .en-num, input[type="email"], input[type="url"], input[type="password"] {
    font-feature-settings: normal;
}

/* Explicit utility classes for number display */
.num-fa {
    font-family: 'Vazirmatn', sans-serif !important;
    font-feature-settings: "ss01" 1 !important;
}
.num-en {
    font-family: 'JetBrains Mono', monospace !important;
    font-feature-settings: normal !important;
}

/* Headings hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
}
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] p, [dir="rtl"] span, [dir="rtl"] a, [dir="rtl"] button, [dir="rtl"] label, [dir="rtl"] div {
    letter-spacing: normal !important;
}

/* ═══════════════════ Unified Element Border Radiuses ═══════════════════ */
/* Eliminate bloated AI-generated bubble corners across the site */
.rounded-3xl {
    border-radius: var(--radius-modal) !important; /* 14px */
}
.rounded-2xl {
    border-radius: var(--radius-card) !important; /* 12px */
}
.rounded-xl {
    border-radius: var(--radius-inner) !important; /* 10px */
}
.rounded-lg {
    border-radius: var(--radius-control) !important; /* 8px */
}
.rounded-md {
    border-radius: 6px !important;
}

/* Turn puffy pill badges into sleek, modern tags */
.badge-pill {
    border-radius: var(--radius-badge) !important;
}

/* WP-Hub Ambient Glow */
body::before, body::after {
    content: '';
    position: fixed;
    z-index: -1;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}
body::before {
    width: 560px;
    height: 560px;
    top: -200px;
    right: -160px;
    background: radial-gradient(circle, rgba(123, 163, 141, 0.14), transparent 70%);
}
body::after {
    width: 480px;
    height: 480px;
    bottom: -220px;
    left: -160px;
    background: radial-gradient(circle, rgba(143, 168, 181, 0.12), transparent 70%);
}

html[data-theme='light'] body::before {
    background: radial-gradient(circle, rgba(21, 128, 61, 0.08), transparent 70%);
}
html[data-theme='light'] body::after {
    background: radial-gradient(circle, rgba(217, 119, 6, 0.05), transparent 70%);
}

/* Monospace Helpers */
.mono, .font-mono, [dir="ltr"].font-mono, input.font-mono {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

/* ═══════════════════ Header Styling ═══════════════════ */
.chrome-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 64px;
    width: 100%;
    display: flex;
    align-items: center;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
    backdrop-filter: blur(16px) saturate(1.5);
    border-bottom: 1px solid var(--line);
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.chrome-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    transition: opacity 0.2s ease;
}
.chrome-brand-link:hover {
    opacity: 0.85;
}

.chrome-logo {
    display: grid;
    place-items: center;
}
.chrome-logo img {
    height: 28px;
    width: auto;
    object-fit: contain;
}
.chrome-logo-dark, .chrome-logo-white {
    max-height: 48px;
    width: auto;
    object-fit: contain;
}
.chrome-logo-dark { display: none; }
.chrome-logo-white { display: block; }

html[data-theme='light'] .chrome-logo-dark { display: block; }
html[data-theme='light'] .chrome-logo-white { display: none; }

.hidden {
    display: none !important;
}

/* WP-Hub Official Theme Button */
.chrome-theme-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface-2);
    color: var(--muted);
    transition: all 0.2s ease;
    cursor: pointer;
}
.chrome-theme-btn:hover {
    background: var(--surface-3);
    border-color: var(--muted);
    color: var(--text);
}
.chrome-theme-btn:active {
    transform: scale(0.92);
}
.chrome-theme-btn svg {
    width: 18px;
    height: 18px;
}

html[data-theme='light'] .chrome-theme-btn {
    background-color: #ffffff;
    border: 1.5px solid #d6ccbe;
    color: #191715;
    box-shadow: 0 1px 2px rgba(35, 30, 25, 0.04);
}
html[data-theme='light'] .chrome-theme-btn:hover {
    background-color: #ede7dc;
    border-color: #a89d8c;
    color: #191715;
}

/* ═══════════════════ Cards & Surfaces ═══════════════════ */
.theme-card {
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    color: var(--text);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

html[data-theme='light'] .theme-card {
    background-color: #ffffff;
    border: 1px solid #d6ccbe;
    box-shadow: 0 1px 3px rgba(35, 30, 25, 0.05), 0 4px 12px -2px rgba(35, 30, 25, 0.05);
}
html[data-theme='light'] .theme-card:hover {
    border-color: #b5a998;
}

/* ═══════════════════ High-Contrast Inputs & Forms ═══════════════════ */
.theme-input {
    height: 42px;
    background-color: var(--surface-2);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-control);
    color: var(--text);
    padding: 0 13px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.theme-input::placeholder {
    color: var(--faint);
}
.theme-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--glow);
}

/* Light Mode Specific Razor-Sharp High Contrast */
:root[data-theme='light'] .theme-input,
html[data-theme='light'] .theme-input,
[data-theme='light'] .theme-input {
    background-color: #ffffff !important;
    border: 1.5px solid #c2b7a7 !important; /* solid warm stone border, crisp and clearly demarcated */
    color: #191715 !important;
    box-shadow: inset 0 1px 2px rgba(25, 23, 21, 0.04), 0 1px 2px rgba(25, 23, 21, 0.02);
}
:root[data-theme='light'] .theme-input::placeholder,
html[data-theme='light'] .theme-input::placeholder,
[data-theme='light'] .theme-input::placeholder {
    color: #6e665d !important; /* warm, clearly legible placeholder */
    opacity: 0.95;
    font-weight: 500;
}
:root[data-theme='light'] .theme-input:focus,
html[data-theme='light'] .theme-input:focus,
[data-theme='light'] .theme-input:focus {
    border-color: #15803d !important;
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.20) !important;
    background-color: #ffffff !important;
}

/* ═══════════════════ Buttons ═══════════════════ */
.theme-btn-primary {
    height: 42px;
    background-color: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.theme-btn-primary:hover {
    background-color: var(--btn-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.theme-btn-primary:active {
    transform: translateY(0);
}
.theme-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.theme-btn-secondary {
    height: 42px;
    background-color: var(--surface-2);
    color: var(--text);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-control);
    font-size: 13px;
    font-weight: 600;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.theme-btn-secondary:hover {
    background-color: var(--surface-3);
    border-color: var(--line-strong);
    color: var(--text);
}
.theme-btn-secondary:active {
    transform: scale(0.98);
}
.theme-btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Light Mode Secondary Button High Contrast */
:root[data-theme='light'] .theme-btn-secondary,
html[data-theme='light'] .theme-btn-secondary {
    background-color: #ffffff !important;
    border: 1.5px solid #d6ccbe !important;
    color: #191715 !important;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(35, 30, 25, 0.04);
}
:root[data-theme='light'] .theme-btn-secondary:hover,
html[data-theme='light'] .theme-btn-secondary:hover {
    background-color: #ede7dc !important;
    border-color: #a89d8c !important;
    color: #191715 !important;
}

/* ═══════════════════ Creative Auth Method Switcher ═══════════════════ */
.auth-method-card {
    border: 1.5px solid var(--line);
    background-color: var(--surface-2);
    border-radius: var(--radius-control);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    user-select: none;
}
.auth-method-card:hover {
    border-color: var(--line-strong);
    background-color: var(--surface-3);
}
.auth-method-card.active {
    border-color: var(--accent) !important;
    background-color: color-mix(in srgb, var(--accent) 12%, var(--surface-2)) !important;
    box-shadow: 0 4px 14px -3px var(--glow);
}

/* Custom Radio inside Method Card */
.method-radio {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid var(--line-strong);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.auth-method-card.active .method-radio {
    border-color: var(--accent);
    background-color: var(--accent);
}
.method-radio::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #ffffff;
    opacity: 0;
    transform: scale(0.4);
    transition: all 0.15s ease;
}
.auth-method-card.active .method-radio::after {
    opacity: 1;
    transform: scale(1);
}

/* Light Mode specifics for Auth Method Cards */
:root[data-theme='light'] .auth-method-card,
html[data-theme='light'] .auth-method-card {
    background-color: #ffffff !important;
    border: 1.5px solid #d6ccbe !important;
    box-shadow: 0 1px 3px rgba(35, 30, 25, 0.04);
}
:root[data-theme='light'] .auth-method-card:hover,
html[data-theme='light'] .auth-method-card:hover {
    border-color: #a89d8c !important;
    background-color: #faf8f5 !important;
}
:root[data-theme='light'] .auth-method-card.active,
html[data-theme='light'] .auth-method-card.active {
    border-color: #15803d !important;
    border-width: 1.5px !important;
    background-color: #f0fdf4 !important;
    box-shadow: 0 3px 12px rgba(21, 128, 61, 0.12) !important;
}
:root[data-theme='light'] .auth-method-card .method-radio {
    border-color: #a89d8c;
}
:root[data-theme='light'] .auth-method-card.active .method-radio {
    border-color: #15803d;
    background-color: #15803d;
}

/* ═══════════════════ Segmented Tabs Control (For Admin/Other views) ═══════════════════ */
.tab-segmented-wrap {
    background-color: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    padding: 4px;
    display: flex;
    gap: 4px;
}

html[data-theme='light'] .tab-segmented-wrap {
    background-color: #ede7dc;
    border-color: #d6ccbe;
}

.tab-btn {
    flex: 1;
    height: 36px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    cursor: pointer;
    user-select: none;
}
.tab-btn:hover {
    color: var(--text);
}
.tab-btn.active {
    background-color: var(--surface) !important;
    color: var(--text) !important;
    font-weight: 600 !important;
    border-color: var(--line) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

html[data-theme='light'] .tab-btn {
    color: #4e4841;
}
html[data-theme='light'] .tab-btn:hover {
    color: #191715;
}
html[data-theme='light'] .tab-btn.active {
    background-color: #ffffff !important;
    color: #191715 !important;
    border-color: #d6ccbe !important;
    box-shadow: 0 2px 6px rgba(35, 30, 25, 0.08) !important;
}

/* ═══════════════════ Spinner ═══════════════════ */
.spinner {
    border: 2px solid rgba(128, 128, 128, 0.25);
    border-radius: 50%;
    border-top: 2px solid currentColor;
    width: 16px;
    height: 16px;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}
::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 6px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--faint);
}
::-webkit-scrollbar-track {
    background: transparent;
}

/* ═══════════════════ Dashboard Right Sidebar & Clean Layout ═══════════════════ */
.dash-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: calc(100vh - 64px);
    position: relative;
}
@media (min-width: 768px) {
    .dash-layout {
        flex-direction: row;
    }
}

/* Mobile backdrop overlay for off-canvas drawer */
.dash-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.65);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 85;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.dash-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}
@media (min-width: 768px) {
    .dash-backdrop {
        display: none !important;
    }
}

/* Right Sidebar Navigation */
.dash-sidebar-full {
    background-color: var(--surface);
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease;
}

/* Mobile Sidebar: Elegant Off-canvas Drawer */
@media (max-width: 767.98px) {
    .dash-sidebar-full {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 300px;
        max-width: 86vw;
        height: 100vh;
        height: 100dvh;
        z-index: 90;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: -10px 0 36px rgba(0, 0, 0, 0.5);
        transform: translateX(105%);
        padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
        gap: 1.25rem;
    }
    .dash-sidebar-full.mobile-open {
        transform: translateX(0);
    }
}

/* Desktop Sidebar: Permanent Sticky Sidebar */
@media (min-width: 768px) {
    .dash-sidebar-full {
        width: 18.5rem; /* ~296px */
        min-height: calc(100vh - 64px);
        position: sticky;
        top: 64px;
        align-self: flex-start;
        height: calc(100vh - 64px);
        overflow-y: auto;
        z-index: 20;
        padding: 1.5rem 1.25rem;
        gap: 1.5rem;
        transform: none !important;
        box-shadow: none !important;
    }
}
@media (min-width: 1024px) {
    .dash-sidebar-full {
        width: 20.5rem; /* ~328px */
        padding: 1.75rem 1.5rem;
    }
}

/* Main content fills the remaining space on the left */
.dash-content-full {
    flex: 1;
    min-width: 0;
    padding: 1rem 0.875rem;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    background-color: var(--bg);
    overflow-x: hidden;
}
@media (min-width: 640px) {
    .dash-content-full {
        padding: 1.5rem 1.25rem;
    }
}
@media (min-width: 768px) {
    .dash-content-full {
        padding: 2rem 2.5rem;
        padding-bottom: 2rem;
    }
}
@media (min-width: 1280px) {
    .dash-content-full {
        padding: 2.5rem 3.5rem;
    }
}

.dash-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-control);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    width: 100%;
    text-align: right;
    transition: all 0.15s ease;
    cursor: pointer;
}
.dash-nav-btn:hover {
    color: var(--text);
    background-color: var(--surface-2);
}
.dash-nav-btn.active {
    color: var(--text) !important;
    background-color: var(--surface-2) !important;
    border-color: var(--line) !important;
    font-weight: 600 !important;
}
.dash-nav-btn.active svg {
    color: var(--accent) !important;
}

/* Light mode adjustments for dashboard */
:root[data-theme='light'] .dash-sidebar-full,
html[data-theme='light'] .dash-sidebar-full {
    background-color: #fcfbf8;
    border-left: 1.5px solid #d6ccbe;
    box-shadow: -2px 0 12px rgba(35, 30, 25, 0.03);
}
:root[data-theme='light'] .dash-nav-btn {
    color: #4e4841;
}
:root[data-theme='light'] .dash-nav-btn:hover {
    background-color: #ede7dc;
    color: #191715;
}
:root[data-theme='light'] .dash-nav-btn.active,
html[data-theme='light'] .dash-nav-btn.active {
    background-color: #ede7dc !important;
    border-color: #d6ccbe !important;
    color: #191715 !important;
    font-weight: 700 !important;
}
:root[data-theme='light'] .dash-nav-btn.active svg,
html[data-theme='light'] .dash-nav-btn.active svg {
    color: #15803d !important;
}

.dash-sidebar-panel {
    background-color: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
html[data-theme='light'] .dash-sidebar-panel {
    background-color: #ffffff;
    border: 1.5px solid #d6ccbe;
    box-shadow: 0 1px 4px rgba(35, 30, 25, 0.04);
}


/* ═══════════════════ Tables & Badges ═══════════════════ */
.theme-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-inner);
    background-color: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.theme-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    text-align: right;
    font-size: 12.5px;
    white-space: nowrap;
}

.theme-table th {
    background-color: var(--surface-2);
    color: var(--muted);
    font-weight: 600;
    font-size: 11.5px;
    padding: 11px 16px;
    border-bottom: 1.5px solid var(--line);
    letter-spacing: 0.02em;
    user-select: none;
}

.theme-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    vertical-align: middle;
    transition: background-color 0.15s ease;
}

.theme-table tbody tr:last-child td {
    border-bottom: none;
}

.theme-table tbody tr:hover td {
    background-color: var(--surface-2);
}

/* Light mode table high contrast */
html[data-theme='light'] .theme-table-wrap {
    background-color: #ffffff !important;
    border: 1.5px solid #d6ccbe !important;
    box-shadow: 0 1px 4px rgba(35, 30, 25, 0.04);
}
html[data-theme='light'] .theme-table th {
    background-color: #ede7dc !important;
    color: #38332d !important;
    font-weight: 700 !important;
    border-bottom: 1.5px solid #d6ccbe !important;
}
html[data-theme='light'] .theme-table td {
    border-bottom: 1px solid #ebe4d8 !important;
    color: #191715 !important;
}
html[data-theme='light'] .theme-table tbody tr:hover td {
    background-color: #f7f4ec !important;
}

/* ═══════════════════ Badges & Pills ═══════════════════ */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2.5px 8px;
    border-radius: var(--radius-badge);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.01em;
}
.badge-pill.success {
    background-color: rgba(16, 185, 129, 0.14);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.28);
}
.badge-pill.danger {
    background-color: rgba(244, 63, 94, 0.14);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.28);
}
.badge-pill.neutral {
    background-color: var(--surface-3);
    color: var(--muted);
    border: 1px solid var(--line);
}

html[data-theme='light'] .badge-pill.success {
    background-color: #dcfce7 !important;
    color: #14532d !important;
    border: 1px solid #86efac !important;
}
html[data-theme='light'] .badge-pill.danger {
    background-color: #ffe4e6 !important;
    color: #9f1239 !important;
    border: 1px solid #fecdd3 !important;
}
html[data-theme='light'] .badge-pill.warning {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fde68a !important;
}
html[data-theme='light'] .badge-pill.info {
    background-color: #e0f2fe !important;
    color: #075985 !important;
    border: 1px solid #bae6fd !important;
}
html[data-theme='light'] .badge-pill.neutral {
    background-color: #ede7dc !important;
    color: #38332d !important;
    border: 1px solid #d6ccbe !important;
}

/* ═══════════════════ Header User Dropdown & Account Modal ═══════════════════ */
.header-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-control);
    background-color: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.15s ease;
    cursor: pointer;
}
.header-user-btn:hover {
    border-color: var(--accent);
    background-color: var(--surface-3);
}

.header-dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 290px;
    max-width: calc(100vw - 20px);
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-inner);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 50;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
@media (max-width: 480px) {
    .header-dropdown-panel {
        left: -4px;
        width: 280px;
    }
}
html[data-theme='light'] .header-dropdown-panel {
    background-color: #ffffff;
    border-color: #d6ccbe;
    box-shadow: 0 12px 32px rgba(35, 30, 25, 0.12), 0 0 0 1px rgba(35, 30, 25, 0.04);
}

.dropdown-item-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--text);
    background: transparent;
    border: none;
    width: 100%;
    text-align: right;
    transition: background-color 0.15s ease;
    cursor: pointer;
}
.dropdown-item-btn:hover {
    background-color: var(--surface-2);
}
html[data-theme='light'] .dropdown-item-btn:hover {
    background-color: #ede7dc;
    color: #191715;
}

/* Account Modal Backdrop & Card */
.account-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
@media (max-width: 640px) {
    .account-modal-backdrop {
        padding: 10px;
    }
}

.account-modal-card {
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    background-color: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-modal);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) {
    .account-modal-card {
        padding: 18px 14px;
        gap: 14px;
        border-radius: 12px;
        max-height: calc(100dvh - 20px);
    }
}
html[data-theme='light'] .account-modal-card {
    background-color: #ffffff;
    border-color: #d6ccbe;
    box-shadow: 0 24px 60px rgba(35, 30, 25, 0.16), 0 0 0 1px rgba(35, 30, 25, 0.06);
}

/* Policy Selector Cards in Modal */
.policy-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-control);
    border: 1.5px solid var(--line);
    background-color: var(--surface-2);
    cursor: pointer;
    transition: all 0.15s ease;
}
.policy-card:hover {
    border-color: var(--line-strong);
}
.policy-card.active {
    border-color: var(--accent) !important;
    background-color: rgba(123, 163, 141, 0.08) !important;
}
html[data-theme='light'] .policy-card {
    background-color: #faf8f5;
    border: 1.5px solid #d6ccbe;
    color: #191715;
}
html[data-theme='light'] .policy-card:hover {
    background-color: #ede7dc;
    border-color: #a89d8c;
}
html[data-theme='light'] .policy-card.active {
    border-color: #15803d !important;
    background-color: #f0fdf4 !important;
    box-shadow: 0 2px 8px rgba(21, 128, 61, 0.12) !important;
}

/* ═══════════════════ Meridian Globe Loading Animation ═══════════════════ */
svg.mer {
    color: #131316;
    --rate: 1;
    --dur: 3.6s;
    --n: 6;
    display: inline-block;
}

html.dark svg.mer,
[data-theme='dark'] svg.mer {
    color: #f5f5f7;
}

svg.mer .mer-limb {
    stroke: currentColor;
    stroke-width: 1.1;
    opacity: .55;
}

svg.mer .mer-lat {
    stroke: currentColor;
    stroke-width: 1;
    stroke-linecap: round;
    opacity: .22;
}

svg.mer .mer-line {
    stroke: currentColor;
    stroke-width: 1;
    opacity: .5;
    animation: mer-turn calc(var(--dur) * var(--rate, 1)) infinite;
    animation-delay: calc(var(--i) * var(--dur) * var(--rate, 1) / var(--n) * -1);
}

svg.mer .mer-glint {
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-dasharray: 14 86;
    transform-box: view-box;
    transform-origin: center;
    opacity: .9;
    animation: mer-glint calc(var(--dur) * var(--rate, 1) * 1.5) linear infinite;
}

@keyframes mer-turn {
    0%   { rx: 29px; animation-timing-function: ease-in; }
    50%  { rx: 0px;  animation-timing-function: ease-out; }
    100% { rx: 29px; }
}

@keyframes mer-glint {
    0%   { transform: rotate(-30deg); opacity: 0; }
    20%  { opacity: .85; }
    70%  { opacity: .85; }
    100% { transform: rotate(210deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    svg.mer .mer-line  { animation: none; rx: var(--rx); }
    svg.mer .mer-glint { animation: none; opacity: 0; }
}

/* ═══════════════════ Pricing Plan Typography ═══════════════════ */
.plan-price-val {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-weight: 700 !important;
    font-feature-settings: "tnum" 1;
    letter-spacing: normal;
    line-height: 1.1;
    display: inline-block;
    direction: ltr;
    unicode-bidi: isolate;
}

/* ═══════════════════ Light Mode Elevation & Contrast Enhancements ═══════════════════ */
html[data-theme='light'] .shadow-sm {
    box-shadow: 0 1px 3px rgba(35, 30, 25, 0.05), 0 4px 12px -2px rgba(35, 30, 25, 0.05) !important;
}
html[data-theme='light'] .shadow-md {
    box-shadow: 0 4px 14px -2px rgba(35, 30, 25, 0.07), 0 2px 6px -1px rgba(35, 30, 25, 0.04) !important;
}
html[data-theme='light'] .shadow-lg,
html[data-theme='light'] .shadow-xl {
    box-shadow: 0 12px 36px -4px rgba(35, 30, 25, 0.10), 0 4px 12px -2px rgba(35, 30, 25, 0.05) !important;
}

/* ═══════════════════ Modern Mobile Bottom Navigation Bar ═══════════════════ */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(1.7);
    backdrop-filter: blur(20px) saturate(1.7);
    border-top: 1px solid var(--line);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.22);
    user-select: none;
}
@media (min-width: 768px) {
    .mobile-bottom-nav {
        display: none !important;
    }
}

.mob-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.1s ease;
    padding: 6px 2px 4px;
    text-decoration: none;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.mob-nav-item svg {
    width: 19px;
    height: 19px;
    transition: transform 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}
.mob-nav-item span {
    font-size: 10px;
    font-weight: 500;
    line-height: 1.1;
    white-space: nowrap;
}
.mob-nav-item:active {
    transform: scale(0.92);
}
.mob-nav-item.active {
    color: var(--accent) !important;
}
.mob-nav-item.active svg {
    color: var(--accent) !important;
    transform: scale(1.12);
}
.mob-nav-item.active span {
    font-weight: 700;
}

html[data-theme='light'] .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1.5px solid #d6ccbe;
    box-shadow: 0 -2px 14px rgba(35, 30, 25, 0.08);
}
html[data-theme='light'] .mob-nav-item.active {
    color: #15803d !important;
}
html[data-theme='light'] .mob-nav-item.active svg {
    color: #15803d !important;
}

/* ═══════════════════ Mobile Typography & Touch Polish ═══════════════════ */
@media (max-width: 640px) {
    body {
        font-size: 13.5px;
    }
    .theme-card {
        border-radius: 12px;
    }
    .chrome-header {
        height: 58px;
    }
    .dash-nav-btn {
        padding: 11px 12px;
        font-size: 13px;
    }
}

/* ═══════════════════ Precision Monitoring Charts & Telemetry ═══════════════════ */
.mon-chart-wrap {
    position: relative;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
}

.mon-chart-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.mon-chart-tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 60;
    min-width: 190px;
    max-width: 280px;
    border-radius: 12px;
    padding: 10px 13px;
    font-size: 11.5px;
    line-height: 1.5;
    transition: opacity 0.12s ease, transform 0.12s ease;
    will-change: transform, left, top;
    direction: rtl;
    text-align: right;
    background: rgba(15, 23, 42, 0.95);
    color: #f1f5f9;
    border: 1px solid rgba(51, 65, 85, 0.85);
    box-shadow: 0 20px 45px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

html[data-theme='light'] .mon-chart-tooltip {
    background: rgba(255, 255, 255, 0.97);
    color: #0f172a;
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: 0 18px 40px -8px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.mon-beat-bar {
    transition: transform 0.14s cubic-bezier(0.4, 0, 0.2, 1), filter 0.14s ease;
    transform-origin: center bottom;
    cursor: pointer;
}

.mon-beat-bar:hover {
    transform: scaleY(1.25) scaleX(1.12);
    filter: brightness(1.22);
    z-index: 10;
}

@keyframes monPulseGlow {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.mon-live-beacon {
    animation: monPulseGlow 2.2s infinite cubic-bezier(0.45, 0, 0.55, 1);
}

.mon-chart-crosshair {
    pointer-events: none;
    transition: opacity 0.1s ease;
}

.mon-chart-halo {
    pointer-events: none;
    transition: cx 0.08s ease, cy 0.08s ease, opacity 0.12s ease;
}

.mon-chart-dot {
    pointer-events: none;
    transition: cx 0.08s ease, cy 0.08s ease, opacity 0.12s ease;
}
