/* Velet Hook panel — theme. Brand text in app.js CONFIG */
:root {
    --bg: #000000;
    --bg-elevated: #07070c;
    --surface: rgba(255,255,255,0.035);
    --surface-hover: rgba(255,255,255,0.06);
    --surface-active: rgba(255,255,255,0.09);
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.14);
    --border-focus: rgba(255,255,255,0.35);

    --brand: #ffffff;
    --brand-2: #e8e8ed;
    --brand-3: #c8cce8;
    --brand-glow: rgba(255,255,255,0.18);

    --primary: #ffffff;
    --primary-solid: #ffffff;
    --primary-fg: #0a0a0c;
    --link: #c8cce8;

    --glass: rgba(8,8,12,0.55);
    --glass-strong: rgba(10,10,14,0.78);

    --accent: #34d399;
    --warn: #f5c451;
    --danger: #fb5e64;
    --info: #c8cce8;
    --violet: #e8e8ed;
    --pink: #f472b6;
    --orange: #fb923c;

    --text: #f5f5f7;
    --text-muted: #9aa1b2;
    --text-faint: #5d6273;

    --sidebar-w: 200px;
    --header-h: 56px;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 8px 28px rgba(0,0,0,0.45);
    --shadow-lg: 0 24px 70px rgba(0,0,0,0.65);
    --shadow-glow: 0 0 40px rgba(255,255,255,0.06);
    --transition: 0.18s ease;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --display: 'Space Grotesk', sans-serif;
    --mono: 'JetBrains Mono', 'Consolas', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; color-scheme: dark; }

body {
    font-family: var(--font);
    background: #000;
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.01em;
}

.hidden { display: none !important; }
::selection { background: rgba(255,255,255,0.22); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 999px; border: 3px solid #000; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ── Starfield ambient ── */
.ambient {
    position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
    background:
        radial-gradient(ellipse 80% 55% at 18% 12%, rgba(255,255,255,0.07), transparent 55%),
        #000;
}
.sky-glow {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 70% 50% at 22% 8%, rgba(255,255,255,0.05), transparent 60%);
    opacity: 0.9;
}
.stars { position: absolute; inset: 0; background-repeat: repeat; contain: strict; }
.stars-a {
    background-size: 480px 480px; opacity: 0.9;
    background-image:
        radial-gradient(1.4px 1.4px at 20px 30px, #fff, transparent),
        radial-gradient(1px 1px at 80px 120px, rgba(255,255,255,0.85), transparent),
        radial-gradient(2px 2px at 160px 70px, #fff, transparent),
        radial-gradient(1px 1px at 240px 200px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1.3px 1.3px at 300px 40px, #fff, transparent),
        radial-gradient(1px 1px at 360px 280px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1.6px 1.6px at 100px 300px, #fff, transparent),
        radial-gradient(1px 1px at 200px 340px, rgba(255,255,255,0.75), transparent),
        radial-gradient(1.2px 1.2px at 380px 160px, #fff, transparent),
        radial-gradient(2px 2px at 280px 320px, rgba(255,255,255,0.9), transparent);
}
.stars-b {
    background-size: 720px 720px; opacity: 0.55;
    background-image:
        radial-gradient(1px 1px at 40px 80px, rgba(255,255,255,0.65), transparent),
        radial-gradient(2px 2px at 220px 140px, #fff, transparent),
        radial-gradient(1px 1px at 400px 60px, rgba(255,255,255,0.45), transparent),
        radial-gradient(1.5px 1.5px at 520px 300px, #fff, transparent),
        radial-gradient(1px 1px at 120px 420px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1.8px 1.8px at 360px 480px, rgba(255,255,255,0.85), transparent),
        radial-gradient(1px 1px at 580px 200px, rgba(255,255,255,0.5), transparent);
    animation: starDrift 180s linear infinite;
}
@keyframes starDrift {
    from { transform: translate3d(0,0,0); }
    to { transform: translate3d(-2%, -1.5%, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .stars-b { animation: none !important; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Surfaces ── */
.glass {
    background: var(--glass-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.05);
}
.panel {
    background: var(--glass-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.panel-head h3 { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.panel-head p { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.panel-body { padding: 0; }
.panel-body-pad { padding: 18px; }
@keyframes spin { to { transform: rotate(360deg); } }
.section-enter { animation: none; }

/* ── Login overlay ── */
.overlay {
    position: fixed; inset: 0; display: flex;
    align-items: center; justify-content: center;
    z-index: 1000;
    background: #000;
    pointer-events: auto;
}
.overlay::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 80% 55% at 18% 12%, rgba(255,255,255,0.07), transparent 55%),
        radial-gradient(ellipse 50% 40% at 75% 75%, rgba(255,255,255,0.04), transparent 50%);
    pointer-events: none;
}
.overlay * { pointer-events: auto; }

.login-shell {
    position: relative; z-index: 1;
    width: min(400px, 94vw);
    animation: loginEnter 0.65s var(--ease) both;
}
@keyframes loginEnter {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to { opacity: 1; transform: none; }
}
.login-brand { margin-bottom: 20px; text-align: center; }

.login-logo-wrap {
    position: relative;
    width: 56px; height: 56px;
    margin: 0 auto 12px;
}
.login-logo-glow {
    position: absolute; inset: -12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.22), transparent 68%);
    filter: blur(8px);
    opacity: 0.85;
    pointer-events: none;
}
.login-logo {
    position: relative; z-index: 1;
    width: 56px; height: 56px;
    border-radius: 16px;
    background: linear-gradient(145deg, #1a1a32, #0a0a14);
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 12px 32px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.08);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--display); font-size: 1.35rem; font-weight: 700; color: #fff;
}
.login-brand h2 {
    font-family: var(--display);
    font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 0 18px rgba(255,255,255,0.28);
}
.login-tagline { color: var(--text-muted); font-size: 0.8rem; margin-top: 6px; font-weight: 500; }

.login-box {
    padding: 20px 18px 18px;
    background: linear-gradient(165deg, rgba(14,14,20,0.92), rgba(8,8,12,0.88));
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 22px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.06);
}
.login-box-head { margin-bottom: 14px; text-align: left; }
.login-box-head h3 {
    font-family: var(--display);
    font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em;
    color: #fff; margin-bottom: 4px;
}
.login-box-head p { color: var(--text-muted); font-size: 0.82rem; line-height: 1.45; }
.login-box-head strong { color: #fff; font-weight: 700; }

.login-fields { display: grid; gap: 2px; margin-bottom: 4px; }

.login-hint-box {
    margin: 10px 0 12px; padding: 10px 12px;
    border-radius: 10px;
    background: rgba(52,211,153,0.06);
    border: 1px solid rgba(52,211,153,0.18);
    color: var(--text); font-size: 0.8rem; line-height: 1.5;
}
.login-hint-box strong { color: var(--accent); font-weight: 700; }
.login-footnote {
    margin-top: 18px; text-align: center;
    font-size: 0.72rem; color: var(--text-faint);
    letter-spacing: 0.04em;
}

.btn-login {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    margin-top: 4px;
}
.btn-login svg { opacity: 0.85; transition: transform 0.2s var(--ease); }
.btn-login:hover:not(:disabled) svg { transform: translateX(3px); }
.login-tabs {
    display: flex; gap: 0; margin-bottom: 20px;
    padding: 4px;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.login-tab {
    flex: 1; padding: 8px 0; border: none; border-radius: calc(var(--radius-sm) - 4px);
    background: transparent; color: var(--text-muted);
    cursor: pointer; font-size: 0.82rem; font-weight: 600; font-family: inherit;
    transition: background var(--transition), color var(--transition);
}
.login-tab:hover { color: var(--text); }
.login-tab.active {
    background: #fff;
    color: #0a0a0c;
    box-shadow: 0 4px 16px rgba(255,255,255,0.12);
}

/* ── Inputs ── */
.input-group { margin-bottom: 14px; }
.input-label {
    display: block; font-size: 0.72rem; font-weight: 700;
    color: var(--text-muted); margin-bottom: 8px;
    text-transform: uppercase; letter-spacing: 0.08em;
}
input, select, textarea {
    width: 100%; padding: 13px 16px;
    background: rgba(0,0,0,0.45); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: 0.9rem; font-family: inherit; outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
input:focus, select:focus, textarea:focus {
    border-color: rgba(255,255,255,0.35);
    background: rgba(0,0,0,0.6);
    box-shadow: 0 0 0 4px rgba(255,255,255,0.06);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
select { cursor: pointer; }
select option { background: #0a0a0c; }

/* ── Buttons ── */
.btn-primary {
    width: 100%; padding: 12px 18px;
    background: #fff; color: #0a0a0c;
    border: none; border-radius: var(--radius-sm);
    font-size: 0.9rem; font-weight: 700; cursor: pointer; font-family: inherit;
    box-shadow: 0 8px 28px rgba(255,255,255,0.14), inset 0 1px 0 rgba(255,255,255,0.35);
    transition: transform var(--ease), box-shadow 0.2s, background 0.15s;
}
.btn-primary:hover:not(:disabled) {
    background: #f3f3f6;
    box-shadow: 0 12px 34px rgba(255,255,255,0.22);
    transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
    padding: 9px 14px; background: var(--surface);
    border: 1px solid var(--border); color: var(--text-muted);
    border-radius: var(--radius-sm); font-size: 0.84rem; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-secondary:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }

.btn-ghost {
    padding: 7px 10px; background: transparent; border: none;
    color: var(--text-muted); border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.84rem; font-family: inherit;
    transition: color var(--transition), background var(--transition);
}
.btn-ghost:hover { color: var(--text); background: var(--surface-hover); }

.btn-danger {
    padding: 9px 14px; background: rgba(251,94,100,0.1);
    border: 1px solid rgba(251,94,100,0.28); color: #ff8b90;
    border-radius: var(--radius-sm); font-size: 0.84rem; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-danger:hover:not(:disabled) { background: rgba(251,94,100,0.18); border-color: rgba(251,94,100,0.45); }
.btn-danger:disabled, .btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-sm { padding: 7px 12px !important; font-size: 0.76rem !important; min-height: 30px; line-height: 1.2; border-radius: 9px !important; }
.btn-inline { width: auto !important; display: inline-flex; align-items: center; gap: 6px; }

.btn-icon {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--text-muted);
    cursor: pointer; font-size: 1rem;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.btn-icon:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }
.btn-icon.spinning svg { animation: spin 0.8s linear infinite; }

.error-text {
    color: var(--danger); font-size: 0.82rem; margin-top: 12px;
    padding: 10px 12px; border-radius: 10px;
    background: rgba(251,94,100,0.08);
    border: 1px solid rgba(251,94,100,0.2);
}
.error-text:empty { display: none; padding: 0; margin: 0; border: none; background: none; }

/* ── Layout ── */
#main-content {
    display: flex; height: 100vh;
    position: relative; z-index: 1;
}

.sidebar {
    width: var(--sidebar-w); min-width: var(--sidebar-w); max-width: var(--sidebar-w);
    height: 100vh; flex-shrink: 0;
    display: flex; flex-direction: column;
    padding: 10px 8px 10px;
    border-right: 1px solid var(--border);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.025) 0%, transparent 80px),
        linear-gradient(180deg, rgba(0,0,0,0.92), rgba(0,0,0,0.82));
    z-index: 10; overflow: hidden;
}

.sidebar-header {
    padding: 2px 4px 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-row { display: flex; align-items: center; gap: 8px; }

.brand-icon-wrap {
    padding: 1px;
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(255,255,255,0.16), rgba(255,255,255,0.04));
}

.brand-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(145deg, #141428, #0c0c18);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--display); font-size: 0.82rem; font-weight: 700; color: #fff;
}

.sidebar-nav-scroll {
    flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
    margin: 0 -4px; padding: 0 4px 8px;
    scrollbar-width: thin;
}

.brand-text h1 {
    font-family: var(--display);
    font-size: 0.88rem; font-weight: 700; letter-spacing: -0.01em;
    color: #fff;
}
.brand-text p {
    font-size: 0.62rem; color: var(--text-muted);
    margin-top: 1px; font-family: var(--font);
    text-transform: none; letter-spacing: 0;
    font-weight: 600;
}

/* ── Nav links ── */
.nav-links {
    list-style: none;
    overflow: visible;
    padding: 0; margin: 0;
    display: flex; flex-direction: column; gap: 1px;
}

.nav-links li {
    display: flex; flex-direction: row; align-items: center; gap: 8px;
    padding: 5px 8px 5px 6px; border-radius: 10px;
    cursor: pointer; color: #b4bac8;
    font-size: 0.8125rem; font-weight: 600; line-height: 1.25;
    transition: background var(--transition), color var(--transition);
    user-select: none; min-height: 32px; position: relative;
    border: 1px solid transparent;
}

.nav-links li:not(.nav-label):hover {
    background: var(--surface);
    color: var(--text);
    border-color: rgba(255,255,255,0.04);
}

.nav-icon {
    width: 26px; height: 26px; min-width: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; line-height: 0;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    transition: background var(--transition), border-color var(--transition);
}
.nav-icon svg { width: 14px !important; height: 14px !important; display: block; opacity: 0.85; transition: opacity var(--transition); }

.nav-links li:not(.nav-label):hover .nav-icon svg { opacity: 0.95; }

.nav-links li.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.08);
}
.nav-links li.active .nav-icon {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.14);
    box-shadow: none;
}
.nav-links li.active .nav-icon svg { opacity: 1; }
.nav-links li.active::before {
    content: ''; position: absolute;
    left: 0; top: 20%; bottom: 20%; width: 2px;
    border-radius: 999px; background: #fff;
    box-shadow: 0 0 10px rgba(255,255,255,0.4);
}

.nav-links li.nav-label {
    padding: 10px 8px 4px; margin-top: 2px; min-height: auto;
    font-size: 0.64rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: #7a8194; cursor: default; pointer-events: none;
    display: block;
}
.nav-links li.nav-label:first-child { margin-top: 0; padding-top: 2px; }
.nav-links li.nav-label:hover { background: transparent !important; border-color: transparent !important; }

.nav-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-lock {
    margin-left: auto; font-size: 0.6rem; padding: 2px 7px;
    border-radius: 6px; background: rgba(255,255,255,0.08);
    color: var(--text-muted); border: 1px solid rgba(255,255,255,0.12); font-weight: 700;
}
#nav-links li:not(.nav-label) { display: flex; align-items: center; gap: 8px; }
#nav-links li.nav-label { display: block; }
#nav-links li.nav-locked { opacity: 0.45; }

.sidebar-footer {
    padding-top: 8px; border-top: 1px solid var(--border); margin-top: 2px;
    display: grid; gap: 6px;
}
.telegram-link {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px 10px;
    color: var(--text-muted); text-decoration: none;
    font-size: 0.78rem; font-weight: 600; border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.telegram-link svg { width: 14px; height: 14px; flex-shrink: 0; }
.telegram-link:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: rgba(255,255,255,0.1);
}
.btn-logout-sidebar {
    width: 100%;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid rgba(251,94,100,0.22);
    background: rgba(251,94,100,0.08);
    color: #ff9a9f;
    font-family: inherit; font-size: 0.78rem; font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn-logout-sidebar svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-logout-sidebar:hover {
    background: rgba(251,94,100,0.16);
    border-color: rgba(251,94,100,0.4);
    color: #ffb4b8;
}
.sidebar-footer .btn-secondary { width: 100%; }

/* ── Content area ── */
.content-area {
    flex: 1 1 auto; width: calc(100% - var(--sidebar-w));
    min-width: 0; overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column;
    background: transparent;
}

.page-content {
    padding: 18px 22px 28px; flex: 1;
    width: 100%; min-height: calc(100vh - var(--header-h));
}

/* ── Topbar ── */
.topbar {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 22px;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-left h2 {
    font-family: var(--display);
    font-size: 1rem; font-weight: 700; letter-spacing: -0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-left p {
    font-size: 0.75rem; color: var(--text-muted); margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }

.user-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px 4px 4px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.user-avatar {
    width: 28px; height: 28px; border-radius: 9px;
    background: linear-gradient(135deg, rgba(109,122,255,0.35), rgba(154,92,255,0.2));
    border: 1px solid rgba(109,122,255,0.3); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--display); font-size: 0.72rem; font-weight: 700;
}
.user-chip span { font-size: 0.75rem; color: var(--text-muted); font-family: var(--mono); }

.role-pill {
    font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
    padding: 3px 8px; border-radius: 6px;
    background: rgba(255,255,255,0.08); color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.12);
}

/* ── Stats grid ── */
.section { display: block; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 12px; margin-bottom: 22px;
}

.stat-card {
    padding: 18px 18px 16px;
    background: var(--glass); border: 1px solid var(--border);
    border-radius: var(--radius); position: relative; overflow: hidden;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow);
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--stat-accent, rgba(255,255,255,0.5)); opacity: 0.9;
}
.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.stat-accent-0 { --stat-accent: rgba(255,255,255,0.7); }
.stat-accent-1 { --stat-accent: #c8cce8; }
.stat-accent-2 { --stat-accent: #34d399; }
.stat-accent-3 { --stat-accent: #f5c451; }
.stat-accent-4 { --stat-accent: #f472b6; }
.stat-accent-5 { --stat-accent: #fb923c; }

.stat-card-head { display: block; margin-bottom: 10px; }
.stat-card h3, .stat-label {
    font-size: 0.68rem; font-weight: 800; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.1em;
}
.stat-icon { display: none; }
.stat-value {
    font-family: var(--display); font-size: 1.7rem; font-weight: 700;
    letter-spacing: -0.03em; line-height: 1; color: var(--text);
    font-variant-numeric: tabular-nums;
}
.stat-value-sm {
    font-size: 0.82rem !important; font-weight: 500 !important;
    word-break: break-word; line-height: 1.45 !important;
}

/* ── Charts ── */
.charts-row { display: grid; grid-template-columns: 1.55fr 1fr; gap: 12px; }

.chart-panel {
    padding: 18px; min-height: 280px;
    display: flex; flex-direction: column;
    background: var(--glass); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.chart-panel canvas { flex: 1; min-height: 210px; max-height: 250px; }
.chart-title { font-family: var(--display); font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.chart-sub { font-size: 0.7rem; color: var(--text-faint); margin-bottom: 14px; font-family: var(--mono); }

/* ── Actions bar ── */
.actions-bar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px;
}
.search-wrap { flex: 1; min-width: 180px; position: relative; }
.search-wrap svg {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; color: var(--text-faint); pointer-events: none;
}
.search-input { padding-left: 36px !important; }
.toolbar-select { width: auto; min-width: 130px; }
.key-count-input { width: 64px; text-align: center; font-family: var(--mono); }

.key-nickname-wrap { display: inline-flex; align-items: center; }
.key-nickname-wrap.hidden { display: none !important; }
.key-nickname-input {
    width: 96px; min-width: 96px; padding: 8px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.35); color: var(--text);
    font-family: var(--mono); font-size: 0.82rem;
}
.key-nickname-input:focus { outline: none; border-color: rgba(255,255,255,0.35); }

.keys-toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.keys-toolbar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.keys-toolbar-options { padding-top: 4px; border-top: 1px solid var(--border); }

/* ── Tables ── */
.table-scroll { overflow-x: auto; max-height: calc(100vh - 260px); }

table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
thead { position: sticky; top: 0; z-index: 2; }

th {
    padding: 10px 16px;
    background: rgba(0,0,0,0.35);
    color: var(--text-faint); font-weight: 800; font-size: 0.66rem;
    text-transform: uppercase; letter-spacing: 0.1em;
    text-align: left; white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
td { padding: 11px 16px; border-top: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--surface-hover); }

code {
    font-family: var(--mono); font-size: 0.76rem;
    padding: 3px 8px; background: rgba(255,255,255,0.06);
    border: 1px solid var(--border); border-radius: 7px; color: var(--text-muted);
}
.action-cell { display: flex; gap: 6px; flex-wrap: nowrap; }

/* ── Badges ── */
.status-badge {
    display: inline-flex; align-items: center; padding: 3px 8px;
    border-radius: 6px; font-size: 0.68rem; font-weight: 700;
    font-family: var(--mono); letter-spacing: 0.03em; white-space: nowrap;
    border: 1px solid transparent;
}
.badge-used, .badge-success { background: rgba(52,211,153,0.12); color: #6ee7b7; border-color: rgba(52,211,153,0.3); }
.badge-unused, .badge-pending { background: rgba(200,204,232,0.1); color: #c8cce8; border-color: rgba(200,204,232,0.2); }
.badge-danger, .badge-failed { background: rgba(251,94,100,0.1); color: #ff8b90; border-color: rgba(251,94,100,0.25); }
.badge-warn, .badge-running { background: rgba(245,196,81,0.12); color: #f5c451; border-color: rgba(245,196,81,0.25); }
.badge-token { background: rgba(255,255,255,0.08); color: var(--text-muted); border-color: var(--border); }
.badge-info { background: rgba(200,204,232,0.08); color: #c8cce8; border-color: rgba(200,204,232,0.18); }
.badge-default { background: rgba(255,255,255,0.05); color: var(--text-muted); border-color: var(--border); }

/* ── Live feed ── */
.live-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.live-status {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem; font-weight: 600; color: var(--text-muted); font-family: var(--mono);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }

@keyframes pulse-live {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52,211,153,0.5); }
    50% { opacity: 0.85; box-shadow: 0 0 0 6px rgba(52,211,153,0); }
}
.live-status.connected .live-dot { background: var(--accent); animation: pulse-live 2s ease infinite; }
.live-status.connected { color: var(--accent); }

.live-feed {
    max-height: calc(100vh - 200px); overflow-y: auto;
    background: var(--glass); border: 1px solid var(--border); border-radius: var(--radius);
}
.live-item {
    display: grid; grid-template-columns: 140px 90px 90px 1fr auto;
    gap: 10px; align-items: center; padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.live-item:hover { background: var(--surface-hover); }
.live-item:last-child { border-bottom: none; }
.live-time { font-size: 0.74rem; color: var(--text-faint); font-family: var(--mono); }
.live-preview { font-size: 0.82rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Intel ── */
.intel-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 12px; margin-bottom: 12px; }
.intel-side { max-height: 500px; overflow-y: auto; }

.timeline-list { list-style: none; padding: 0 16px 16px; }
.timeline-list li {
    position: relative; padding: 10px 0 10px 18px;
    border-left: 1px solid var(--border); margin-left: 6px; font-size: 0.82rem;
}
.timeline-list li::before {
    content: ''; position: absolute; left: -3px; top: 14px;
    width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted);
}
.timeline-list span { display: block; font-size: 0.7rem; color: var(--text-faint); margin-top: 3px; font-family: var(--mono); }

.hint-text { color: var(--text-faint); font-size: 0.82rem; padding: 10px 16px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-faint); }
.empty-state p { font-size: 0.82rem; }

.loading-row td { text-align: center; padding: 32px; color: var(--text-faint); font-family: var(--mono); font-size: 0.8rem; }

/* ── Page loader ── */
.page-loader {
    position: fixed; inset: 0; background: rgba(0,0,0,0.72);
    display: flex; align-items: center; justify-content: center; z-index: 500;
}
.page-loader.hidden { display: none !important; pointer-events: none !important; }
.loader-ring {
    width: 28px; height: 28px;
    border: 2px solid var(--border); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.65s linear infinite;
}

/* ── Modals ── */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.72);
    display: flex; align-items: center; justify-content: center; z-index: 1100; padding: 20px;
}
.modal {
    width: min(400px, 94vw); padding: 22px;
    background: var(--glass-strong); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg),inset 0 1px 0 rgba(255,255,255,0.05);
}
.modal-wide {
    width: min(720px, 96vw); max-height: 88vh;
    display: flex; flex-direction: column; text-align: left;
}
.modal-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal h3 { font-family: var(--display); font-size: 0.95rem; font-weight: 600; }
.modal > p { color: var(--text-muted); font-size: 0.82rem; margin: 8px 0 16px; }
.modal-actions { display: flex; gap: 8px; margin-top: 4px; }
.modal-actions button { flex: 1; }

.log-pre {
    flex: 1; overflow: auto; max-height: 55vh;
    background: rgba(0,0,0,0.5); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px;
    font-size: 0.76rem; line-height: 1.55; color: var(--text-muted);
    margin-bottom: 12px; white-space: pre-wrap; word-break: break-word;
    font-family: var(--mono);
}

/* ── Toast ── */
.toast {
    position: fixed; bottom: 20px; right: 20px;
    padding: 14px 20px;
    background: var(--glass-strong); backdrop-filter: blur(20px);
    border: 1px solid var(--border); color: var(--text);
    border-radius: 14px; font-size: 0.88rem; font-weight: 600;
    z-index: 2000; box-shadow: var(--shadow-lg);
    animation: toastIn 0.35s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } }

.last-sync { font-size: 0.7rem; color: var(--text-faint); font-family: var(--mono); }

.link-btn { color: var(--link); text-decoration: none; font-weight: 600; font-size: 0.82rem; }
.link-btn:hover { color: #fff; text-decoration: underline; }

.announce-textarea { margin: 10px 0 12px; resize: vertical; min-height: 96px; }

/* ── Map bars ── */
.map-bars { display: flex; flex-direction: column; gap: 8px; }
.map-bar-row { display: grid; grid-template-columns: 48px 1fr 40px; gap: 10px; align-items: center; }
.map-bar-label { font-weight: 700; font-size: 0.75rem; color: var(--text-muted); }
.map-bar-track { height: 8px; background: var(--surface-hover); border-radius: 999px; overflow: hidden; }
.map-bar-fill { height: 100%; background: linear-gradient(90deg, rgba(255,255,255,0.6), rgba(200,204,232,0.8)); border-radius: 999px; }
.map-bar-count { font-family: var(--mono); font-size: 0.74rem; color: var(--text-muted); text-align: right; }

/* ── Pinned rows ── */
.row-pinned { background: rgba(245,196,81,0.05); }
.pin-btn { font-size: 1rem; line-height: 1; padding: 2px 6px; }
.pin-btn.pinned { color: var(--warn); }

/* ── Stealer / remote tabs ── */
.stealer-tab, .stealer-tabs .stealer-tab {
    padding: 7px 14px; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted);
    border-radius: 9px; cursor: pointer; font-family: inherit; font-size: 0.82rem; font-weight: 600;
    transition: 0.15s;
}
.stealer-tab.active { color: #fff; border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.1); }

.remote-tab {
    padding: 7px 12px; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted);
    border-radius: 9px; font-size: 0.82rem; cursor: pointer;
    font-family: inherit; font-weight: 600; transition: 0.15s;
}
.remote-tab.active { color: #fff; border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.1); }

/* ── Modal tabs ── */
.modal-tabs {
    display: flex; gap: 0; margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.modal-tab {
    padding: 8px 14px; border: none; background: transparent;
    color: var(--text-muted); font-size: 0.82rem; font-weight: 600;
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
    font-family: inherit; transition: color var(--transition), border-color var(--transition);
}
.modal-tab.active { color: #fff; border-bottom-color: #fff; }

/* ── Analyze ── */
.log-analyze {
    background: rgba(0,0,0,0.4); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px;
    font-size: 0.82rem; max-height: 55vh; overflow: auto;
}
.analyze-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.analyze-item {
    padding: 11px 14px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm);
}
.analyze-item strong { font-family: var(--mono); font-size: 1rem; font-weight: 700; color: var(--text); }
.analyze-item span { display: block; font-size: 0.62rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.analyze-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ── Deep search ── */
.search-results { max-height: 50vh; overflow-y: auto; margin-top: 12px; padding: 0; }
.search-hit { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.04); cursor: pointer; transition: background var(--transition); }
.search-hit:hover { background: var(--surface-hover); }
.search-hit:last-child { border-bottom: none; }
.search-hit-meta { font-size: 0.7rem; color: var(--text-faint); font-family: var(--mono); margin-bottom: 4px; }
.search-hit-line { font-size: 0.76rem; color: var(--text-muted); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Command palette ── */
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; }

.cmd-modal { width: min(480px, 94vw); padding: 0; overflow: hidden; }
.cmd-modal .search-input { border: none; border-bottom: 1px solid var(--border); border-radius: 0; padding: 14px 16px; }
.cmd-list { list-style: none; max-height: 320px; overflow-y: auto; margin: 0; padding: 6px; }
.cmd-list li {
    padding: 10px 12px; border-radius: 10px; cursor: pointer;
    font-size: 0.84rem; color: var(--text-muted);
    display: flex; justify-content: space-between; align-items: center;
}
.cmd-list li:hover, .cmd-list li.active { background: var(--surface-hover); color: var(--text); }
.cmd-list kbd {
    font-family: var(--mono); font-size: 0.62rem; color: var(--text-faint);
    border: 1px solid var(--border); padding: 2px 5px; border-radius: 5px;
}
.cmd-hint { padding: 8px 14px; margin: 0; }

/* ── Remote section ── */
.remote-layout { display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; align-items: start; }
.remote-detail { min-height: 420px; }
.remote-screen-wrap {
    background: #050505; border: 1px solid var(--border); border-radius: 12px;
    min-height: 220px; display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px; overflow: hidden;
}
.remote-screen { width: 100%; max-height: 360px; object-fit: contain; display: block; }
.remote-cmd-output {
    margin-top: 12px; padding: 12px; background: #050505;
    border: 1px solid var(--border); border-radius: 10px;
    font-family: var(--mono); font-size: 0.76rem; max-height: 200px;
    overflow: auto; white-space: pre-wrap; color: #c8facc; line-height: 1.55;
}
.remote-actions { flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.remote-actions .btn-secondary, .remote-actions .btn-danger, .remote-actions .btn-primary { width: auto; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.remote-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.agent-row { cursor: pointer; }
.agent-row.selected { background: var(--surface-hover); }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.status-dot.online { background: #4ade80; box-shadow: 0 0 8px rgba(74,222,128,0.55); }
.status-dot.offline { background: rgba(255,255,255,0.2); }

/* ── Tools ── */
.tools-grid { display: grid; grid-template-columns: minmax(0, 560px); gap: 12px; }

.drop-zone {
    border: 1px dashed var(--border-strong); border-radius: var(--radius);
    padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 0.82rem;
    transition: border-color var(--transition), background var(--transition);
}
.drop-zone.drag-over { border-color: rgba(255,255,255,0.35); background: var(--surface-hover); }

/* ── Misc ── */
.ok-text { color: var(--accent) !important; }
.flag-wallet { color: var(--warn); }
.flag-token { color: var(--danger); }
.token-cell { font-size: 0.7rem; max-width: 220px; display: inline-block; overflow: hidden; text-overflow: ellipsis; }

.tier-list { margin: 0; padding-left: 18px; color: var(--text-muted); font-size: 0.82rem; line-height: 1.65; }
.tier-legend { margin-bottom: 14px; }
.account-panel { max-width: 440px; }
.login-customer-hint { padding: 0 0 12px; margin: 0; font-size: 0.76rem; }

.usage-type-list { display: flex; flex-direction: column; gap: 8px; }
.usage-row { display: flex; justify-content: space-between; padding: 9px 12px; background: var(--surface); border-radius: var(--radius-sm); }
.stat-card-wide { grid-column: span 2; }

.col-check { width: 36px; }
.col-check input { width: auto; accent-color: var(--text); }

/* ── Light theme (kept minimal for compat) ── */
[data-theme="light"] {
    --bg: #f4f6fb;
    --bg-elevated: #ffffff;
    --surface: rgba(0,0,0,0.04);
    --surface-hover: rgba(0,0,0,0.07);
    --glass: rgba(255,255,255,0.85);
    --glass-strong: rgba(255,255,255,0.92);
    --border: rgba(0,0,0,0.1);
    --border-strong: rgba(0,0,0,0.18);
    --text: #0f172a;
    --text-muted: #475569;
    --text-faint: #64748b;
    --shadow: 0 4px 20px rgba(15,23,42,0.08);
}
[data-theme="light"] body { background: #f4f6fb; }
[data-theme="light"] .ambient { display: none; }
[data-theme="light"] .sidebar { background: rgba(255,255,255,0.9); }
[data-theme="light"] .topbar { background: rgba(244,246,251,0.85); }
[data-theme="light"] .btn-primary { background: #0f172a; color: #fff; box-shadow: 0 4px 14px rgba(15,23,42,0.25); }
[data-theme="light"] .btn-primary:hover:not(:disabled) { background: #1e293b; box-shadow: 0 8px 22px rgba(15,23,42,0.35); }
[data-theme="light"] .overlay { background: #f4f6fb; }
[data-theme="light"] .overlay::before { display: none; }
[data-theme="light"] .login-logo { background: #0f172a; }
[data-theme="light"] .login-brand h2 { color: #0f172a; text-shadow: none; }
[data-theme="light"] .brand-icon { background: #0f172a; }

/* ── Responsive ── */
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 6px; }

@media (max-width: 600px) { .topbar-left p { display: none; } }
@media (max-width: 1100px) {
    .charts-row, .intel-grid { grid-template-columns: 1fr; }
    .live-item { grid-template-columns: 1fr; gap: 4px; }
    .remote-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .mobile-menu-btn { display: flex; }
    .sidebar {
        position: fixed; left: 0; top: 0; height: 100vh;
        max-width: 260px; width: 260px;
        transform: translateX(-100%);
        transition: transform 0.22s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .content-area { width: 100%; }
    .page-content { padding: 14px; }
    .topbar { padding: 12px 16px; }
}
@media (max-width: 768px) { .stat-card-wide { grid-column: span 1; } }
