/* ==========================================================================
   CID — Premium Light Identity (60% light gray / 20% orange / black accents)
   --------------------------------------------------------------------------
   Loaded AFTER the Tailwind CDN script, scoped with `body.theme-dark`.
   Public tokens --brand / --brand-hover / --brand-deep / --brand-tint are kept
   stable; the body class name is kept for compatibility with every page.
   Presentation only: no page logic, no layout engines.
   ========================================================================== */

/* ==========================================================================
   1. Design tokens
   ========================================================================== */
:root {
    /* Brand aliases (stable public tokens used by the release pipeline) */
    --brand: #f97316;
    --brand-hover: #ea580c;
    --brand-deep: #c2410c;
    --brand-tint: rgba(249, 115, 22, .12);

    /* Surfaces — 60% light gray */
    --cid-bg: #eef1f4;
    --cid-surface: #f7f8fa;
    --cid-surface-2: #eef1f4;
    --cid-surface-3: #e9edf1;
    --cid-card: #ffffff;
    --cid-border: #d5dbe2;
    --cid-border-soft: #e5e9ee;
    --cid-border-strong: #0b0f14;
    --cid-nav: #0b0f14;
    --cid-nav-2: #111827;

    /* Ink */
    --cid-ink: #0b0f14;
    --cid-text: #0b0f14;
    --cid-muted: #4b5563;
    --cid-faint: #6b7280;

    /* Orange primary (approx. 20% of the surface area) */
    --cid-orange: #f97316;
    --cid-orange-light: #fb923c;
    --cid-orange-deep: #ea580c;
    --cid-orange-dark: #c2410c;
    --cid-orange-tint: #fff1e6;
    --cid-orange-tint-2: #fff7f1;

    /* Status */
    --cid-success: #059669;
    --cid-danger: #dc2626;
    --cid-warning: #d97706;

    /* Radii (16–24px system) */
    --cid-r-sm: 14px;
    --cid-r-md: 16px;
    --cid-r-lg: 20px;
    --cid-r-xl: 24px;

    /* Gradients, glows, shadows */
    --cid-grad-orange: linear-gradient(135deg, #fb923c 0%, #f97316 45%, #ea580c 100%);
    --cid-grad-orange-hover: linear-gradient(135deg, #fdba74 0%, #fb923c 45%, #f97316 100%);
    --cid-grad-success: linear-gradient(135deg, #10b981 0%, #059669 55%, #047857 100%);
    --cid-glow-orange: 0 16px 38px -20px rgba(249, 115, 22, .55);
    --cid-shadow-card: 0 1px 2px rgba(11, 15, 20, .04), 0 20px 42px -32px rgba(11, 15, 20, .28);
    --cid-shadow-deep: 0 30px 70px -40px rgba(11, 15, 20, .45);
    --cid-shadow-soft: 0 1px 2px rgba(11, 15, 20, .04), 0 10px 24px -22px rgba(11, 15, 20, .22);

    --cid-font: 'Cairo', 'Segoe UI', Tahoma, system-ui, -apple-system, sans-serif;
    --cid-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Courier New', monospace;
}

html {
    color-scheme: light;
}

/* ==========================================================================
   2. Base — body, typography, scrollbars, focus, selection
   ========================================================================== */
body.theme-dark {
    font-family: var(--cid-font);
    color: var(--cid-text);
    background-color: var(--cid-bg);
    background-image:
        radial-gradient(1000px 460px at 90% -12%, rgba(249, 115, 22, .10), transparent 62%),
        radial-gradient(760px 380px at -8% 0%, rgba(249, 115, 22, .045), transparent 58%),
        linear-gradient(180deg, #f4f6f8 0%, var(--cid-bg) 46%, #e9edf1 100%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.65;
    min-height: 100vh;
    max-width: 100%;
    -webkit-tap-highlight-color: transparent;
}

body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3,
body.theme-dark h4 {
    color: var(--cid-text);
    letter-spacing: -.01em;
}

body.theme-dark ::selection {
    background: rgba(249, 115, 22, .28);
    color: var(--cid-ink);
}

body.theme-dark a {
    transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

/* Scrollbars — light */
body.theme-dark {
    scrollbar-color: #c3ccd6 var(--cid-bg);
    scrollbar-width: thin;
}

body.theme-dark ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

body.theme-dark ::-webkit-scrollbar-track {
    background: #eef1f4;
}

body.theme-dark ::-webkit-scrollbar-thumb {
    background: #c3ccd6;
    border-radius: 999px;
    border: 2px solid #eef1f4;
}

body.theme-dark ::-webkit-scrollbar-thumb:hover {
    background: #a8b4c1;
}

body.theme-dark ::-webkit-scrollbar-corner {
    background: #eef1f4;
}

/* Focus visibility (keyboard) */
body.theme-dark a:focus-visible,
body.theme-dark button:focus-visible,
body.theme-dark summary:focus-visible,
body.theme-dark [tabindex]:focus-visible {
    outline: 2px solid var(--cid-orange-deep);
    outline-offset: 2px;
    border-radius: 10px;
}

/* ==========================================================================
   3. Signature surfaces & components
   ========================================================================== */

/* Brand mark — orange gradient tile with a dark glyph and a crisp highlight */
body.theme-dark .brand-mark {
    background-image: var(--cid-grad-orange);
    background-color: var(--cid-orange);
    color: var(--cid-ink) !important;
    border: 1px solid rgba(255, 255, 255, .55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .50),
        0 10px 22px -12px rgba(249, 115, 22, .65);
    letter-spacing: -.02em;
}

/* Top navigation — black bar for contrast against the light page */
body.theme-dark nav {
    background-color: var(--cid-nav) !important;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .06),
        0 14px 30px -26px rgba(11, 15, 20, .75);
}

body.theme-dark nav h1 {
    color: #ffffff;
}

/* Public upload page header — same black bar */
body.theme-dark .app-header {
    background-color: rgba(11, 15, 20, .95) !important;
    color: #f4f7fb;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 12px 28px -26px rgba(11, 15, 20, .85);
}

body.theme-dark .app-header h1,
body.theme-dark .app-header h2,
body.theme-dark .app-header .text-slate-800,
body.theme-dark .app-header .text-slate-900 {
    color: #ffffff;
}

body.theme-dark .app-header .text-slate-400,
body.theme-dark .app-header .text-slate-500 {
    color: #aab4c0;
}

/* Premium hero panel — black with orange glow (contrast to white cards) */
body.theme-dark .hero-panel {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    color: #f4f7fb;
    background-image:
        radial-gradient(120% 150% at 100% 0%, rgba(249, 115, 22, .34), transparent 58%),
        radial-gradient(90% 120% at 0% 100%, rgba(194, 65, 12, .26), transparent 62%),
        linear-gradient(145deg, #161b22 0%, #0b0f14 55%, #05080c 100%);
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

body.theme-dark .hero-panel::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 3px;
    background-image: var(--cid-grad-orange);
    opacity: .95;
}

body.theme-dark .hero-panel h2,
body.theme-dark .hero-panel h3 {
    color: #ffffff;
    letter-spacing: -.02em;
}

/* Auth / installer card — white card, black border, orange top accent */
body.theme-dark .auth-card {
    position: relative;
    background-color: var(--cid-card);
    background-image: none;
    border: 1px solid var(--cid-border-strong);
    border-radius: var(--cid-r-xl);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85), var(--cid-shadow-deep);
}

body.theme-dark .auth-card::before {
    content: "";
    display: block;
    height: 4px;
    background-image: var(--cid-grad-orange);
}

body.theme-dark .auth-head {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    color: #f4f7fb;
    background-color: var(--cid-nav);
    background-image:
        radial-gradient(110% 140% at 80% -30%, rgba(249, 115, 22, .32), transparent 62%),
        linear-gradient(180deg, rgba(255, 255, 255, .05), transparent);
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

body.theme-dark .auth-head h1,
body.theme-dark .auth-head h2,
body.theme-dark .auth-head h3 {
    color: #ffffff;
}

body.theme-dark .auth-head--warn {
    background-image:
        radial-gradient(110% 140% at 80% -30%, rgba(217, 119, 6, .32), transparent 62%),
        linear-gradient(180deg, rgba(255, 255, 255, .05), transparent);
}

/* Upload drop zone */
body.theme-dark .upload-zone {
    background-color: #fbfcfd;
    background-image: radial-gradient(90% 120% at 50% 0%, rgba(249, 115, 22, .09), transparent 65%);
    border: 2px dashed rgba(249, 115, 22, .42);
    border-radius: var(--cid-r-lg);
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
    min-height: 172px;
}

body.theme-dark .upload-zone:hover,
body.theme-dark .upload-zone:focus-within {
    border-color: var(--cid-orange-deep);
    background-color: var(--cid-orange-tint-2);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, .10), inset 0 1px 0 #ffffff;
}

/* Primary page CTA — orange gradient with black text */
body.theme-dark .btn-cta {
    background-image: var(--cid-grad-orange) !important;
    background-color: var(--cid-orange) !important;
    color: var(--cid-ink) !important;
    border: 1px solid rgba(194, 65, 12, .55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .45),
        0 18px 36px -18px rgba(249, 115, 22, .60) !important;
    letter-spacing: .01em;
}

body.theme-dark .btn-cta:hover:not(:disabled) {
    background-image: var(--cid-grad-orange-hover) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .55),
        0 22px 44px -20px rgba(249, 115, 22, .70) !important;
}

body.theme-dark .btn-cta:active:not(:disabled) {
    transform: translateY(1px);
}

body.theme-dark .btn-cta:disabled {
    background-image: none !important;
    background-color: var(--cid-surface-3) !important;
    color: var(--cid-faint) !important;
    border-color: var(--cid-border) !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

/* Installer stepper — inside the black auth header */
body.theme-dark .stepper > span {
    background-color: rgba(255, 255, 255, .10) !important;
    background-image: none !important;
    color: #e8eef5 !important;
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: none !important;
}

body.theme-dark .stepper > span.bg-white {
    background-image: var(--cid-grad-orange) !important;
    background-color: var(--cid-orange) !important;
    color: var(--cid-ink) !important;
    border-color: transparent !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 12px 26px -14px rgba(249, 115, 22, .80) !important;
}

/* ==========================================================================
   4. Surfaces — bg-* overlays
   ========================================================================== */
body.theme-dark .bg-white {
    background-color: var(--cid-card);
    border-color: var(--cid-border-soft);
    box-shadow: var(--cid-shadow-soft);
}

body.theme-dark .bg-white\/95 {
    background-color: rgba(255, 255, 255, .96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

body.theme-dark .bg-white\/70 {
    background-color: rgba(255, 255, 255, .78);
    border: 1px solid rgba(11, 15, 20, .06);
}

body.theme-dark .bg-white\/20 {
    background-color: rgba(255, 255, 255, .16);
}

body.theme-dark .bg-slate-50 {
    background-color: var(--cid-surface);
}

body.theme-dark .bg-slate-100 {
    background-color: var(--cid-surface-2);
}

body.theme-dark .bg-slate-200 {
    background-color: var(--cid-surface-3);
}

body.theme-dark .bg-slate-300 {
    background-color: var(--cid-border);
}

body.theme-dark .bg-slate-700 {
    background-color: #1f2937;
}

body.theme-dark .bg-slate-800 {
    background-color: var(--cid-nav-2);
}

body.theme-dark .bg-slate-900 {
    background-color: var(--cid-nav);
}

body.theme-dark .bg-slate-950 {
    background-color: #05080c;
    color: #e8eef5;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: inset 3px 0 0 0 var(--cid-orange), inset 0 1px 0 rgba(255, 255, 255, .05);
}

body.theme-dark .bg-slate-900\/5 {
    background-color: rgba(11, 15, 20, .04);
}

/* Indigo / blue → orange */
body.theme-dark .bg-indigo-600 {
    background-color: var(--cid-orange);
    background-image: var(--cid-grad-orange);
    color: var(--cid-ink);
    border-color: rgba(194, 65, 12, .45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .40), 0 12px 26px -16px rgba(249, 115, 22, .60);
}

body.theme-dark .bg-indigo-500 {
    background-color: var(--cid-orange);
    background-image: var(--cid-grad-orange);
    color: var(--cid-ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .40), 0 10px 22px -14px rgba(249, 115, 22, .55);
}

body.theme-dark .bg-indigo-500\/20 {
    background-color: rgba(249, 115, 22, .18);
}

body.theme-dark .bg-indigo-100,
body.theme-dark .bg-blue-100 {
    background-color: #ffedd5;
}

body.theme-dark .bg-indigo-50 {
    background-color: var(--cid-orange-tint-2);
}

/* Success */
body.theme-dark .bg-emerald-600 {
    background-color: var(--cid-success);
    background-image: var(--cid-grad-success);
    color: #ffffff;
    border-color: rgba(4, 120, 87, .45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .30), 0 12px 26px -16px rgba(5, 150, 105, .55);
}

body.theme-dark .bg-emerald-100 {
    background-color: #d1fae5;
}

body.theme-dark .bg-emerald-50 {
    background-color: #ecfdf5;
}

body.theme-dark .bg-emerald-900 {
    background-color: rgba(5, 150, 105, .20);
}

body.theme-dark .bg-emerald-950 {
    background-color: rgba(5, 150, 105, .14);
}

/* Danger */
body.theme-dark .bg-rose-600 {
    background-color: var(--cid-danger);
    background-image: none;
    color: #ffffff;
    border: 1px solid rgba(185, 28, 28, .45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 10px 24px -16px rgba(220, 38, 38, .45);
}

body.theme-dark .bg-rose-100 {
    background-color: #fee2e2;
}

body.theme-dark .bg-rose-50 {
    background-color: #fef2f2;
}

body.theme-dark .bg-rose-900 {
    background-color: rgba(220, 38, 38, .22);
}

body.theme-dark .bg-rose-950 {
    background-color: rgba(220, 38, 38, .16);
}

/* Warning */
body.theme-dark .bg-amber-400 {
    background-color: #f59e0b;
    color: #451a03 !important;
}

body.theme-dark .bg-amber-500 {
    background-image: linear-gradient(135deg, #f59e0b, #d97706);
    background-color: var(--cid-warning);
    color: #ffffff !important;
}

body.theme-dark .bg-amber-100 {
    background-color: #fef3c7;
}

body.theme-dark .bg-amber-50 {
    background-color: #fffbeb;
}

body.theme-dark .bg-amber-900 {
    background-color: rgba(217, 119, 6, .20);
}

/* Sky → secondary affordance */
body.theme-dark .bg-sky-500 {
    background-image: var(--cid-grad-orange);
    background-color: var(--cid-orange);
    color: var(--cid-ink) !important;
}

body.theme-dark .bg-sky-600 {
    background-image: none;
    background-color: var(--cid-nav);
    color: #ffffff !important;
    border: 1px solid var(--cid-nav);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
}

body.theme-dark .bg-sky-100 {
    background-color: #ffedd5;
}

body.theme-dark .bg-sky-50 {
    background-color: var(--cid-orange-tint-2);
}

/* Text colour for saturated CTA fills (overrides .text-white) */
body.theme-dark button.bg-indigo-600,
body.theme-dark a.bg-indigo-600,
body.theme-dark input.bg-indigo-600,
body.theme-dark button.bg-sky-500,
body.theme-dark a.bg-sky-500 {
    color: var(--cid-ink) !important;
    font-weight: 800;
}

body.theme-dark button.bg-emerald-600,
body.theme-dark a.bg-emerald-600 {
    color: #ffffff !important;
    font-weight: 800;
}

body.theme-dark button.bg-sky-600,
body.theme-dark a.bg-sky-600 {
    color: #ffffff !important;
    font-weight: 800;
}

body.theme-dark button.bg-rose-600,
body.theme-dark a.bg-rose-600 {
    color: #ffffff !important;
    font-weight: 800;
}

/* Disabled */
body.theme-dark .disabled\:bg-slate-400:disabled {
    background-image: none !important;
    background-color: var(--cid-surface-3) !important;
    color: var(--cid-faint) !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

/* ==========================================================================
   5. Text colours
   ========================================================================== */
/* White by default: nav / hero / auth header rely on it. Saturated fills set
   their own ink colour above, so .text-white never turns white-on-white. */
body.theme-dark .text-white {
    color: #ffffff;
}

body.theme-dark .text-slate-900 {
    color: var(--cid-ink);
}

body.theme-dark .text-slate-800 {
    color: #111827;
}

body.theme-dark .text-slate-700 {
    color: #1f2937;
}

body.theme-dark .text-slate-600 {
    color: #374151;
}

body.theme-dark .text-slate-500 {
    color: var(--cid-muted);
}

body.theme-dark .text-slate-400 {
    color: var(--cid-faint);
}

/* Light ends of the scale are only used inside the black nav/log panels */
body.theme-dark .text-slate-300 {
    color: #c3ccd6;
}

body.theme-dark .text-slate-200 {
    color: #dbe3ec;
}

body.theme-dark .text-slate-100 {
    color: #e8eef5;
}

/* Dark containers keep readable text even without utility classes */
body.theme-dark nav .text-slate-300,
body.theme-dark nav .text-slate-400,
body.theme-dark nav .text-slate-500 {
    color: #9aa6b2;
}

body.theme-dark .bg-slate-950 h1,
body.theme-dark .bg-slate-950 h2,
body.theme-dark .bg-slate-950 h3,
body.theme-dark .bg-slate-950 h4,
body.theme-dark pre {
    color: #f4f7fb;
}

body.theme-dark .bg-slate-950 .text-slate-300,
body.theme-dark .bg-slate-950 .text-slate-400,
body.theme-dark .bg-slate-950 .text-slate-500 {
    color: #a7b3c0;
}

body.theme-dark .bg-slate-950 .text-slate-100,
body.theme-dark .bg-slate-950 .text-slate-200 {
    color: #e8eef5;
}

/* Indigo → orange text scale */
body.theme-dark .text-indigo-100 {
    color: #ffd9c0;
}

body.theme-dark .text-indigo-200 {
    color: #ffc9a3;
}

body.theme-dark .text-indigo-300 {
    color: #ffb27a;
}

body.theme-dark .text-indigo-500 {
    color: var(--cid-orange-deep);
}

body.theme-dark .text-indigo-600 {
    color: var(--cid-orange-deep);
}

body.theme-dark .text-indigo-700 {
    color: var(--cid-orange-dark);
}

body.theme-dark .text-indigo-800 {
    color: #9a3412;
}

body.theme-dark .text-indigo-900 {
    color: #7c2d12;
}

body.theme-dark .text-blue-800,
body.theme-dark .text-sky-700,
body.theme-dark .text-sky-800,
body.theme-dark .text-sky-600 {
    color: var(--cid-orange-dark);
}

/* Success text */
body.theme-dark .text-emerald-600,
body.theme-dark .text-emerald-700 {
    color: var(--cid-success);
}

body.theme-dark .text-emerald-800 {
    color: #047857;
}

body.theme-dark .text-emerald-900 {
    color: #065f46;
}

/* Danger text */
body.theme-dark .text-rose-600,
body.theme-dark .text-rose-700 {
    color: var(--cid-danger);
}

body.theme-dark .text-rose-800 {
    color: #b91c1c;
}

body.theme-dark .text-rose-900 {
    color: #991b1b;
}

/* Warning text */
body.theme-dark .text-amber-50 {
    color: #fef3c7;
}

body.theme-dark .text-amber-600 {
    color: var(--cid-warning);
}

body.theme-dark .text-amber-800 {
    color: #b45309;
}

body.theme-dark .text-amber-900 {
    color: #92400e;
}

body.theme-dark .text-amber-950 {
    color: #451a03;
}

/* ==========================================================================
   6. Borders & dividers
   ========================================================================== */
body.theme-dark .border-slate-100 {
    border-color: #e9edf1;
}

body.theme-dark .border-slate-200 {
    border-color: var(--cid-border);
}

body.theme-dark .border-slate-200\/80 {
    border-color: rgba(213, 219, 226, .85);
}

body.theme-dark .border-slate-300 {
    border-color: var(--cid-border);
}

body.theme-dark .border-slate-700 {
    border-color: #cbd5e1;
}

body.theme-dark nav .border-slate-700,
body.theme-dark .bg-slate-800.border-slate-700 {
    border-color: rgba(255, 255, 255, .16);
}

body.theme-dark .bg-slate-950.border-slate-700 {
    border-color: rgba(255, 255, 255, .14);
}

body.theme-dark .border-white {
    border-color: #ffffff;
}

body.theme-dark .border-indigo-200 {
    border-color: rgba(249, 115, 22, .30);
}

body.theme-dark .border-emerald-200 {
    border-color: rgba(5, 150, 105, .26);
}

body.theme-dark .border-rose-200 {
    border-color: rgba(220, 38, 38, .24);
}

body.theme-dark .border-rose-300 {
    border-color: rgba(220, 38, 38, .40);
}

body.theme-dark .border-amber-200 {
    border-color: rgba(217, 119, 6, .28);
}

body.theme-dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: #e9edf1;
}

body.theme-dark .divide-slate-200 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--cid-border);
}

/* ==========================================================================
   7. Gradients (Tailwind gradient variables)
   ========================================================================== */
body.theme-dark .from-indigo-600,
body.theme-dark .from-indigo-500 {
    --tw-gradient-from: #f97316 var(--tw-gradient-from-position);
    --tw-gradient-to: rgba(249, 115, 22, 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

body.theme-dark .via-indigo-600 {
    --tw-gradient-to: rgba(249, 115, 22, 0);
    --tw-gradient-stops: var(--tw-gradient-from), #ea580c var(--tw-gradient-via-position), var(--tw-gradient-to);
}

body.theme-dark .to-blue-600 {
    --tw-gradient-to: #c2410c var(--tw-gradient-to-position);
}

body.theme-dark .to-blue-500 {
    --tw-gradient-to: #ea580c var(--tw-gradient-to-position);
}

body.theme-dark .from-slate-900 {
    --tw-gradient-from: #eef1f4 var(--tw-gradient-from-position);
    --tw-gradient-to: rgba(238, 241, 244, 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

body.theme-dark .via-slate-800 {
    --tw-gradient-to: rgba(233, 237, 241, 0);
    --tw-gradient-stops: var(--tw-gradient-from), #e9edf1 var(--tw-gradient-via-position), var(--tw-gradient-to);
}

body.theme-dark .to-indigo-950 {
    --tw-gradient-to: #fff1e6 var(--tw-gradient-to-position);
}

body.theme-dark .from-emerald-600 {
    --tw-gradient-from: #059669 var(--tw-gradient-from-position);
    --tw-gradient-to: rgba(5, 150, 105, 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

body.theme-dark .bg-gradient-to-l,
body.theme-dark .bg-gradient-to-r,
body.theme-dark .bg-gradient-to-br,
body.theme-dark .bg-gradient-to-tr {
    background-color: transparent;
}

/* ==========================================================================
   8. Hover states
   ========================================================================== */
body.theme-dark .hover\:bg-slate-50:hover {
    background-color: #f2f5f8;
}

body.theme-dark .hover\:bg-slate-50\/80:hover {
    background-color: rgba(242, 245, 248, .85);
}

body.theme-dark .hover\:bg-slate-100:hover {
    background-color: var(--cid-surface-3);
}

body.theme-dark .hover\:bg-slate-200:hover {
    background-color: #dfe5ea;
}

body.theme-dark .hover\:bg-slate-700:hover {
    background-color: #1f2937;
}

body.theme-dark .hover\:bg-slate-800:hover {
    background-color: var(--cid-nav-2);
}

body.theme-dark .hover\:bg-white:hover {
    background-color: #ffffff;
}

body.theme-dark .hover\:bg-indigo-100:hover {
    background-color: #ffe8d5;
}

body.theme-dark .hover\:bg-indigo-700:hover {
    background-image: var(--cid-grad-orange-hover);
    background-color: var(--cid-orange-light);
    color: var(--cid-ink) !important;
}

body.theme-dark .hover\:bg-emerald-700:hover {
    background-image: linear-gradient(135deg, #059669, #047857);
    background-color: #047857;
    color: #ffffff !important;
}

body.theme-dark .hover\:bg-emerald-200:hover {
    background-color: #a7f3d0;
}

body.theme-dark .hover\:bg-rose-700:hover {
    background-color: #b91c1c;
    color: #ffffff !important;
}

body.theme-dark .hover\:bg-rose-200:hover {
    background-color: #fecaca;
}

body.theme-dark .hover\:bg-amber-200:hover {
    background-color: #fde68a;
}

body.theme-dark .hover\:bg-sky-100:hover {
    background-color: #ffe8d5;
}

body.theme-dark .hover\:bg-sky-200:hover {
    background-color: #ffdcc2;
}

body.theme-dark .hover\:bg-sky-700:hover {
    background-color: #1f2937;
    background-image: none;
}

body.theme-dark .hover\:text-indigo-800:hover {
    color: #9a3412;
}

body.theme-dark .hover\:text-indigo-600:hover {
    color: var(--cid-orange-deep);
}

body.theme-dark .hover\:text-rose-800:hover {
    color: #991b1b;
}

body.theme-dark .hover\:text-emerald-900:hover {
    color: #065f46;
}

body.theme-dark .hover\:text-slate-700:hover {
    color: var(--cid-ink);
}

body.theme-dark .hover\:text-white:hover {
    color: #ffffff;
}

body.theme-dark .hover\:shadow-md:hover {
    box-shadow: 0 1px 2px rgba(11, 15, 20, .05), 0 24px 44px -30px rgba(11, 15, 20, .30);
}

body.theme-dark .hover\:border-indigo-500:hover {
    border-color: var(--cid-orange);
}

/* Shadows tinted by the old palette */
body.theme-dark .shadow-indigo-500\/20 {
    --tw-shadow-color: rgba(249, 115, 22, .22);
}

body.theme-dark .shadow-indigo-500\/25 {
    --tw-shadow-color: rgba(249, 115, 22, .28);
}

body.theme-dark .shadow-indigo-500\/30 {
    --tw-shadow-color: rgba(249, 115, 22, .34);
}

body.theme-dark .shadow-slate-200\/70 {
    --tw-shadow-color: rgba(11, 15, 20, .16);
}

/* ==========================================================================
   9. Focus rings
   ========================================================================== */
body.theme-dark .focus\:ring-indigo-500:focus,
body.theme-dark .focus\:ring-indigo-600:focus {
    --tw-ring-color: rgba(249, 115, 22, .45);
    --tw-ring-offset-color: #ffffff;
    border-color: var(--cid-orange) !important;
}

body.theme-dark .focus\:border-indigo-500:focus {
    border-color: var(--cid-orange) !important;
}

/* ==========================================================================
   10. Forms
   ========================================================================== */
body.theme-dark input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body.theme-dark textarea:not(.bg-slate-950),
body.theme-dark select {
    background-color: #ffffff;
    border: 1px solid var(--cid-border);
    border-radius: var(--cid-r-sm);
    color: var(--cid-ink);
    caret-color: var(--cid-orange);
    box-shadow: 0 1px 2px rgba(11, 15, 20, .03);
    min-height: 44px;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

body.theme-dark textarea {
    min-height: auto;
    line-height: 1.7;
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
    color: var(--cid-faint);
    opacity: 1;
}

body.theme-dark select {
    background-image: none;
    padding-inline-end: 2rem;
}

body.theme-dark select option {
    background-color: #ffffff;
    color: var(--cid-ink);
}

body.theme-dark select option:checked {
    background-color: var(--cid-orange-tint);
    color: var(--cid-ink);
}

body.theme-dark input:focus,
body.theme-dark textarea:focus,
body.theme-dark select:focus {
    border-color: var(--cid-orange) !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .18) !important;
    outline: none !important;
}

body.theme-dark input:disabled,
body.theme-dark textarea:disabled,
body.theme-dark select:disabled {
    background-color: #f2f4f7;
    color: #9aa4af;
    cursor: not-allowed;
}

body.theme-dark input[type="checkbox"],
body.theme-dark input[type="radio"] {
    accent-color: var(--cid-orange);
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
    background-color: #ffffff;
    border: 1px solid var(--cid-border);
}

body.theme-dark input[type="date"],
body.theme-dark input[type="time"] {
    color-scheme: light;
}

/* Danger-tinted inputs keep a red edge */
body.theme-dark input[class*="border-rose"],
body.theme-dark textarea[class*="border-rose"] {
    border-color: rgba(220, 38, 38, .45) !important;
    background-color: #fff7f7;
}

/* File inputs */
body.theme-dark input[type="file"] {
    color: var(--cid-muted);
    padding: .35rem .4rem;
    border: 1px dashed var(--cid-border);
    border-radius: var(--cid-r-sm);
    background-color: #f9fafb;
    max-width: 100%;
}

body.theme-dark input[type="file"]::file-selector-button {
    margin-inline-end: .75rem;
    font-family: var(--cid-font);
}

body.theme-dark .file\:bg-indigo-600::file-selector-button {
    background-image: var(--cid-grad-orange) !important;
    background-color: var(--cid-orange) !important;
    color: var(--cid-ink) !important;
    border: 0;
    border-radius: 10px;
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .40);
}

body.theme-dark .file\:bg-rose-600::file-selector-button {
    background-image: none !important;
    background-color: #fef2f2 !important;
    color: #b91c1c !important;
    border: 1px solid rgba(220, 38, 38, .35);
    border-radius: 10px;
    font-weight: 800;
}

/* Labels */
body.theme-dark label {
    color: var(--cid-ink);
}

/* Dark JSON/body template textarea keeps its terminal look */
body.theme-dark textarea.bg-slate-950 {
    background-color: #05080c;
    color: #e8eef5;
    caret-color: var(--cid-orange-light);
}

/* ==========================================================================
   11. Tables
   ========================================================================== */
body.theme-dark table {
    border-color: var(--cid-border);
}

body.theme-dark thead tr {
    background-color: #f2f5f8 !important;
}

body.theme-dark thead th {
    color: var(--cid-muted) !important;
    font-weight: 800;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--cid-border);
    white-space: nowrap;
}

body.theme-dark tbody td {
    border-bottom: 1px solid #e9edf1;
    color: var(--cid-ink);
    vertical-align: middle;
}

body.theme-dark tbody tr:last-child td {
    border-bottom: 0;
}

body.theme-dark tbody tr {
    transition: background-color .15s ease;
}

body.theme-dark tbody tr:hover {
    background-color: #fff4ea !important;
}

body.theme-dark tbody tr:hover td {
    border-bottom-color: rgba(249, 115, 22, .22);
}

body.theme-dark .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    scrollbar-color: #c3ccd6 transparent;
    border-radius: 12px;
}

/* ==========================================================================
   12. Badges, pills, chips
   ========================================================================== */
body.theme-dark .rounded-full[class*="bg-emerald"],
body.theme-dark .rounded-full[class*="bg-rose"],
body.theme-dark .rounded-full[class*="bg-amber"],
body.theme-dark .rounded-full[class*="bg-slate"],
body.theme-dark .rounded-full[class*="bg-indigo"],
body.theme-dark .rounded-full[class*="bg-sky"] {
    box-shadow: inset 0 0 0 1px rgba(11, 15, 20, .06);
}

/* Selected / active accent — orange inline edge */
body.theme-dark .is-selected,
body.theme-dark .is-active,
body.theme-dark [aria-selected="true"],
body.theme-dark [aria-current="page"] {
    box-shadow: inset 3px 0 0 0 var(--cid-orange), 0 10px 26px -22px rgba(249, 115, 22, .45);
}

/* ==========================================================================
   13. Alerts & notices (inline accent bar)
   ========================================================================== */
body.theme-dark .bg-rose-50.border {
    box-shadow: inset 3px 0 0 0 rgba(220, 38, 38, .70);
}

body.theme-dark .bg-emerald-50.border {
    box-shadow: inset 3px 0 0 0 rgba(5, 150, 105, .70);
}

body.theme-dark .bg-amber-50.border {
    box-shadow: inset 3px 0 0 0 rgba(217, 119, 6, .70);
}

body.theme-dark .bg-indigo-50.border {
    box-shadow: inset 3px 0 0 0 var(--cid-orange);
}

/* ==========================================================================
   14. Tabs
   ========================================================================== */
body.theme-dark .tab-btn {
    color: var(--cid-muted) !important;
    background-color: transparent;
    border: 1px solid transparent;
    transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, border-color .16s ease;
}

body.theme-dark .tab-btn:hover {
    background-color: #f2f5f8 !important;
    color: var(--cid-ink) !important;
    border-color: var(--cid-border-soft);
}

body.theme-dark .tab-btn.active {
    background-color: var(--cid-orange) !important;
    background-image: var(--cid-grad-orange) !important;
    color: var(--cid-ink) !important;
    border-color: transparent !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .40),
        0 12px 26px -16px rgba(249, 115, 22, .65) !important;
}

body.theme-dark .tab-btn.active:hover {
    background-image: var(--cid-grad-orange-hover) !important;
    color: var(--cid-ink) !important;
}

/* ==========================================================================
   15. Progress, shimmer, status
   ========================================================================== */
body.theme-dark .shimmer {
    background-image: linear-gradient(90deg,
            rgba(249, 115, 22, .18) 0%,
            var(--cid-orange-light) 30%,
            #ffd9c0 50%,
            var(--cid-orange-light) 70%,
            rgba(249, 115, 22, .18) 100%) !important;
    background-size: 300% 100% !important;
    animation: cidShimmer 1.5s linear infinite !important;
    box-shadow: 0 0 16px rgba(249, 115, 22, .30);
}

@keyframes cidShimmer {
    0% {
        background-position: 120% 50%;
    }

    100% {
        background-position: -20% 50%;
    }
}

body.theme-dark #uploadProgressBar {
    background-image: var(--cid-grad-orange) !important;
    background-color: var(--cid-orange) !important;
    box-shadow: 0 0 14px rgba(249, 115, 22, .45);
}

body.theme-dark #uploadProgress,
body.theme-dark #statusPanel > div {
    backdrop-filter: blur(6px);
}

body.theme-dark #statusPanel .bg-indigo-500\/20 {
    background-color: rgba(249, 115, 22, .18);
    box-shadow: 0 0 30px rgba(249, 115, 22, .28);
}

/* ==========================================================================
   16. Code & pre
   ========================================================================== */
body.theme-dark code {
    font-family: var(--cid-mono);
    background-color: #f3f5f8;
    border: 1px solid #e2e7ec;
    border-radius: 8px;
    padding: .08em .42em;
    color: var(--cid-orange-dark);
    font-size: .92em;
}

body.theme-dark pre {
    font-family: var(--cid-mono);
    background-color: #0b0f14;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--cid-r-sm);
    padding: 1rem;
    color: #e8eef5;
    overflow-x: auto;
}

body.theme-dark pre code {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
}

body.theme-dark .bg-slate-950 code {
    background-color: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .12);
    color: #ffcfa5;
}

/* ==========================================================================
   17. Company brand + local OCR UI (new upload/admin components)
   ========================================================================== */
body.theme-dark .company-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
}

body.theme-dark .company-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 12px;
    background-color: #ffffff;
    border: 1px solid var(--cid-border);
    padding: 3px;
    box-shadow: 0 6px 16px -12px rgba(11, 15, 20, .45);
}

body.theme-dark .company-name-ar {
    color: var(--cid-ink);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.01em;
}

body.theme-dark .company-name-en {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: right;
    color: var(--cid-muted);
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: .02em;
}

/* On the black nav / hero / auth header the brand text turns light */
body.theme-dark nav .company-name-ar,
body.theme-dark .app-header .company-name-ar,
body.theme-dark .hero-panel .company-name-ar,
body.theme-dark .auth-head .company-name-ar {
    color: #ffffff;
}

body.theme-dark nav .company-name-en,
body.theme-dark .app-header .company-name-en,
body.theme-dark .hero-panel .company-name-en,
body.theme-dark .auth-head .company-name-en {
    color: #aab4c0;
}

body.theme-dark nav .company-logo,
body.theme-dark .app-header .company-logo,
body.theme-dark .hero-panel .company-logo {
    border-color: rgba(255, 255, 255, .20);
    box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .65);
}

/* Small LTR English secondary text on RTL pages */
body.theme-dark .lang-en {
    display: block;
    direction: ltr;
    unicode-bidi: isolate;
    text-align: right;
    color: var(--cid-faint);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: .01em;
}

body.theme-dark .hero-panel .lang-en,
body.theme-dark .auth-head .lang-en,
body.theme-dark .app-header .lang-en {
    color: #aab4c0;
}

/* English-only form field block */
body.theme-dark .field-en {
    direction: ltr;
    text-align: left;
}

body.theme-dark .field-en label {
    text-align: left;
}

body.theme-dark .field-en input,
body.theme-dark .field-en textarea,
body.theme-dark .field-en select {
    direction: ltr;
    text-align: left;
}

body.theme-dark .field-en .lang-en,
body.theme-dark .field-en .company-name-en {
    text-align: left;
}

/* Optional local-OCR panel */
body.theme-dark .ocr-panel {
    background-color: var(--cid-surface);
    background-image: linear-gradient(180deg, #ffffff 0%, var(--cid-surface) 100%);
    border: 1px solid var(--cid-border);
    border-radius: var(--cid-r-lg);
    padding: 1rem 1.1rem;
    color: var(--cid-ink);
    box-shadow: inset 0 1px 0 #ffffff, 0 10px 24px -24px rgba(11, 15, 20, .35);
}

body.theme-dark .ocr-panel h2,
body.theme-dark .ocr-panel h3,
body.theme-dark .ocr-panel h4 {
    color: var(--cid-ink);
}

body.theme-dark .ocr-status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--cid-muted);
}

body.theme-dark .ocr-status.is-success,
body.theme-dark .ocr-status[data-state="success"] {
    color: #047857;
}

body.theme-dark .ocr-status.is-error,
body.theme-dark .ocr-status[data-state="error"] {
    color: #b91c1c;
}

body.theme-dark .ocr-status.is-warning,
body.theme-dark .ocr-status[data-state="warning"] {
    color: #b45309;
}

body.theme-dark .ocr-status.is-busy,
body.theme-dark .ocr-status[data-state="busy"],
body.theme-dark .ocr-status[data-state="info"] {
    color: var(--cid-orange-deep);
}

/* OCR on/off row */
body.theme-dark .ocr-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .9rem;
    padding: .6rem .85rem;
    background-color: #ffffff;
    border: 1px solid var(--cid-border);
    border-radius: var(--cid-r-sm);
    color: var(--cid-ink);
}

/* Toggle switch — works for <label class="switch"><input ...></label> and for
   an input.switch[type="checkbox"] itself. */
body.theme-dark .switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    margin: 0;
    border-radius: 999px;
    background-color: #d5dbe2;
    border: 1px solid #c3ccd6;
    cursor: pointer;
    vertical-align: middle;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color .18s ease, border-color .18s ease;
}

body.theme-dark .switch::after {
    content: "";
    position: absolute;
    top: 2px;
    inset-inline-start: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(11, 15, 20, .28);
    transition: inset-inline-start .18s ease, background-color .18s ease;
    pointer-events: none;
}

body.theme-dark .switch:has(input:checked),
body.theme-dark .switch.is-on,
body.theme-dark .switch[aria-checked="true"] {
    background-color: var(--cid-orange);
    background-image: var(--cid-grad-orange);
    border-color: var(--cid-orange-deep);
}

body.theme-dark .switch:has(input:checked)::after,
body.theme-dark .switch.is-on::after,
body.theme-dark .switch[aria-checked="true"]::after {
    inset-inline-start: 22px;
}

body.theme-dark .switch:has(input:focus-visible),
body.theme-dark .switch:focus-visible {
    outline: 2px solid var(--cid-orange-deep);
    outline-offset: 2px;
}

body.theme-dark .switch:has(input:disabled) {
    opacity: .55;
    cursor: not-allowed;
}

body.theme-dark .switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

/* Checkbox rendered directly as a switch */
body.theme-dark input.switch[type="checkbox"],
body.theme-dark input.switch[type="radio"] {
    position: relative;
    width: 46px;
    height: 26px;
    min-height: 26px;
    padding: 0;
    accent-color: var(--cid-orange);
    background-color: #d5dbe2;
    background-image: none;
    border: 1px solid #c3ccd6;
}

body.theme-dark input.switch[type="checkbox"]::after,
body.theme-dark input.switch[type="radio"]::after {
    content: "";
    position: absolute;
    top: 2px;
    inset-inline-start: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(11, 15, 20, .28);
    transition: inset-inline-start .18s ease;
}

body.theme-dark input.switch[type="checkbox"]:checked,
body.theme-dark input.switch[type="radio"]:checked {
    background-color: var(--cid-orange);
    background-image: var(--cid-grad-orange);
    border-color: var(--cid-orange-deep);
}

body.theme-dark input.switch[type="checkbox"]:checked::after,
body.theme-dark input.switch[type="radio"]:checked::after {
    inset-inline-start: 22px;
}

body.theme-dark input.switch[type="checkbox"]:focus-visible,
body.theme-dark input.switch[type="radio"]:focus-visible {
    outline: 2px solid var(--cid-orange-deep);
    outline-offset: 2px;
}

/* ==========================================================================
   18. Motion — smooth page fade
   ========================================================================== */
@keyframes cidFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.theme-dark main,
body.theme-dark > div {
    animation: cidFadeIn .42s cubic-bezier(.22, .9, .3, 1) both;
}

@media (prefers-reduced-motion: reduce) {

    body.theme-dark *,
    body.theme-dark *::before,
    body.theme-dark *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }

    body.theme-dark main,
    body.theme-dark > div {
        animation: none !important;
    }
}

/* ==========================================================================
   19. Small screens (360px first)
   ========================================================================== */
@media (max-width: 640px) {
    body.theme-dark {
        background-attachment: scroll;
    }

    body.theme-dark button,
    body.theme-dark .tab-btn,
    body.theme-dark a[class*="px-4"][class*="py-2"],
    body.theme-dark a[class*="px-5"],
    body.theme-dark select,
    body.theme-dark textarea {
        min-height: 44px;
    }

    body.theme-dark table a,
    body.theme-dark table button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        padding-inline: .7rem;
    }

    body.theme-dark .auth-card {
        border-radius: var(--cid-r-lg);
    }

    body.theme-dark .hero-panel {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    body.theme-dark .upload-zone {
        min-height: 158px;
    }
}

/* ==========================================================================
   20. Print — keep it readable if someone prints a record
   ========================================================================== */
@media print {
    body.theme-dark {
        background: #fff !important;
        color: #0b0f14 !important;
    }

    body.theme-dark .bg-white,
    body.theme-dark .bg-slate-50,
    body.theme-dark .bg-slate-100,
    body.theme-dark .bg-slate-950,
    body.theme-dark pre,
    body.theme-dark .auth-card {
        background: #fff !important;
        color: #0b0f14 !important;
        box-shadow: none !important;
    }

    body.theme-dark pre,
    body.theme-dark pre code,
    body.theme-dark .bg-slate-950 code {
        border-color: #ccc !important;
        background: #fff !important;
        color: #0b0f14 !important;
    }
}


/* ==========================================================================
   NIGHT MODE (ليلي) - toggled by body.night
   ========================================================================== */
body.theme-dark.night {
    --cid-bg: #0f141a;
    --cid-surface: #151b23;
    --cid-surface-2: #111821;
    --cid-surface-3: #1a2230;
    --cid-card: #151b23;
    --cid-border: #2a3442;
    --cid-border-soft: #223041;
    --cid-border-strong: #f97316;
    --cid-nav: #0b0f14;
    --cid-nav-2: #111827;
    --cid-ink: #f5f7fa;
    --cid-text: #eef2f7;
    --cid-muted: #b8c3d1;
    --cid-faint: #94a3b8;
    --cid-orange: #f97316;
    --cid-orange-light: #fb923c;
    --cid-orange-deep: #ea580c;
    --cid-orange-dark: #c2410c;
    --cid-orange-tint: rgba(249,115,22,.14);
    --cid-orange-tint-2: rgba(249,115,22,.08);
    color-scheme: dark;
    background-color: #0f141a !important;
    background-image:
        radial-gradient(1000px 460px at 90% -12%, rgba(249, 115, 22, .18), transparent 62%),
        radial-gradient(760px 380px at -8% 0%, rgba(249, 115, 22, .10), transparent 58%),
        linear-gradient(180deg, #0f141a 0%, #111821 46%, #0b1118 100%) !important;
    color: #eef2f7;
}
body.theme-dark.night .bg-white,
body.theme-dark.night .bg-slate-50,
body.theme-dark.night .bg-gray-50,
body.theme-dark.night .bg-slate-100 { background-color: #151b23 !important; color: #eef2f7 !important; }
body.theme-dark.night .bg-slate-900 { background-color: #0b0f14 !important; }
body.theme-dark.night .text-slate-800,
body.theme-dark.night .text-slate-700,
body.theme-dark.night .text-slate-900,
body.theme-dark.night .text-gray-700,
body.theme-dark.night .text-gray-800 { color: #eef2f7 !important; }
body.theme-dark.night .text-slate-600,
body.theme-dark.night .text-slate-500,
body.theme-dark.night .text-gray-500,
body.theme-dark.night .text-gray-600 { color: #b8c3d1 !important; }
body.theme-dark.night .border-slate-200,
body.theme-dark.night .border-slate-100,
body.theme-dark.night .border-slate-300,
body.theme-dark.night .border-gray-100,
body.theme-dark.night .border-gray-200 { border-color: #2a3442 !important; }
body.theme-dark.night input,
body.theme-dark.night select,
body.theme-dark.night textarea {
    background-color: #111821 !important;
    color: #eef2f7 !important;
    border-color: #344253 !important;
}
body.theme-dark.night table thead tr { background-color: #111821 !important; }
body.theme-dark.night .hover\:bg-slate-50\/80:hover,
body.theme-dark.night .hover\:bg-slate-50:hover,
body.theme-dark.night .hover\:bg-gray-50:hover { background-color: #1a2230 !important; }
body.theme-dark.night .shadow-sm, body.theme-dark.night .shadow, body.theme-dark.night .shadow-lg, body.theme-dark.night .shadow-xl {
    box-shadow: 0 10px 30px rgba(0,0,0,.35) !important;
}

/* Orange accent touches */
body.theme-dark .accent-orange, body.theme-dark .text-orange-brand { color: var(--cid-orange) !important; }
body.theme-dark .bg-orange-brand { background: var(--cid-grad-orange) !important; color: #111 !important; }
body.theme-dark .border-orange-brand { border-color: var(--cid-orange) !important; }
body.theme-dark .btn-orange {
    background: var(--cid-grad-orange);
    color: #111;
    font-weight: 800;
    border: 1px solid rgba(255,255,255,.2);
    box-shadow: var(--cid-glow-orange);
}
body.theme-dark .btn-orange:hover { filter: brightness(1.03); transform: translateY(-1px); }

/* Theme toggle button */
.theme-toggle-btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem .9rem; border-radius: 12px; font-size: 12px; font-weight: 800;
    border: 1px solid rgba(249,115,22,.35); background: rgba(249,115,22,.10); color: #f97316;
    cursor: pointer; transition: all .2s ease;
}
.theme-toggle-btn:hover { background: rgba(249,115,22,.18); }
body.theme-dark.night .theme-toggle-btn { background: rgba(249,115,22,.16); color: #fb923c; border-color: rgba(251,146,60,.35); }
