/* ============================================================
   Design tokens (light is default; dark overrides below)
   ============================================================ */
:root {
    /* Sidebar */
    --sidebar-bg:        #0b1020;
    --sidebar-bg-grad:   radial-gradient(120% 60% at 0% 0%, #1e1b4b 0%, transparent 55%),
                         radial-gradient(80% 50% at 100% 100%, #1e1b4b 0%, transparent 60%),
                         #0b1020;
    --sidebar-text:      #cbd5e1;
    --sidebar-text-mut:  #64748b;
    --sidebar-text-on:   #ffffff;
    --sidebar-border:    rgba(255, 255, 255, 0.04);
    --sidebar-row-bg:    rgba(255, 255, 255, 0.04);
    --sidebar-row-hover: rgba(255, 255, 255, 0.08);

    /* Accent palette (unchanged across themes) */
    --accent:            #6366f1;
    --accent-2:          #8b5cf6;
    --accent-3:          #ec4899;
    --accent-hover:      #818cf8;
    --accent-soft:       rgba(99, 102, 241, 0.14);
    --accent-soft-2:     rgba(99, 102, 241, 0.06);
    --accent-grad:       linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #ec4899 100%);
    --accent-grad-soft:  linear-gradient(135deg, rgba(99,102,241,0.16), rgba(139,92,246,0.12), rgba(236,72,153,0.16));

    /* Surfaces */
    --bg:                #f4f5fb;
    --bg-grad:           radial-gradient(60% 50% at 0% 0%, rgba(99,102,241,0.08), transparent 60%),
                         radial-gradient(50% 40% at 100% 0%, rgba(236,72,153,0.06), transparent 60%),
                         #f4f5fb;
    --surface:           #ffffff;
    --surface-2:         #f8fafc;
    --surface-glass:     rgba(255, 255, 255, 0.82);
    --surface-glass-bd:  rgba(255, 255, 255, 0.7);
    --border:            #e6e8f0;
    --border-strong:     #cbd5e1;

    /* Text */
    --text:              #0b1020;
    --text-muted:        #64748b;
    --text-faint:        #94a3b8;
    --page-title-grad:   linear-gradient(135deg, #0b1020 0%, #312e81 100%);

    /* Topbar surface */
    --topbar-bg:         rgba(255, 255, 255, 0.72);

    /* Status colors — kept transparent so they read on both themes */
    --success:           #10b981;
    --success-soft:      rgba(16, 185, 129, 0.15);
    --warning:           #f59e0b;
    --warning-soft:      rgba(245, 158, 11, 0.16);
    --danger:            #ef4444;
    --danger-soft:       rgba(239, 68, 68, 0.14);
    --info:              #0ea5e9;
    --info-soft:         rgba(14, 165, 233, 0.14);
    --rose:              #ec4899;
    --rose-soft:         rgba(236, 72, 153, 0.14);

    /* Code/JSON block colors */
    --code-bg:           #0b1020;
    --code-text:         #cbd5e1;
}

/* ============================================================
   Dark theme
   ============================================================ */
html[data-theme="dark"] {
    --sidebar-bg:        #060914;
    --sidebar-bg-grad:   radial-gradient(120% 60% at 0% 0%, #1e1b4b 0%, transparent 55%),
                         radial-gradient(80% 50% at 100% 100%, #1e1b4b 0%, transparent 60%),
                         #060914;
    --sidebar-text:      #cbd5e1;
    --sidebar-text-mut:  #64748b;
    --sidebar-border:    rgba(255, 255, 255, 0.04);
    --sidebar-row-bg:    rgba(255, 255, 255, 0.04);
    --sidebar-row-hover: rgba(255, 255, 255, 0.10);

    --bg:                #0c1126;
    --bg-grad:           radial-gradient(60% 50% at 0% 0%, rgba(99,102,241,0.10), transparent 60%),
                         radial-gradient(50% 40% at 100% 0%, rgba(236,72,153,0.07), transparent 60%),
                         #0c1126;
    --surface:           #161b33;
    --surface-2:         #1e2440;
    --surface-glass:     rgba(20, 25, 50, 0.78);
    --surface-glass-bd:  rgba(255, 255, 255, 0.06);
    --border:            #2a3151;
    --border-strong:     #3d4670;

    --text:              #f1f5f9;
    --text-muted:        #94a3b8;
    --text-faint:        #64748b;
    --page-title-grad:   linear-gradient(135deg, #ffffff 0%, #c7d2fe 100%);

    --topbar-bg:         rgba(11, 16, 32, 0.72);

    --accent-soft:       rgba(99, 102, 241, 0.22);
    --accent-soft-2:     rgba(99, 102, 241, 0.10);
    --success-soft:      rgba(16, 185, 129, 0.20);
    --warning-soft:      rgba(245, 158, 11, 0.22);
    --danger-soft:       rgba(239, 68, 68, 0.20);
    --info-soft:         rgba(14, 165, 233, 0.20);
    --rose-soft:         rgba(236, 72, 153, 0.20);

    --code-bg:           #060914;
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.10); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

html[data-theme="dark"] .input,
html[data-theme="dark"] .select,
html[data-theme="dark"] textarea.input,
html[data-theme="dark"] .topbar .search input {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}
html[data-theme="dark"] .topbar .search input:focus { background: var(--surface); }
html[data-theme="dark"] .topbar .search .kbd { background: var(--surface); color: var(--text-muted); border-color: var(--border); }

/* Settings nav active state is bright; in dark we tone it nicely */
html[data-theme="dark"] .settings-nav a.active { color: #c7d2fe; }
html[data-theme="dark"] .theme-card.light .preview { background: linear-gradient(135deg, #f1f5f9, #fff); }
html[data-theme="dark"] .theme-card.dark .preview { background: linear-gradient(135deg, #0b1020, #1e293b); }
html[data-theme="dark"] .theme-card.selected { background: rgba(99, 102, 241, 0.15); }

/* Map page text on rich gradient panels stays light — no override needed */
/* Pin and floating elements pick up vars via --surface-glass automatically */

    /* Geometry */
    --radius-xs:         6px;
    --radius-sm:         10px;
    --radius-md:         14px;
    --radius-lg:         18px;
    --radius-xl:         24px;

    /* Elevation */
    --shadow-xs:         0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm:         0 2px 6px rgba(15, 23, 42, 0.05);
    --shadow-md:         0 6px 18px rgba(15, 23, 42, 0.06);
    --shadow-lg:         0 16px 40px rgba(15, 23, 42, 0.10);
    --shadow-glow:       0 8px 28px rgba(99, 102, 241, 0.28);

    --sidebar-w:         260px;
    --topbar-h:          68px;
    --ease-out:          cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
::selection { background: rgba(99, 102, 241, 0.25); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.12); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.22); }

/* ============================================================
   App shell
   ============================================================ */
.app {
    display: flex;
    min-height: 100vh;
    background: var(--bg-grad);
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar-bg-grad);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-brand .logo {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--accent-grad);
    background-size: 200% 200%;
    animation: gradient-shift 8s ease infinite;
    display: grid; place-items: center;
    box-shadow: 0 10px 22px rgba(139, 92, 246, 0.42), inset 0 1px 0 rgba(255,255,255,0.2);
    position: relative;
}
.sidebar-brand .logo::after {
    content: '';
    position: absolute; inset: -2px;
    border-radius: 14px;
    background: var(--accent-grad);
    filter: blur(14px);
    opacity: 0.45;
    z-index: -1;
}
.sidebar-brand .logo svg { color: #fff; }
.sidebar-brand .brand-text { line-height: 1.2; }
.sidebar-brand .brand-name {
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    display: block;
}
.sidebar-brand .brand-sub {
    color: var(--sidebar-text-mut);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 500;
}

.sidebar-section-label {
    color: var(--sidebar-text-mut);
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
    padding: 18px 24px 8px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
    position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }
.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.22), rgba(139,92,246,0.14) 60%, rgba(236,72,153,0.08));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -14px; top: 8px; bottom: 8px;
    width: 3px;
    background: var(--accent-grad);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.65);
}
.nav-item.active svg { opacity: 1; color: #c7d2fe; }
.nav-item .badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    color: #e0e7ff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.nav-item.active .badge {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.sidebar-user {
    margin: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s ease;
}
.sidebar-user:hover { background: rgba(255, 255, 255, 0.07); }
.sidebar-user .avatar {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f472b6, #6366f1);
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(244, 114, 182, 0.32);
}
.sidebar-user .who { flex: 1; min-width: 0; line-height: 1.35; }
.sidebar-user .name {
    color: #fff; font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .email {
    color: var(--sidebar-text-mut); font-size: 11px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .menu-btn {
    background: transparent; border: 0;
    color: var(--sidebar-text-mut);
    padding: 6px;
    border-radius: 8px;
    transition: all 0.15s ease;
}
.sidebar-user .menu-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* ============================================================
   Main / topbar
   ============================================================ */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .search {
    flex: 1;
    max-width: 480px;
    position: relative;
}
.topbar .search input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 12px;
    padding: 11px 56px 11px 42px;
    font-size: 14px;
    color: var(--text);
    transition: border 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.topbar .search input::placeholder { color: var(--text-faint); }
.topbar .search input:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.topbar .search svg {
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
}
.topbar .search .kbd {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: #fff;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    padding: 2px 6px;
    border-radius: 6px;
    pointer-events: none;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 40px; height: 40px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    display: grid; place-items: center;
    color: var(--text-muted);
    position: relative;
    transition: all 0.15s var(--ease-out);
}
.icon-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.icon-btn .dot {
    position: absolute; top: 9px; right: 10px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { transition: transform 0.4s var(--ease-out), opacity 0.2s ease; }
html[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
html[data-theme="dark"]  .theme-toggle .icon-moon { display: none; }
.theme-toggle:hover .icon-sun  { transform: rotate(45deg); }
.theme-toggle:hover .icon-moon { transform: rotate(-12deg); }

/* Page wrapper */
.page {
    padding: 28px 28px 40px;
    flex: 1;
    animation: page-fade 0.45s var(--ease-out);
}
.page--flush { padding: 0; }

@keyframes page-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Page header */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
.page-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    background: var(--page-title-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.page-subtitle {
    color: var(--text-muted);
    font-size: 13.5px;
    margin: 4px 0 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    padding: 10px 16px;
    border-radius: 11px;
    font-weight: 600;
    font-size: 13.5px;
    transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--accent-grad);
    background-size: 180% 180%;
    color: #fff;
    box-shadow: var(--shadow-glow);
}
.btn-primary:hover {
    box-shadow: 0 10px 32px rgba(99, 102, 241, 0.45);
    background-position: 100% 100%;
}
.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

/* ============================================================
   Welcome / hero
   ============================================================ */
.welcome {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    background-size: 200% 200%;
    animation: gradient-shift 12s ease infinite;
    border-radius: var(--radius-lg);
    padding: 22px 26px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 22px;
    box-shadow: 0 18px 44px rgba(99, 102, 241, 0.25);
    position: relative;
    overflow: hidden;
}
.welcome::before, .welcome::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(38px);
    opacity: 0.5;
    pointer-events: none;
}
.welcome::before { width: 220px; height: 220px; background: #fbbf24; right: -40px; top: -60px; }
.welcome::after  { width: 160px; height: 160px; background: #06b6d4; left: 30%;    bottom: -90px; }
.welcome .greeting { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.welcome .greeting .wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.4s ease-in-out infinite; }
.welcome .greeting + .sub { font-size: 13.5px; opacity: 0.88; margin-top: 4px; }
.welcome-actions { display: flex; gap: 10px; flex-shrink: 0; }
.welcome-actions .btn {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(6px);
}
.welcome-actions .btn:hover { background: rgba(255, 255, 255, 0.26); }
.welcome-actions .btn.solid { background: #fff; color: var(--accent); border-color: transparent; }
.welcome-actions .btn.solid:hover { background: #fafafa; }

@keyframes wave {
    0%, 60%, 100% { transform: rotate(0); }
    10%, 30% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
    40% { transform: rotate(8deg); }
    50% { transform: rotate(-4deg); }
}
@keyframes gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ============================================================
   Stat cards
   ============================================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent-grad);
    opacity: 0.0;
    transition: opacity 0.25s var(--ease-out);
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: #d1d5e3;
}
.stat-card:hover::before { opacity: 1; }

.stat-card .head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.stat-card .label {
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.stat-card .icon {
    width: 38px; height: 38px;
    border-radius: 11px;
    display: grid; place-items: center;
    position: relative;
}
.stat-card .icon::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: 11px;
    background: currentColor;
    opacity: 0.0;
    transition: opacity 0.25s ease;
}
.icon-indigo  { background: var(--accent-soft);  color: var(--accent); }
.icon-emerald { background: var(--success-soft); color: var(--success); }
.icon-amber   { background: var(--warning-soft); color: var(--warning); }
.icon-sky     { background: var(--info-soft);    color: var(--info); }
.icon-rose    { background: var(--rose-soft);    color: var(--rose); }

.stat-card .value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.1;
    color: var(--text);
}
.stat-card .value .unit {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 4px;
    letter-spacing: 0;
}
.stat-card .delta {
    margin-top: 10px;
    font-size: 11.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
}
.delta.up   { background: var(--success-soft); color: #047857; }
.delta.down { background: var(--danger-soft);  color: #b91c1c; }

/* ============================================================
   Grid + cards
   ============================================================ */
.grid-2 {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 16px;
}
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.25s var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-size: 14.5px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.005em;
}
.card-title-sub {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.card-body { padding: 8px 20px 20px; }
.link-pill {
    font-size: 12px; font-weight: 600;
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft-2);
    transition: background 0.2s ease;
}
.link-pill:hover { background: var(--accent-soft); }

/* Activity list */
.activity { list-style: none; padding: 0; margin: 0; }
.activity li {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    transition: padding-left 0.2s var(--ease-out);
}
.activity li:last-child { border-bottom: 0; }
.activity li:hover { padding-left: 4px; }
.activity .ico {
    width: 38px; height: 38px;
    border-radius: 11px;
    display: grid; place-items: center;
    flex-shrink: 0;
    position: relative;
}
.activity .ico::after {
    content: '';
    position: absolute;
    width: 9px; height: 9px;
    background: var(--success);
    border-radius: 50%;
    bottom: -2px; right: -2px;
    border: 2px solid var(--surface);
    opacity: 0;
}
.activity .ico.new::after { opacity: 1; }
.activity .body { flex: 1; min-width: 0; }
.activity .title-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
}
.activity .title-row strong { font-weight: 600; }
.activity .time {
    color: var(--text-faint);
    font-size: 11.5px;
    white-space: nowrap;
    font-weight: 500;
}
.activity .desc { color: var(--text-muted); font-size: 13px; margin-top: 3px; }

/* Mahalla / ranked list */
.loc-list { list-style: none; padding: 0; margin: 0; counter-reset: rank; }
.loc-list li {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    counter-increment: rank;
    display: flex; align-items: center; gap: 14px;
}
.loc-list li:last-child { border-bottom: 0; }
.loc-list li::before {
    content: counter(rank);
    width: 28px; height: 28px;
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text-muted);
    display: grid; place-items: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0;
}
.loc-list li:nth-child(1)::before { background: linear-gradient(135deg, #fde68a, #fbbf24); color: #78350f; }
.loc-list li:nth-child(2)::before { background: linear-gradient(135deg, #e5e7eb, #cbd5e1); color: #1f2937; }
.loc-list li:nth-child(3)::before { background: linear-gradient(135deg, #fed7aa, #fb923c); color: #7c2d12; }
.loc-list .body { flex: 1; min-width: 0; }
.loc-row {
    display: flex; justify-content: space-between;
    font-size: 13.5px; font-weight: 600;
    margin-bottom: 6px;
}
.loc-row .count { color: var(--text-muted); font-weight: 500; font-size: 12.5px; }
.bar {
    height: 7px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}
.bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.6s var(--ease-out);
}

/* Mini-map card */
.mini-map {
    width: 100%;
    height: 280px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: grid; place-items: center;
    color: var(--text-muted);
    font-size: 13px;
    position: relative;
}

/* ============================================================
   Profile page
   ============================================================ */
.profile-hero {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #ec4899 100%);
    background-size: 200% 200%;
    animation: gradient-shift 14s ease infinite;
    border-radius: var(--radius-lg);
    padding: 30px;
    color: #fff;
    display: flex;
    gap: 24px;
    align-items: center;
    margin-bottom: 18px;
    box-shadow: 0 20px 48px rgba(99, 102, 241, 0.28);
    position: relative;
    overflow: hidden;
}
.profile-hero::before {
    content: '';
    position: absolute;
    width: 320px; height: 320px;
    background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
    right: -80px; top: -120px;
    border-radius: 50%;
    pointer-events: none;
}
.profile-hero .avatar-lg {
    width: 92px; height: 92px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    border: 3px solid rgba(255,255,255,0.45);
    display: grid; place-items: center;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.profile-hero h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.profile-hero .role {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(6px);
    font-size: 12px;
    font-weight: 600;
}
.profile-hero .meta {
    margin-top: 10px;
    display: flex; gap: 16px; flex-wrap: wrap;
    font-size: 13px;
    opacity: 0.92;
}
.profile-hero .meta svg { vertical-align: -2px; opacity: 0.85; }

.profile-stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
@media (max-width: 700px) { .profile-stat-row { grid-template-columns: 1fr; } }
.profile-stat-row .stat-card { padding: 18px; }
.profile-stat-row .stat-card .value { font-size: 24px; }

.profile-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 16px;
}
@media (max-width: 1000px) { .profile-grid { grid-template-columns: 1fr; } }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 4px 20px 20px;
}
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    display: block;
    margin-bottom: 6px;
    letter-spacing: 0.005em;
}
.form-grid .full { grid-column: 1 / -1; }
.input, .select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    font-size: 14px;
    color: var(--text);
    transition: border 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .select:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 4px var(--accent-soft);
}
textarea.input { resize: vertical; min-height: 80px; }
.form-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}
.setting-row:last-child { border-bottom: 0; }
.setting-row:hover { background: var(--surface-2); }
.setting-row .title { font-size: 13.5px; font-weight: 600; }
.setting-row .sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.switch {
    width: 40px; height: 22px;
    background: var(--border-strong);
    border-radius: 999px;
    position: relative;
    transition: background 0.25s var(--ease-out);
    cursor: pointer;
    flex-shrink: 0;
}
.switch::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18);
    transition: transform 0.25s var(--ease-out);
}
.switch.on { background: var(--accent-grad); box-shadow: 0 0 0 0 transparent, 0 6px 14px rgba(99,102,241,0.35); }
.switch.on::after { transform: translateX(18px); }

/* ============================================================
   Dropdowns (notifications, user menu)
   ============================================================ */
.dropdown { position: relative; display: inline-block; }
.dropdown--block { display: block; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 280px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), visibility 0.2s;
    z-index: 100;
    overflow: hidden;
}
.dropdown.open > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.dropdown-menu--up   { top: auto; bottom: calc(100% + 10px); transform: translateY(8px); }
.dropdown.open > .dropdown-menu--up { transform: translateY(0); }
.dropdown-menu--left { right: auto; left: 0; }

.dropdown-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dropdown-head h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}
.dropdown-head .link {
    background: transparent; border: 0; padding: 0;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
}
.dropdown-head .link:hover { text-decoration: underline; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    background: transparent;
    border: 0;
    width: 100%;
    text-align: left;
    transition: background 0.15s ease;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }
.dropdown-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.dropdown-foot {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.dropdown-foot a {
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 600;
}

/* Notifications */
.dropdown-menu--notif {
    width: 380px;
    max-width: calc(100vw - 40px);
}
.notif-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 380px;
    overflow-y: auto;
}
.notif-list li {
    display: flex;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
}
.notif-list li:last-child { border-bottom: 0; }
.notif-list li:hover { background: var(--surface-2); }
.notif-list li.unread::before {
    content: '';
    position: absolute;
    left: 8px; top: 22px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
}
.notif-list .ico {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: grid; place-items: center;
    flex-shrink: 0;
}
.notif-list .body { flex: 1; min-width: 0; }
.notif-list strong { font-size: 13.5px; font-weight: 600; display: block; line-height: 1.35; }
.notif-list .sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.4;
}
.notif-list .time {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 4px;
    font-weight: 500;
}

/* User menu (sidebar) */
.dropdown-menu--user {
    width: calc(var(--sidebar-w) - 28px);
    min-width: 220px;
}
.dropdown-menu--user .dropdown-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.dropdown-menu--user .dropdown-head .name {
    font-size: 14px; font-weight: 700;
}
.dropdown-menu--user .dropdown-head .email {
    font-size: 11.5px; color: var(--text-muted);
    margin-top: 2px;
}

/* Topbar avatar badge target — make notification icon-btn relative */
.topbar .dropdown { display: inline-block; }

/* Sidebar user becomes a button trigger */
.sidebar-user-btn {
    margin: 14px;
    width: calc(100% - 28px);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-align: left;
    transition: background 0.2s ease;
    cursor: pointer;
}
.sidebar-user-btn:hover { background: rgba(255, 255, 255, 0.08); }

/* ============================================================
   Settings page
   ============================================================ */
.settings-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
}
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    position: sticky;
    top: calc(var(--topbar-h) + 28px);
    align-self: start;
}
.settings-nav a {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s ease;
}
.settings-nav a:hover { background: var(--surface-2); color: var(--text); }
.settings-nav a.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.settings-nav a svg { width: 16px; height: 16px; }

.settings-section {
    margin-bottom: 22px;
    scroll-margin-top: calc(var(--topbar-h) + 28px);
}
.settings-section h2 {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0 0 6px;
}
.settings-section .sub {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 14px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}
.status-pill::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px currentColor;
    opacity: 1;
}
.status-pill::before { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.status-pill.online { background: var(--success-soft); color: var(--success); }
.status-pill.warn   { background: var(--warning-soft); color: var(--warning); }
.status-pill.off    { background: var(--danger-soft); color: var(--danger); }

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 4px 20px 20px;
}
.theme-card {
    padding: 14px;
    border-radius: 12px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.18s var(--ease-out);
    background: var(--surface);
    text-align: center;
}
.theme-card:hover { border-color: var(--border-strong); }
.theme-card.selected {
    border-color: var(--accent);
    background: var(--accent-soft-2);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.theme-card .preview {
    height: 60px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
}
.theme-card.light .preview { background: linear-gradient(135deg, #f1f5f9, #fff); }
.theme-card.light .preview::after {
    content: ''; position: absolute; bottom: 6px; left: 6px; right: 6px; height: 6px;
    background: #e2e8f0; border-radius: 3px;
}
.theme-card.dark .preview { background: linear-gradient(135deg, #0b1020, #1e293b); }
.theme-card.dark .preview::after {
    content: ''; position: absolute; bottom: 6px; left: 6px; right: 6px; height: 6px;
    background: #334155; border-radius: 3px;
}
.theme-card.auto .preview {
    background: linear-gradient(135deg, #f1f5f9 0% 50%, #0b1020 50% 100%);
}
.theme-card .label { font-size: 12.5px; font-weight: 600; }

.danger-card {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, rgba(254, 226, 226, 0.4), transparent);
}

/* ============================================================
   Data table (parcels list, etc.)
   ============================================================ */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.toolbar .search-input,
.toolbar .filter-select {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13.5px;
    color: var(--text);
    font-family: inherit;
    transition: border 0.15s ease, box-shadow 0.15s ease;
}
.toolbar .search-input { width: 280px; padding-left: 36px; }
.toolbar .search-input:focus,
.toolbar .filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.toolbar .search-wrap { position: relative; }
.toolbar .search-wrap svg {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
}
.toolbar .spacer { flex: 1; }
.toolbar .count-pill {
    font-size: 12.5px;
    color: var(--text-muted);
    background: var(--surface-2);
    padding: 7px 12px;
    border-radius: 999px;
    font-weight: 600;
}
.toolbar .count-pill strong { color: var(--text); }

.data-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
.data-table thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.data-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table .num   { color: var(--text-faint); font-feature-settings: 'tnum'; width: 56px; }
.data-table .mono  { font-family: 'SF Mono', Consolas, Monaco, monospace; font-size: 12px; }
.data-table .right { text-align: right; font-feature-settings: 'tnum'; }
.data-table .muted { color: var(--text-muted); }

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}
.pagination .info {
    font-size: 12.5px;
    color: var(--text-muted);
}
.pagination .nav { display: flex; gap: 6px; }
.pagination .nav a, .pagination .nav .current, .pagination .nav .disabled {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all 0.15s ease;
}
.pagination .nav a:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.pagination .nav .current {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}
.pagination .nav .disabled { opacity: 0.4; cursor: not-allowed; }

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state .icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: var(--surface-2);
    display: inline-grid;
    place-items: center;
    margin-bottom: 12px;
}
.empty-state .title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }

/* ============================================================
   Map page shared
   ============================================================ */
.page--map { padding: 0; display: flex; flex: 1; }

.floating {
    background: var(--surface-glass);
    backdrop-filter: saturate(160%) blur(16px);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    border: 1px solid var(--surface-glass-bd);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
    color: var(--text);
}

/* View controls (3D / 2D / reset) — shared between /map/ and /parcels/ */
.view-controls {
    position: absolute;
    top: 20px; right: 20px;
    z-index: 5;
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: 14px;
    animation: float-in 0.5s var(--ease-out) 0.05s both;
}
.view-controls button {
    background: transparent;
    border: 0;
    border-radius: 9px;
    padding: 8px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s var(--ease-out);
}
.view-controls button:hover {
    background: var(--surface-2);
    color: var(--text);
}
.view-controls button.active {
    background: var(--accent-grad);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
.view-controls button svg { width: 14px; height: 14px; }

@keyframes float-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
