/* DarkControl dark themes: Midnight (deep navy) and Lights off (true black). Loaded after every other console stylesheet.
   theme.js sets html[data-theme="dark"] for both, plus data-theme-variant="midnight" | "lightsoff".
   1. html[data-theme="dark"]                                   Midnight tokens (also the fallback for a bare data-theme="dark")
   2. html[data-theme="dark"][data-theme-variant="lightsoff"]   Lights off overrides: neutral black and grey, same accent
   3. High contrast for both, then component rules that only exist where a light-only colour had no token.
   The accent is a muted steel blue (#82a7d9, 2026-11-15 owner decision; was periwinkle #8b9dff) in both dark themes;
   green stays a status colour (success) only. Contrast numbers for the new accent: console UI audit, "WP1 done".
   Contrast numbers: /opt/darkcontrol/backups/staging-redesign-20261111/design-system/REPORT.md. */

/* ── 1. Midnight ─────────────────────────────────────────────────────────── */
html[data-theme="dark"] {
    color-scheme: dark;
    --brand: #e7ebf4;
    --brand-2: #c3cadb;
    --accent: #82a7d9;
    --accent-hover: #9dbbe3;
    --accent-press: #6d93c8;
    --accent-subtle: rgba(130, 167, 217, .14);
    --accent-ring: rgba(130, 167, 217, .36);
    --accent-border: rgba(130, 167, 217, .4);
    --accent-text: #b3cbea;
    --focus-ring: #93b4e0;
    --success: #4cc98a;
    --success-hover: #72d8a4;
    --success-subtle: rgba(76, 201, 138, .13);
    --success-ring: rgba(76, 201, 138, .28);
    --success-border: rgba(76, 201, 138, .36);
    --danger: #ff8b8b;
    --danger-hover: #ffaaaa;
    --danger-subtle: rgba(255, 128, 128, .13);
    --danger-ring: rgba(255, 128, 128, .28);
    --danger-border: rgba(255, 128, 128, .38);
    --warning: #eab95c;
    --warning-subtle: rgba(234, 185, 92, .13);
    --warning-ring: rgba(234, 185, 92, .28);
    --warning-border: rgba(234, 185, 92, .36);
    --info: #6fc3ef;
    --info-subtle: rgba(111, 195, 239, .13);
    --info-border: rgba(111, 195, 239, .36);
    --bg-app: #070b16;
    --bg-sunken: #060914;
    --bg-surface: #0c1222;
    --bg-subtle: #0f1628;
    --bg-elevated: #141c31;
    --bg-hover: #18213a;
    --bg-overlay: rgba(2, 4, 12, .72);
    --sidebar-bg: #090e1b;
    --topbar-bg: rgba(8, 12, 24, .94);
    --mobile-nav-bg: rgba(10, 15, 29, .96);
    --popover-glass: rgba(20, 28, 49, .96);
    --text-primary: #e7ebf4;
    --text: #e7ebf4;
    --text-secondary: #b3bcd0;
    --text-muted: #919bb3;
    --text-placeholder: #8a94ad;
    --text-disabled: #687290;
    --text-inverse: #070b16;
    --text-on-solid: #070b16;
    --border: #1e2842;
    --border-strong: #2c3756;
    --border-hover: #4b5a7e;
    --border-control: #5c6a8e;
    --border-control-hover: #7d8aad;
    --divider: #172037;
    --nav-label: #8b95ae;
    --scrollbar: #2c3756;
    --avatar-border: rgba(130, 167, 217, .38);
    --avatar-text: #b3cbea;
    --avatar-bg: rgba(130, 167, 217, .12);
    --env-border: rgba(234, 185, 92, .42);
    --env-text: #eccb82;
    --env-bg: rgba(234, 185, 92, .12);
    --service-text: #bfcde3;
    --service-bg: rgba(130, 167, 217, .12);
    --offline-border: rgba(234, 185, 92, .42);
    --offline-text: #eccb82;
    --offline-strong: #f4dda6;
    --offline-bg: rgba(234, 185, 92, .12);
    --crumb-sep: #6f7a96;
    --chart-grid: #1e2842;
    --table-scroll-shadow: rgba(0, 0, 0, .9);
    --badge-allow-text: #8ee6b8;
    --badge-deny-text: #ffb1b1;
    --badge-ask-text: #efcd86;
    --tooltip-bg: #e7ebf4;
    --tooltip-text: #0c1222;
    --hero-bg: var(--bg-surface);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, .45);
    --shadow-md: 0 12px 30px rgba(0, 0, 0, .55);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .7);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-card-hover: 0 4px 14px rgba(0, 0, 0, .5);
    --shadow-inset-top: inset 0 1px 0 rgba(255, 255, 255, .04);
    /* Charts: a categorical set that keeps clear of the accent and the status hues where it can */
    --series-6: #c493fb; --series-7: #f17bbf; --series-8: #f59a52;
    --cat-network: #c493fb; --cat-privilege: #6fc3ef;
    /* Workflows */
    --wf-trigger: #82a7d9; --wf-trigger-subtle: rgba(130, 167, 217, .14);
    --wf-condition: #eab95c; --wf-condition-subtle: rgba(234, 185, 92, .13);
    --wf-action: #6fc3ef; --wf-action-subtle: rgba(111, 195, 239, .13);
    --wf-danger: #ff8b8b; --wf-danger-subtle: rgba(255, 128, 128, .13);
    --wf-yes: #4cc98a; --wf-no: #ff8b8b;
    --wf-dot: #222c48; --wf-edge: #5a6789; --wf-canvas-bg: #060914;
    /* AI tool colours (audit C5; Light values in v2.css). Shared by Midnight and Lights off: each is >= 4.37:1 on
       --bg-surface in both. Neutral categorical hues, never a status colour or the accent. */
    --tool-claudecode: #9aa6ff; --tool-codex: #3fc1c4; --tool-antigravity: #b794ff; --tool-opencode: #6cb4ec;
    --tool-cursor: #f07ab8; --tool-grokbuild: #a3adbb; --tool-copilot: #cfa77e; --tool-openclaw: #717b8c;
}

/* ── 2. Lights off ───────────────────────────────────────────────────────── */
html[data-theme="dark"][data-theme-variant="lightsoff"] {
    --brand: #ededee;
    --brand-2: #c6c6ca;
    --accent-subtle: rgba(130, 167, 217, .13);
    --bg-app: #000000;
    --bg-sunken: #000000;
    --bg-surface: #0a0a0b;
    --bg-subtle: #0f0f10;
    --bg-elevated: #151516;
    --bg-hover: #1b1b1d;
    --bg-overlay: rgba(0, 0, 0, .78);
    --sidebar-bg: #050505;
    --topbar-bg: rgba(0, 0, 0, .92);
    --mobile-nav-bg: rgba(10, 10, 11, .96);
    --popover-glass: rgba(21, 21, 22, .97);
    --text-primary: #ededee;
    --text: #ededee;
    --text-secondary: #b6b6ba;
    --text-muted: #939398;
    --text-placeholder: #8c8c92;
    --text-disabled: #67676c;
    --text-inverse: #000000;
    --text-on-solid: #000000;
    --border: #222224;
    --border-strong: #303033;
    --border-hover: #505055;
    --border-control: #646469;
    --border-control-hover: #86868c;
    --divider: #19191b;
    --nav-label: #8e8e94;
    --scrollbar: #303033;
    --service-text: #c8c8cc;
    --service-bg: rgba(255, 255, 255, .07);
    --crumb-sep: #717177;
    --chart-grid: #222224;
    --table-scroll-shadow: rgba(0, 0, 0, 1);
    --tooltip-bg: #ededee;
    --tooltip-text: #0a0a0b;
    --hero-bg: var(--bg-surface);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .6);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, .7);
    --shadow-md: 0 12px 30px rgba(0, 0, 0, .8);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .9);
    --shadow-card: none;
    --shadow-card-hover: 0 4px 14px rgba(0, 0, 0, .8);
    --shadow-inset-top: inset 0 1px 0 rgba(255, 255, 255, .05);
    --wf-dot: #232325; --wf-edge: #5c5c62; --wf-canvas-bg: #000000;
}

/* ── 3. High contrast (Settings or the device), same selector weight as style.css so this file wins ── */
:root[data-theme="dark"][data-contrast="1"] { --border: #56638a; --border-strong: #75819f; --border-control: #8d98b6; --divider: #3a4566; --text-muted: #c3cadb; --text-secondary: #d8dde9; --nav-label: #d8dde9; --crumb-sep: #c3cadb; }
:root[data-theme="dark"][data-theme-variant="lightsoff"][data-contrast="1"] { --border: #5e5e64; --border-strong: #7c7c83; --border-control: #9a9aa1; --divider: #404044; --text-muted: #c8c8cd; --text-secondary: #dcdce0; --nav-label: #dcdce0; --crumb-sep: #c8c8cd; }

html[data-theme="dark"] body { background: var(--bg-app); color: var(--text-primary); }
html[data-theme="dark"] .v2-sidebar { background: var(--sidebar-bg); }
html[data-theme="dark"] .v2-nav-item:hover { background: var(--bg-hover); }

/* Native controls follow the theme */
html[data-theme="dark"] select.form-control,
html[data-theme="dark"] select { background-color: var(--bg-surface); color: var(--text-primary); }
html[data-theme="dark"] option { background: var(--bg-elevated); color: var(--text-primary); }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--text-placeholder); opacity: 1; }
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.85); }
html[data-theme="dark"] code,
html[data-theme="dark"] pre,
html[data-theme="dark"] kbd { background-color: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-strong); }

/* Solid destructive and primary buttons */
html[data-theme="dark"] body.v2-console .btn-danger,
html[data-theme="dark"] .btn-danger { background: var(--danger); border-color: var(--danger); color: var(--text-on-solid); }
html[data-theme="dark"] body.v2-console .btn-danger:hover,
html[data-theme="dark"] .btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: var(--text-on-solid); }
html[data-theme="dark"] .btn-success { color: var(--text-on-solid); }
html[data-theme="dark"] .btn-success:hover { background: var(--success-hover); border-color: var(--success-hover); }
html[data-theme="dark"] .seg-btn.active,
html[data-theme="dark"] .seg-btn.is-active,
html[data-theme="dark"] .seg-control button.active { color: var(--text-primary); }
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-primary:hover { color: var(--text-on-solid); }
html[data-theme="dark"] .hbar-fill.danger { background: var(--danger); }
html[data-theme="dark"] .hbar-fill.success { background: var(--success); }
html[data-theme="dark"] .hbar-fill.warning { background: var(--warning); }

/* Licence: licence.css is fully tokenised (E-16); only these two still need a dark value. */
html[data-theme="dark"] .lic-feat { border-top-color: var(--divider); }
html[data-theme="dark"] .lic-notice--preview { border-color: var(--info-border); }

/* Workflows canvas */
html[data-theme="dark"] .wf-canvas { background-color: var(--wf-canvas-bg); }
html[data-theme="dark"] .wf-guide-banner,
html[data-theme="dark"] .wf-guide-head { background: var(--bg-subtle); }
html[data-theme="dark"] .wf-page .wf-tick.quiet { background: var(--border-strong); }
html[data-theme="dark"] .wf-hint,
html[data-theme="dark"] [data-wf-tip]::after { background: var(--bg-hover); color: var(--text-primary); }

/* Compact logo plate so the shield keeps its edge on dark surfaces */
html[data-theme="dark"] .v2-brand img,
html[data-theme="dark"] .v2-auth-brand img { filter: drop-shadow(0 0 1px rgba(255, 255, 255, .55)); }

/* Decorative or small numerals dimmed with opacity on the light theme */
html[data-theme="dark"] .v2-breadcrumbs .sep { opacity: 1; }

/* Phone side-menu backdrop had a green-black tint */
html[data-theme="dark"] .dc-side-backdrop { background: var(--bg-overlay); }

/* Lights off: the sign-in page stays black (no hero background in any theme since 2026-11-15). */
html[data-theme-variant="lightsoff"] .v2-auth-main.has-hero { background: none; }
