/* ==========================================================================
   Rad Intel theme.css
   Design tokens, the self-hosted Inter font and the two color themes.
   Loaded by every page BEFORE style.css / standalone.css and tailwind.css.
   Light is the default (no attribute needed). Dark is <html data-theme="dark">,
   set before first paint by theme-init.js.

   Section 4 remaps the Tailwind slate utilities that the markup still
   carries (bg-slate-800, text-slate-400, ...) onto the tokens, so both
   themes follow the tokens without touching that markup. New markup uses
   the token utilities from tailwind/tailwind.config.js (bg-card, text-ink,
   border-line, ...) or the variables directly. The remaps go away as the
   slate utilities are removed page by page during the design refresh.
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Inter (SIL Open Font License 1.1, frontend/fonts/OFL.txt)
   Variable weight 400..700. Latin and Latin Extended subsets, Google Fonts
   build v20, served from /static so the CSP font-src 'self' holds.
   -------------------------------------------------------------------------- */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/static/fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/static/fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


/* --------------------------------------------------------------------------
   2. Tokens: light (default)
   -------------------------------------------------------------------------- */
:root {
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Surfaces */
    --bg: #f6f7fb;
    --surface: #ffffff;        /* card */
    --surface-2: #f6f7fb;      /* hover, nested, table header */
    --surface-3: #eef0f5;      /* pressed, ghost buttons */
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --input-bg: #ffffff;

    /* Text */
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-subtle: #9ca3af;

    /* Brand */
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-rgb: 59, 130, 246;
    --accent-soft: rgba(59, 130, 246, 0.10);
    --accent-border: rgba(59, 130, 246, 0.35);

    /* Semantic tones */
    --pos: #16a34a;
    --pos-soft: rgba(22, 163, 74, 0.12);
    --neg: #dc2626;
    --neg-soft: rgba(220, 38, 38, 0.10);
    --warn: #f59e0b;
    --warn-soft: rgba(245, 158, 11, 0.14);
    --info: #0ea5e9;
    --info-soft: rgba(14, 165, 233, 0.12);
    --neutral: #6b7280;
    --neutral-soft: rgba(107, 114, 128, 0.14);

    /* Shape and elevation. Cards are flat; only popovers get depth. */
    --radius: 12px;
    --radius-ctl: 10px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

    /* Shell */
    --header-bg: #ffffff;
    --header-h: 68px;
    --sidebar-bg: #111827;
    --sidebar-text: #d1d5db;
    --sidebar-muted: #6b7280;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 76px;

    color-scheme: light;
}


/* --------------------------------------------------------------------------
   3. Tokens: dark. Surfaces are tuned by hand, not inverted.
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
    --bg: #0b1020;
    --surface: #131a2e;
    --surface-2: #0f1527;
    --surface-3: #1a2340;
    --border: #232c45;
    --border-strong: #2f3a5c;
    --input-bg: #0f1527;

    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --text-subtle: #6b7280;

    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-soft: rgba(59, 130, 246, 0.16);
    --accent-border: rgba(59, 130, 246, 0.45);

    --pos: #22c55e;
    --pos-soft: rgba(34, 197, 94, 0.14);
    --neg: #f87171;
    --neg-soft: rgba(248, 113, 113, 0.14);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.14);
    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, 0.14);
    --neutral: #9ca3af;
    --neutral-soft: rgba(156, 163, 175, 0.14);

    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);

    --header-bg: #101729;
    --sidebar-bg: #0a0f1d;
    --sidebar-border: rgba(255, 255, 255, 0.06);

    color-scheme: dark;
}


/* --------------------------------------------------------------------------
   4. Base
   -------------------------------------------------------------------------- */
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

input, textarea, select, button {
    font-family: inherit;
}
input, textarea, select {
    color: var(--text);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Icon sprite helpers. The sprite itself sits at the top of index.html. */
.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}
.ico {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}
.ico-sm { width: 14px; height: 14px; }
.ico-lg { width: 20px; height: 20px; }

/* Shared recipes used by the app shell AND the standalone pages (login,
 * setup, legal): buttons, status pills, skeleton shimmer. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-ctl);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}
.btn-primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.25);
}
.btn-primary:hover { background: var(--accent-hover); color: #ffffff; }
.btn-ghost {
    background: var(--surface);
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.6; cursor: default; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    color: var(--neutral);
    background: var(--neutral-soft);
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.pos { color: var(--pos); background: var(--pos-soft); }
.status-pill.neg { color: var(--neg); background: var(--neg-soft); }
.status-pill.warn { color: var(--warn); background: var(--warn-soft); }
.status-pill.info { color: var(--info); background: var(--info-soft); }
.status-pill.accent { color: var(--accent); background: var(--accent-soft); }
.status-pill.no-dot::before { display: none; }

.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: var(--border);
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: shimmer 1.3s infinite;
}
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }


/* --------------------------------------------------------------------------
   5. Slate utility remaps, light theme
   Specificity (0,3,0) beats the utilities (0,1,0) regardless of load order.
   -------------------------------------------------------------------------- */
:root:not([data-theme="dark"]) .bg-slate-950 { background: var(--surface-2); }
:root:not([data-theme="dark"]) .bg-slate-900 { background: var(--bg); }
:root:not([data-theme="dark"]) .bg-slate-900\/40 { background: rgba(246, 247, 251, 0.7); }
:root:not([data-theme="dark"]) .bg-slate-900\/50 { background: var(--surface-2); }
:root:not([data-theme="dark"]) .bg-slate-900\/60 { background: var(--surface-2); }
:root:not([data-theme="dark"]) .bg-slate-800 { background: var(--surface); }
:root:not([data-theme="dark"]) .bg-slate-800\/40 { background: var(--surface); }
:root:not([data-theme="dark"]) .bg-slate-800\/50 { background: rgba(255, 255, 255, 0.8); }
:root:not([data-theme="dark"]) .bg-slate-800\/60 { background: rgba(255, 255, 255, 0.85); }
:root:not([data-theme="dark"]) .bg-slate-800\/80 { background: var(--surface); }
:root:not([data-theme="dark"]) .bg-slate-700 { background: var(--surface-3); }
:root:not([data-theme="dark"]) .bg-slate-600 { background: #e5e7eb; }
:root:not([data-theme="dark"]) .bg-slate-500\/20 { background: var(--neutral-soft); }
:root:not([data-theme="dark"]) .border-slate-800 { border-color: var(--border); }
:root:not([data-theme="dark"]) .border-slate-700 { border-color: var(--border); }
:root:not([data-theme="dark"]) .border-slate-600 { border-color: var(--border-strong); }
:root:not([data-theme="dark"]) .text-white { color: var(--text); }
:root:not([data-theme="dark"]) .text-slate-200 { color: var(--text); }
:root:not([data-theme="dark"]) .text-slate-300 { color: #374151; }
:root:not([data-theme="dark"]) .text-slate-400 { color: #4b5563; }
:root:not([data-theme="dark"]) .text-slate-500 { color: var(--text-muted); }
:root:not([data-theme="dark"]) .text-slate-600 { color: var(--text-subtle); }
:root:not([data-theme="dark"]) .placeholder-slate-500::placeholder { color: var(--text-subtle); }
:root:not([data-theme="dark"]) input.bg-slate-900,
:root:not([data-theme="dark"]) textarea.bg-slate-900,
:root:not([data-theme="dark"]) select.bg-slate-900,
:root:not([data-theme="dark"]) select.bg-slate-700,
:root:not([data-theme="dark"]) input.bg-slate-700 { background: var(--input-bg); color: var(--text); }
:root:not([data-theme="dark"]) .hover\:bg-slate-700:hover { background: var(--surface-3); }
:root:not([data-theme="dark"]) .hover\:bg-slate-700\/50:hover { background: var(--surface-2); }
:root:not([data-theme="dark"]) .hover\:bg-slate-800\/60:hover { background: var(--surface-2); }
:root:not([data-theme="dark"]) .hover\:bg-slate-800\/50:hover { background: var(--surface-2); }
:root:not([data-theme="dark"]) .hover\:bg-slate-600:hover { background: #e5e7eb; }
:root:not([data-theme="dark"]) .hover\:bg-slate-500:hover { background: #d1d5db; }
:root:not([data-theme="dark"]) .hover\:text-white:hover { color: var(--text); }
:root:not([data-theme="dark"]) .hover\:text-slate-200:hover { color: var(--text); }
:root:not([data-theme="dark"]) .hover\:text-slate-300:hover { color: var(--text); }
:root:not([data-theme="dark"]) .lg\:border-slate-700 { border-color: var(--border); }


/* --------------------------------------------------------------------------
   6. Slate utility remaps, dark theme (the template's dark surfaces, not
      Tailwind's bluer slate)
   -------------------------------------------------------------------------- */
[data-theme="dark"] .bg-slate-950 { background: #0a0e1c; }
[data-theme="dark"] .bg-slate-900 { background: var(--bg); }
[data-theme="dark"] .bg-slate-900\/40 { background: rgba(11, 16, 32, 0.6); }
[data-theme="dark"] .bg-slate-900\/50 { background: var(--surface-2); }
[data-theme="dark"] .bg-slate-900\/60 { background: var(--surface-2); }
[data-theme="dark"] .bg-slate-800 { background: var(--surface); }
[data-theme="dark"] .bg-slate-800\/40 { background: var(--surface); }
[data-theme="dark"] .bg-slate-800\/50 { background: rgba(19, 26, 46, 0.7); }
[data-theme="dark"] .bg-slate-800\/60 { background: rgba(19, 26, 46, 0.85); }
[data-theme="dark"] .bg-slate-800\/80 { background: var(--surface); }
[data-theme="dark"] .bg-slate-700 { background: var(--surface-3); }
[data-theme="dark"] .bg-slate-600 { background: #232c45; }
[data-theme="dark"] .bg-slate-500\/20 { background: var(--neutral-soft); }
[data-theme="dark"] .border-slate-800 { border-color: var(--border); }
[data-theme="dark"] .border-slate-700 { border-color: var(--border); }
[data-theme="dark"] .border-slate-600 { border-color: var(--border-strong); }
[data-theme="dark"] .text-slate-200 { color: var(--text); }
[data-theme="dark"] .text-slate-300 { color: #d1d5db; }
[data-theme="dark"] .text-slate-400 { color: var(--text-muted); }
[data-theme="dark"] .text-slate-500 { color: #8b93a7; }
[data-theme="dark"] .text-slate-600 { color: #5b6478; }
[data-theme="dark"] .placeholder-slate-500::placeholder { color: var(--text-subtle); }
[data-theme="dark"] input.bg-slate-900,
[data-theme="dark"] textarea.bg-slate-900,
[data-theme="dark"] select.bg-slate-900,
[data-theme="dark"] select.bg-slate-700,
[data-theme="dark"] input.bg-slate-700 { background: var(--input-bg); color: var(--text); }
[data-theme="dark"] .hover\:bg-slate-700:hover { background: var(--surface-3); }
[data-theme="dark"] .hover\:bg-slate-700\/50:hover { background: var(--surface-3); }
[data-theme="dark"] .hover\:bg-slate-800\/60:hover { background: var(--surface-3); }
[data-theme="dark"] .hover\:bg-slate-800\/50:hover { background: var(--surface-3); }
[data-theme="dark"] .hover\:bg-slate-600:hover { background: #2a3452; }
[data-theme="dark"] .hover\:bg-slate-500:hover { background: #33406a; }
[data-theme="dark"] .lg\:border-slate-700 { border-color: var(--border); }
