/* ══════════════════════════════════════════════════════════════════════════
   Scoop — design system
   Dark-first, Linear/Stripe/Raycast influenced. One system, consistent tokens.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Surfaces (dark by default) */
    --bg:            #0a0b0f;
    --bg-elevated:   #101218;
    --surface:       #14161d;
    --surface-2:     #181b23;
    --surface-hover: #1d212b;
    --border:        #23262f;
    --border-strong: #2d313c;

    /* Text */
    --text:          #e7e9ee;
    --text-muted:    #9aa0ad;
    --text-subtle:   #646b7a;

    /* Brand */
    --accent:        #6366f1;
    --accent-hover:  #7c7ff5;
    --accent-soft:   rgba(99, 102, 241, 0.14);
    --accent-ring:   rgba(99, 102, 241, 0.35);

    /* Status */
    --green:   #34d399;
    --green-soft:  rgba(52, 211, 153, 0.13);
    --yellow:  #fbbf24;
    --yellow-soft: rgba(251, 191, 36, 0.13);
    --red:     #f87171;
    --red-soft:    rgba(248, 113, 113, 0.13);
    --blue:    #60a5fa;
    --blue-soft:   rgba(96, 165, 250, 0.13);

    /* Geometry */
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow:    0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);

    --sidebar-w: 240px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, Helvetica, Arial, sans-serif;
    --mono: 'SF Mono', ui-monospace, 'Cascadia Code', 'JetBrains Mono', Menlo, Consolas, monospace;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a3f4d; }

/* ── App shell ─────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px 12px;
}

.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px 20px;
    font-weight: 650; font-size: 16px; letter-spacing: -0.01em;
}
.brand-mark {
    width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 15px;
    box-shadow: 0 4px 14px var(--accent-ring);
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-subtle); padding: 14px 12px 6px; font-weight: 600; }

.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 500;
    transition: background 0.14s var(--ease), color 0.14s var(--ease);
    cursor: pointer;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.9; }
.nav-badge { margin-left: auto; background: var(--accent); color: #fff;
    font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 20px; }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: var(--radius-sm); }
.user-chip:hover { background: var(--surface-hover); }
.avatar { width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 13px; }
.user-meta { line-height: 1.25; overflow: hidden; }
.user-meta strong { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.user-meta span { font-size: 11px; color: var(--text-subtle); }

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

.topbar {
    height: 60px; flex-shrink: 0;
    display: flex; align-items: center; gap: 16px;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 11, 15, 0.72);
    backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.content { padding: 28px; max-width: 1280px; width: 100%; margin: 0 auto; animation: rise 0.4s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.card-pad-lg { padding: 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--text-subtle); }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* ── Stat tiles ────────────────────────────────────────────────────────── */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    transition: border-color 0.16s var(--ease), transform 0.16s var(--ease);
}
.stat:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.stat-label { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.stat-value { font-size: 28px; font-weight: 680; letter-spacing: -0.02em; margin-top: 8px; }
.stat-meta { font-size: 12px; color: var(--text-subtle); margin-top: 4px; }
.stat-icon { width: 15px; height: 15px; opacity: 0.75; }

/* ── Badges & pills ────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 550; padding: 3px 10px; border-radius: 20px;
    background: var(--surface-2); color: var(--text-muted);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green  { background: var(--green-soft);  color: var(--green); }
.badge-yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge-red    { background: var(--red-soft);    color: var(--red); }
.badge-blue   { background: var(--blue-soft);   color: var(--blue); }
.badge-accent { background: var(--accent-soft); color: var(--accent-hover); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 36px; padding: 0 15px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 550; font-family: inherit;
    border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
    cursor: pointer; transition: all 0.14s var(--ease); white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: #3a3f4d; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-ring); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: var(--red-soft); border-color: transparent; color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; }
.btn-icon { width: 36px; padding: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 550; margin-bottom: 7px; color: var(--text); }
.hint  { font-size: 12px; color: var(--text-subtle); margin-top: 6px; }
.input, .select, .textarea {
    width: 100%; height: 38px; padding: 0 12px;
    background: var(--bg-elevated); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); color: var(--text); font-size: 14px; font-family: inherit;
    transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.textarea { height: auto; padding: 10px 12px; min-height: 110px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
    text-align: left; font-weight: 600; font-size: 12px; color: var(--text-subtle);
    padding: 12px 16px; background: var(--bg-elevated); border-bottom: 1px solid var(--border);
    text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
table.data tbody tr { transition: background 0.12s; }
table.data tbody tr:hover { background: var(--surface); }
table.data tbody tr:last-child td { border-bottom: none; }

/* ── Health bar ────────────────────────────────────────────────────────── */
.meter { height: 6px; background: var(--surface-2); border-radius: 20px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 20px; transition: width 0.5s var(--ease); }
.meter-fill.good { background: var(--green); }
.meter-fill.warn { background: var(--yellow); }
.meter-fill.bad  { background: var(--red); }

/* ── Sparkline ─────────────────────────────────────────────────────────── */
.spark { display: flex; align-items: flex-end; gap: 4px; height: 60px; }
.spark-bar { flex: 1; background: var(--accent-soft); border-radius: 4px 4px 2px 2px; min-height: 3px;
    transition: height 0.5s var(--ease), background 0.14s; }
.spark-bar:hover { background: var(--accent); }

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 56px 24px; }
.empty-icon { width: 46px; height: 46px; margin: 0 auto 16px; color: var(--text-subtle);
    background: var(--surface-2); border-radius: 14px; display: grid; place-items: center; }
.empty h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.empty p { color: var(--text-subtle); max-width: 360px; margin: 0 auto 18px; }

/* ── Toast / flash ─────────────────────────────────────────────────────── */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px;
    font-size: 13px; display: flex; align-items: center; gap: 10px; }
.flash-success { background: var(--green-soft); color: var(--green); border: 1px solid rgba(52,211,153,0.25); }
.flash-error   { background: var(--red-soft);   color: var(--red);   border: 1px solid rgba(248,113,113,0.25); }

/* ── Utilities ─────────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.page-head { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:24px; gap:16px; flex-wrap:wrap; }
.page-head h2 { font-size: 20px; font-weight: 650; letter-spacing:-0.02em; }
.page-head p { color: var(--text-subtle); margin-top: 4px; font-size: 13px; }
kbd { font-family: var(--mono); font-size: 11px; background: var(--surface-2);
    border: 1px solid var(--border-strong); border-bottom-width: 2px;
    border-radius: 5px; padding: 1px 6px; color: var(--text-muted); }

/* ── Auth ──────────────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(1200px 600px at 50% -10%, rgba(99,102,241,0.10), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 34px;
    box-shadow: var(--shadow-lg); animation: rise 0.5s var(--ease); }
.auth-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 6px; font-weight: 700; font-size: 20px; }
.auth-sub { text-align: center; color: var(--text-subtle); font-size: 13px; margin-bottom: 26px; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; z-index: 50; transform: translateX(-100%); transition: transform 0.24s var(--ease); }
    .sidebar.open { transform: none; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .content { padding: 18px; }
    .menu-toggle { display: inline-flex !important; }
}
.menu-toggle { display: none; }

/* ── Light mode (opt-in via [data-theme=light]) ────────────────────────── */
:root[data-theme="light"] {
    --bg:#f7f8fa; --bg-elevated:#ffffff; --surface:#ffffff; --surface-2:#f2f3f6;
    --surface-hover:#eceef2; --border:#e6e8ec; --border-strong:#d7dae1;
    --text:#1a1d24; --text-muted:#5a616e; --text-subtle:#8a909c;
}
