:root {
    color-scheme: light;
    --white: #ffffff;
    --bg: #f8f7ff;
    --purple-50: #f5f3ff;
    --purple-100: #ede9fe;
    --purple-200: #ddd6fe;
    --purple-400: #a78bfa;
    --purple-500: #8b5cf6;
    --purple-600: #7c3aed;
    --purple-700: #6d28d9;
    --purple-900: #4c1d95;
    --text: #1e1b4b;
    --text-muted: #6b7280;
    --glass: rgba(255, 255, 255, 0.82);
    --glass-border: rgba(139, 92, 246, 0.14);
    --shadow: 0 8px 32px rgba(109, 40, 217, 0.08);
    --shadow-lg: 0 20px 60px rgba(109, 40, 217, 0.12);
    --radius: 20px;
    --sidebar-w: 272px;
    --mobile-nav-h: 72px;
    --mobile-topbar-h: 60px;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --surface-3: #f5f3ff;
    --input-bg: rgba(255, 255, 255, 0.7);
}

html {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

.hidden { display: none !important; }

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

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Vazirmatn', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ── Ambient ── */
.ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.45;
    animation: float 14s ease-in-out infinite;
}

.orb-1 {
    width: 480px; height: 480px;
    background: radial-gradient(circle, #c4b5fd 0%, transparent 70%);
    top: -12%; right: -8%;
}

.orb-2 {
    width: 380px; height: 380px;
    background: radial-gradient(circle, #e9d5ff 0%, transparent 70%);
    bottom: 8%; left: 15%;
    animation-delay: -5s;
}

.orb-3 {
    width: 280px; height: 280px;
    background: radial-gradient(circle, #f3e8ff 0%, transparent 70%);
    top: 45%; left: -8%;
    animation-delay: -9s;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(139, 92, 246, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, 0.025) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 85% 65% at 50% 35%, black, transparent);
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(24px, -18px) scale(1.04); }
    66% { transform: translate(-16px, 12px) scale(0.96); }
}

/* ── Layout ── */
.app {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
}

.desktop-only { display: flex; }

/* ── Mobile topbar ── */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    padding: 12px 16px;
    align-items: center;
    justify-content: space-between;
    min-height: var(--mobile-topbar-h);
    direction: ltr; /* اکشن‌ها سمت چپ فیزیکی گوشی */
    overflow: visible;
}
.mobile-topbar .mobile-topbar-brand {
    direction: rtl;
    order: 2; /* راست */
    min-width: 0;
}
.mobile-topbar .mobile-topbar-end,
.mobile-topbar > .panel-topbar-actions,
.mobile-topbar .panel-topbar-actions {
    direction: ltr;
    order: 1; /* چپ فیزیکی: منو سپس حساب */
    margin-inline-start: 0 !important;
    margin-inline-end: 0;
}

.mobile-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--purple-600), #c026d3);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}

.mobile-topbar-brand strong {
    display: block;
    font-size: 0.92rem;
    line-height: 1.2;
}

.mobile-topbar-brand small,
.mobile-topbar-brand #mobile-user-name {
    display: none !important;
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #047857;
    background: #ecfdf5;
    padding: 6px 12px;
    border-radius: 20px;
}

.live-badge[hidden] { display: none !important; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--glass);
    backdrop-filter: blur(24px);
    border-left: 1px solid var(--glass-border);
    padding: 14px 12px;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--purple-600), #c026d3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 22px rgba(124, 58, 237, 0.32);
}

.brand-icon svg { width: 22px; height: 22px; }

.brand-name {
    font-weight: 800;
    font-size: 1.05rem;
    background: linear-gradient(135deg, var(--purple-700), var(--purple-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-left: 2px;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 6px 6px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.35);
}

.nav-group[data-group="home"] {
    padding: 0;
    background: transparent;
    border-color: transparent;
}

.nav-group.tone-violet { background: rgba(124, 58, 237, 0.05); border-color: rgba(124, 58, 237, 0.08); }
.nav-group.tone-teal { background: rgba(13, 148, 136, 0.05); border-color: rgba(13, 148, 136, 0.1); }
.nav-group.tone-emerald { background: rgba(16, 185, 129, 0.06); border-color: rgba(16, 185, 129, 0.1); }
.nav-group.tone-amber { background: rgba(245, 158, 11, 0.07); border-color: rgba(217, 119, 6, 0.12); }
.nav-group.tone-sky { background: rgba(14, 165, 233, 0.06); border-color: rgba(14, 165, 233, 0.1); }
.nav-group.tone-rose { background: rgba(244, 63, 94, 0.05); border-color: rgba(244, 63, 94, 0.1); }
.nav-group.tone-slate { background: rgba(71, 85, 105, 0.06); border-color: rgba(71, 85, 105, 0.1); }
.nav-group.tone-indigo { background: rgba(79, 70, 229, 0.05); border-color: rgba(79, 70, 229, 0.08); }

.nav-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px 5px;
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--purple-700);
    letter-spacing: 0.01em;
}

.nav-group.tone-teal .nav-group-label { color: #0f766e; }
.nav-group.tone-emerald .nav-group-label { color: #047857; }
.nav-group.tone-amber .nav-group-label { color: #b45309; }
.nav-group.tone-sky .nav-group-label { color: #0369a1; }
.nav-group.tone-rose .nav-group-label { color: #be123c; }
.nav-group.tone-slate .nav-group-label { color: #334155; }

.nav-group-icon {
    font-size: 0.78rem;
    line-height: 1;
}

.nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.84rem;
    transition: all 0.22s ease;
}

.nav-item:hover:not(.disabled) {
    background: var(--purple-50);
    color: var(--purple-700);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--purple-600), #a855f7);
    color: white;
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.28);
}

.nav-badge, .nav-soon {
    margin-right: auto;
    font-size: 0.6rem;
    padding: 1px 7px;
    border-radius: 20px;
    font-weight: 600;
}

.nav-badge { background: rgba(255, 255, 255, 0.25); }
.nav-soon { background: var(--purple-100); color: var(--purple-600); }
.nav-item:not(.active) .nav-badge { background: var(--purple-100); color: var(--purple-600); }
.nav-item.disabled { opacity: 0.5; pointer-events: none; }

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 0.7rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
    margin-top: 8px;
    flex-shrink: 0;
}

.pulse-dot {
    width: 7px; height: 7px;
    background: var(--purple-500);
    border-radius: 50%;
    animation: pulse 2s ease infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.main {
    flex: 1;
    padding: 28px 36px;
    max-width: calc(100vw - var(--sidebar-w));
    min-width: 0;
}

/* ── Mobile bottom nav ── */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 110;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 24px rgba(109, 40, 217, 0.08);
}

.mob-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-muted);
    padding: 6px 4px;
    border-radius: 14px;
    transition: all 0.2s;
    min-width: 0;
    flex: 1;
    max-width: none;
}

.mob-nav-item.active {
    color: var(--purple-700);
    background: var(--purple-50);
}

.mob-nav-icon { font-size: 1.2rem; line-height: 1; }
.mob-nav-label {
    font-size: 0.64rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mob-nav-item.disabled { opacity: 0.4; pointer-events: none; }

button.mob-nav-item {
    appearance: none;
    border: none;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
}

.mob-boards-layer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 140;
    align-items: flex-end;
    justify-content: center;
}
.mob-boards-layer.is-open { display: flex; }
.mob-boards-layer[hidden] { display: none !important; }
.mob-boards-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
}
.mob-boards-sheet {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    margin: 0 auto;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
}
.mob-boards-handle {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: #e2e8f0;
    margin: 2px auto 10px;
}
.mob-boards-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.mob-boards-head h3 { margin: 0; font-size: 0.95rem; font-weight: 800; }
.mob-boards-close {
    width: 32px; height: 32px; border: none; border-radius: 10px;
    background: #f1f5f9; color: #64748b; font-size: 1.2rem; cursor: pointer;
}
.mob-boards-body { display: flex; flex-direction: column; gap: 8px; }
.mob-boards-link {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: 14px; text-decoration: none; color: inherit;
    background: #f8fafc; border: 1px solid #e2e8f0;
}
.mob-boards-link.is-active {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.12), rgba(124, 58, 237, 0.08));
    border-color: rgba(13, 148, 136, 0.35);
}
.mob-boards-link-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
    background: linear-gradient(145deg, #0d9488, #7c3aed); color: #fff;
}
.mob-boards-link-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mob-boards-link-text strong { font-size: 0.88rem; font-weight: 800; }
.mob-boards-link-text small { font-size: 0.68rem; color: var(--text-muted, #64748b); }
body.mob-boards-open { overflow: hidden; }

/* ── Mobile layout ── */
@media (max-width: 768px) {
    :root {
        --mobile-topbar-h: 48px;
    }

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

    .mobile-topbar {
        display: flex;
        padding: 6px 12px;
        min-height: var(--mobile-topbar-h);
        gap: 8px;
        box-sizing: border-box;
    }

    .mobile-topbar .mobile-logo {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    .mobile-topbar .mobile-topbar-brand {
        gap: 8px;
        min-width: 0;
        flex: 1;
    }

    .mobile-topbar .mobile-topbar-brand strong {
        font-size: 0.84rem;
        line-height: 1.2;
    }

    .mobile-topbar .mobile-topbar-brand small {
        font-size: 0.62rem;
        line-height: 1.2;
    }

    .mobile-topbar .panel-topbar-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
        order: 1;
        margin: 0 !important;
    }

    .mobile-topbar .panel-account-trigger {
        padding: 3px 8px 3px 4px;
        gap: 6px;
        max-width: min(150px, 46vw);
        font-size: 0.72rem;
    }

    .mobile-topbar .panel-account-name {
        font-size: 0.72rem;
        max-width: 8.5rem;
    }

    .mobile-topbar .panel-account-icon {
        width: 26px;
        height: 26px;
    }

    .mobile-topbar .panel-account-icon svg {
        width: 15px;
        height: 15px;
    }

    .mobile-topbar .quick-svc-trigger {
        width: 34px;
        height: 34px;
        border-radius: 11px;
        flex-shrink: 0;
    }

    .mobile-topbar .quick-svc-trigger-icon {
        width: 16px;
        height: 16px;
    }

    .mobile-bottom-nav { display: flex; }

    .app { flex-direction: column; min-height: auto; }

    .main {
        padding: 16px 14px calc(var(--mobile-nav-h) + 16px + env(safe-area-inset-bottom, 0px));
        max-width: 100%;
        min-width: 0;
        width: 100%;
        overflow-x: hidden;
    }

    .orb { opacity: 0.3; }
}

@media (min-width: 769px) {
    .mobile-topbar { display: none !important; }
    .mobile-bottom-nav { display: none !important; }
}

/* ── Auth gate + account header (shared) ── */
.auth-gate {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg); padding: 24px;
}
.auth-gate-card {
    max-width: 420px; width: 100%;
    background: var(--glass); border: 1px solid var(--glass-border);
    border-radius: var(--radius); padding: 32px 28px; text-align: center;
    box-shadow: var(--shadow-lg); backdrop-filter: blur(20px);
}
.auth-gate-icon { font-size: 2.8rem; margin-bottom: 12px; }
.auth-gate-card h2 { font-size: 1.25rem; margin-bottom: 8px; font-weight: 800; }
.auth-gate-card p { color: var(--text-muted); font-size: .88rem; line-height: 1.7; margin-bottom: 16px; }
.auth-gate-divider {
    display: flex; align-items: center; gap: 12px; margin: 18px 0;
    color: var(--text-muted); font-size: .78rem;
}
.auth-gate-divider::before, .auth-gate-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--glass-border);
}
.auth-login-form { text-align: right; }
.auth-login-form .auth-field { margin-bottom: 12px; }
.auth-login-form label {
    display: block; font-size: .78rem; font-weight: 600;
    color: var(--text-muted); margin-bottom: 6px;
}
.auth-login-form input {
    width: 100%; padding: 12px 14px; border-radius: 12px;
    border: 1px solid var(--glass-border); background: rgba(255,255,255,.7);
    font-family: inherit; font-size: .9rem;
}
.auth-login-form input:focus {
    outline: none; border-color: var(--purple-400);
    box-shadow: 0 0 0 3px rgba(139,92,246,.12);
}
.auth-login-btn {
    width: 100%; margin-top: 8px; padding: 13px; border: none; border-radius: 12px;
    font-family: inherit; font-weight: 700; font-size: .92rem; cursor: pointer;
    background: linear-gradient(135deg, var(--purple-600), var(--purple-500));
    color: #fff;
}
.auth-login-btn:disabled { opacity: .6; cursor: not-allowed; }
.auth-login-error { color: #dc2626; font-size: .82rem; margin-top: 10px; min-height: 1.2em; }
.panel-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    direction: ltr; /* چپ‌ترین = منوی سریع */
    flex-shrink: 0;
}
.panel-account-menu {
    position: relative;
    overflow: visible;
    z-index: 120;
}
.panel-account-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: min(220px, 52vw);
    padding: 4px 6px 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,.85);
    color: var(--purple-700);
    font-family: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .12s;
}
.panel-account-trigger:hover {
    background: rgba(139,92,246,.08);
    border-color: rgba(139,92,246,.28);
}
.panel-account-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 9.5rem;
}
.panel-account-name[dir="ltr"] {
    text-align: left;
    unicode-bidi: isolate;
}
.panel-account-name[dir="rtl"] {
    text-align: right;
    unicode-bidi: isolate;
}
.panel-account-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--purple-50, #f5f3ff);
    color: var(--purple-700);
    flex-shrink: 0;
}
.panel-account-icon svg { width: 18px; height: 18px; }
/* منوی حساب — موقعیت نهایی با JS (fixed) تا از لبه صفحه نزند بیرون */
.panel-account-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    direction: rtl;
    width: 240px;
    min-width: 220px;
    max-width: calc(100vw - 24px);
    padding: 8px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: var(--surface, #fff);
    box-shadow: 0 12px 32px rgba(76, 29, 149, .14);
    z-index: 200;
    display: none;
    box-sizing: border-box;
}
.panel-account-dropdown.is-open {
    display: block;
    position: fixed;
    z-index: 10000;
}
.panel-account-dropdown-head {
    padding: 8px 10px 10px;
    border-bottom: 1px solid rgba(139,92,246,.12);
    margin-bottom: 6px;
}
.panel-account-dropdown-name {
    display: block;
    font-size: .9rem;
    font-weight: 800;
    color: var(--text, #1e1b4b);
}
.panel-account-dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text, #1e1b4b);
    text-decoration: none;
    font-family: inherit;
    font-size: .86rem;
    font-weight: 600;
    cursor: pointer;
    text-align: right;
}
.panel-account-dropdown-item:hover {
    background: var(--purple-50, #f5f3ff);
}
.panel-account-dropdown-item.is-danger {
    color: #b91c1c;
}
.panel-account-dropdown-item.is-danger:hover {
    background: #fef2f2;
}

/* Theme toggle in account dropdown */
.panel-theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    margin: 2px 0 4px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text, #1e1b4b);
    font-family: inherit;
    font-size: .86rem;
    font-weight: 600;
    cursor: pointer;
    text-align: right;
    direction: rtl;
    box-sizing: border-box;
}
.panel-theme-toggle:hover { background: var(--purple-50, #f5f3ff); }
.panel-theme-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}
.panel-theme-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--purple-50, #f5f3ff);
    color: var(--purple-700, #6d28d9);
    flex-shrink: 0;
}
.panel-theme-toggle-icon svg { width: 16px; height: 16px; }
.panel-theme-toggle-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; min-width: 0; }
.panel-theme-toggle-text strong { font-size: .86rem; font-weight: 700; }
.panel-theme-toggle-text span,
.panel-theme-toggle-state {
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
}
.panel-theme-switch-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}
.panel-theme-switch {
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: #d4d4d8;
    border: 1px solid rgba(113, 113, 122, 0.25);
    overflow: hidden;
    transition: background .18s ease, border-color .18s ease;
}
.panel-theme-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    transition: transform .18s ease;
}
.panel-theme-switch-input:checked + .panel-theme-switch,
.panel-theme-toggle[data-theme="dark"] .panel-theme-switch {
    background: linear-gradient(135deg, var(--purple-600, #7c3aed), var(--purple-500, #8b5cf6));
    border-color: rgba(124, 58, 237, 0.45);
}
.panel-theme-switch-input:checked + .panel-theme-switch::after,
.panel-theme-toggle[data-theme="dark"] .panel-theme-switch::after {
    transform: translateX(18px);
}

.panel-account-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 12px;
    border: 1px solid var(--glass-border); background: rgba(255,255,255,.65);
    color: var(--purple-700); text-decoration: none; transition: all .15s;
}
.panel-account-btn svg { width: 20px; height: 20px; }
.panel-account-btn:hover {
    background: rgba(139,92,246,.1); border-color: rgba(139,92,246,.3);
}
.mobile-topbar.hidden { display: none !important; }

/* ── Desktop page topbar (account icon slot) ── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
}
.topbar-right h1 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}
.topbar-right p {
    color: var(--text-muted);
    font-size: 0.92rem;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-inline-start: auto;
}
.desktop-only-inline { display: inline-flex; }
.topbar.desktop-only-inline { display: flex; width: 100%; }

@media (max-width: 768px) {
    .topbar.desktop-only-inline,
    .desktop-only-inline { display: none !important; }
}


/* ── Mobile topbar end (menu/account + live tags) ── */
.mobile-topbar-end {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
    direction: ltr; /* چپ: منو/حساب ، راستِ آن‌ها: تگ زنده */
    overflow: visible;
}

.mobile-topbar-end > .panel-topbar-actions {
    order: 0;
    flex-shrink: 0;
}

.mobile-topbar-live {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
    max-width: min(46vw, 180px);
    order: 1;
}

.mobile-topbar-live.is-empty {
    display: none;
}

.panel-live-chip,
.dash-live-timer-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #4c1d95;
    background: linear-gradient(135deg, #ede9fe, #fce7f3);
    border: 1px solid rgba(124, 58, 237, 0.25);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.12);
    flex-shrink: 0;
}

.panel-live-chip.event,
.dash-live-timer-chip.event {
    color: #115e59;
    background: linear-gradient(135deg, #ccfbf1, #d1fae5);
    border-color: rgba(13, 148, 136, 0.3);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.12);
}

.panel-live-chip.hidden,
.dash-live-timer-chip.hidden { display: none !important; }

.panel-live-chip.compact,
.dash-live-timer-chip.compact {
    padding: 4px 8px;
    gap: 5px;
}

.panel-live-dot,
.dash-live-dot,
.live-badge .live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
    animation: panel-live-pulse 1.4s infinite;
    flex-shrink: 0;
}

.panel-live-clock,
.dash-live-clock {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.mobile-topbar-live > .live-badge {
    margin: 0;
    flex-shrink: 0;
}

@keyframes panel-live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
    70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ── Mobile quick services menu ── */
.quick-svc-menu {
    display: none;
    position: relative;
    z-index: 95;
    flex-shrink: 0;
}

.mobile-topbar,
.mobile-topbar-end,
.panel-topbar-actions {
    overflow: visible;
}

.quick-svc-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(124, 58, 237, 0.22);
    border-radius: 14px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(245, 243, 255, 0.9));
    color: var(--purple-700);
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.12);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
    -webkit-tap-highlight-color: transparent;
}

.quick-svc-trigger-glow {
    position: absolute;
    inset: -40%;
    background: conic-gradient(from 120deg, transparent 40%, rgba(168, 85, 247, 0.35), transparent 70%);
    opacity: 0;
    animation: none;
    pointer-events: none;
}

.quick-svc-trigger-icon {
    position: relative;
    z-index: 1;
    display: inline-flex;
    width: 18px;
    height: 18px;
}

.quick-svc-trigger-icon svg { width: 100%; height: 100%; }

.quick-svc-trigger:hover,
.quick-svc-trigger:active {
    transform: translateY(-1px) scale(1.03);
    border-color: rgba(124, 58, 237, 0.4);
    box-shadow: 0 8px 20px rgba(109, 40, 217, 0.18);
}

.quick-svc-menu.is-open .quick-svc-trigger {
    background: linear-gradient(145deg, var(--purple-600), #a855f7);
    color: #fff;
    border-color: transparent;
}

.quick-svc-menu.is-open .quick-svc-trigger-glow {
    opacity: 1;
    animation: quick-svc-spin 2.4s linear infinite;
}

/* لایه تمام‌صفحه روی body — وسط‌چین با flex */
.quick-svc-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    background: rgba(30, 27, 75, 0.4);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    overscroll-behavior: contain;
}

.quick-svc-layer.is-open {
    display: flex !important;
}

.quick-svc-layer[hidden] {
    display: none !important;
    pointer-events: none !important;
}

.quick-svc-panel {
    position: relative;
    width: 92%;
    max-width: 400px;
    max-height: 82%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    padding: 12px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    background: #fff;
    box-shadow: 0 18px 50px rgba(76, 29, 149, 0.28);
    direction: rtl;
    flex: 0 1 auto;
}

.quick-svc-panel-shine {
    position: absolute;
    top: -40px;
    inset-inline-end: -30px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.22), transparent 68%);
    pointer-events: none;
}

.quick-svc-panel-head {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding: 2px 2px 8px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.12);
}

.quick-svc-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quick-svc-panel-spark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: linear-gradient(145deg, #7c3aed, #db2777);
    color: #fff;
    font-size: .9rem;
    box-shadow: 0 8px 18px rgba(124, 58, 237, 0.28);
    flex-shrink: 0;
}

.quick-svc-panel-title strong {
    display: block;
    font-size: .92rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text);
}

.quick-svc-panel-title small {
    display: block;
    font-size: .68rem;
    color: var(--text-muted);
    font-weight: 500;
}

.quick-svc-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.08);
    color: var(--purple-700);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.quick-svc-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    min-height: 0;
    max-height: min(68vh, 560px);
    padding: 2px 2px 4px;
    scrollbar-width: thin;
}

.quick-svc-group {
    padding: 8px;
    border-radius: 16px;
    border: 1px solid rgba(139, 92, 246, 0.08);
    background: rgba(255, 255, 255, 0.55);
}

.quick-svc-group.tone-violet { background: rgba(124, 58, 237, 0.06); border-color: rgba(124, 58, 237, 0.12); }
.quick-svc-group.tone-teal { background: rgba(13, 148, 136, 0.06); border-color: rgba(13, 148, 136, 0.12); }
.quick-svc-group.tone-emerald { background: rgba(16, 185, 129, 0.07); border-color: rgba(16, 185, 129, 0.14); }
.quick-svc-group.tone-amber { background: rgba(245, 158, 11, 0.08); border-color: rgba(217, 119, 6, 0.14); }
.quick-svc-group.tone-sky { background: rgba(14, 165, 233, 0.07); border-color: rgba(14, 165, 233, 0.14); }
.quick-svc-group.tone-rose { background: rgba(244, 63, 94, 0.06); border-color: rgba(244, 63, 94, 0.12); }
.quick-svc-group.tone-slate { background: rgba(71, 85, 105, 0.07); border-color: rgba(71, 85, 105, 0.12); }
.quick-svc-group.tone-indigo { background: rgba(79, 70, 229, 0.06); border-color: rgba(79, 70, 229, 0.12); }

.quick-svc-group-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    padding: 0 2px;
}

.quick-svc-group-head strong {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text);
}

.quick-svc-group-icon {
    font-size: 0.8rem;
    line-height: 1;
}

.quick-svc-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.quick-svc-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 58px;
    padding: 8px 4px 6px;
    border-radius: 16px;
    text-decoration: none;
    color: var(--text);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(139, 92, 246, 0.08);
    box-shadow: 0 4px 12px rgba(76, 29, 149, 0.04);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    animation: quick-svc-tile-in .36s ease both;
    animation-delay: calc(var(--q-i, 0) * 28ms);
}

.quick-svc-tile:active {
    transform: scale(0.96);
}

.quick-svc-tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1;
    color: #fff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.quick-svc-tile-label {
    font-size: .62rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.25;
    max-width: 100%;
}

.quick-svc-badge {
    position: absolute;
    top: 6px;
    inset-inline-start: 6px;
    font-size: .55rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 999px;
    background: #fef3c7;
    color: #b45309;
}

.quick-svc-tile.is-active {
    border-color: rgba(124, 58, 237, 0.35);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.12), 0 8px 18px rgba(109, 40, 217, 0.1);
}

.quick-svc-tile.tone-indigo .quick-svc-tile-icon { background: linear-gradient(145deg, #4f46e5, #7c3aed); }
.quick-svc-tile.tone-violet .quick-svc-tile-icon { background: linear-gradient(145deg, #7c3aed, #a855f7); }
.quick-svc-tile.tone-teal .quick-svc-tile-icon { background: linear-gradient(145deg, #0d9488, #06b6d4); }
.quick-svc-tile.tone-sky .quick-svc-tile-icon { background: linear-gradient(145deg, #0369a1, #0ea5e9); }
.quick-svc-tile.tone-amber .quick-svc-tile-icon { background: linear-gradient(145deg, #d97706, #f59e0b); }
.quick-svc-tile.tone-emerald .quick-svc-tile-icon { background: linear-gradient(145deg, #047857, #10b981); }
.quick-svc-tile.tone-pink .quick-svc-tile-icon { background: linear-gradient(145deg, #be185d, #ec4899); }
.quick-svc-tile.tone-rose .quick-svc-tile-icon { background: linear-gradient(145deg, #e11d48, #fb7185); }
.quick-svc-tile.tone-slate .quick-svc-tile-icon { background: linear-gradient(145deg, #0f172a, #0e7490); }

@keyframes quick-svc-pop {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes quick-svc-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes quick-svc-tile-in {
    from { opacity: 0; transform: translateY(8px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes quick-svc-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .quick-svc-menu {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        align-items: center;
    }

    .quick-svc-trigger {
        display: inline-flex !important;
        visibility: visible !important;
    }

    body.quick-svc-open {
        overflow: hidden;
        touch-action: none;
    }
}

@media (max-height: 700px) {
    .quick-svc-tile { min-height: 56px; padding: 6px 3px 4px; }
    .quick-svc-tile-icon { width: 26px; height: 26px; font-size: .88rem; border-radius: 8px; }
    .quick-svc-tile-label { font-size: .58rem; }
    .quick-svc-panel { padding: 10px; max-height: 88%; }
    .quick-svc-panel-head { margin-bottom: 6px; padding-bottom: 6px; }
}

@media (min-width: 769px) {
    .quick-svc-menu { display: none !important; }
    .quick-svc-layer { display: none !important; }
}

