/* PensionsAI console: glass dark-first theme (ui_redesign_specification.md) with a matching light theme. */
:root {
  color-scheme: light;
  /* Brand colours; /branding.css overrides these with the values saved in the admin UI. */
  --brand-navy: #02083c;
  --brand-cyan: #00e5ff;
  --brand-sidebar: #02083c;
  --brand-background: #f4f6fa;

  --font-sans: Inter, Geist, 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Geist Mono', ui-monospace, 'Cascadia Code', Consolas, 'Liberation Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;
  --control-height: 36px;
  --control-height-sm: 32px;
  --topbar-height: 64px;
  --sidebar-width: 256px;
  --sidebar-collapsed: 68px;
  --motion-fast: 150ms cubic-bezier(.2, .8, .2, 1);
  --motion-base: 220ms cubic-bezier(.2, .8, .2, 1);

  --canvas: var(--brand-background);
  --canvas-mesh: radial-gradient(60rem 40rem at 100% 0%, color-mix(in srgb, var(--brand-cyan) 9%, transparent), transparent 62%);
  --surface: rgba(255, 255, 255, .82);
  --surface-solid: #ffffff;
  --surface-elevated: rgba(255, 255, 255, .96);
  --surface-recessed: #ffffff;
  --surface-hover: rgba(15, 23, 42, .045);
  --surface-subtle: rgba(15, 23, 42, .025);
  --border: rgba(15, 23, 42, .09);
  --border-strong: #7c8aa1;
  --rim: inset 0 1px 0 0 rgba(255, 255, 255, .9);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 24px -12px rgba(15, 23, 42, .14);
  --shadow-pop: 0 24px 48px -12px rgba(15, 23, 42, .28);
  --text-strong: var(--brand-navy);
  --text-body: #1e293b;
  --text-label: #334155;
  --text-muted: #475569;
  --text-faint: #64748b;
  --accent: var(--brand-navy);
  --accent-hover: color-mix(in srgb, var(--brand-navy) 84%, white);
  --accent-text: #ffffff;
  --accent-glow: 0 1px 2px rgba(15, 23, 42, .18);
  --accent-ring: color-mix(in srgb, var(--brand-navy) 22%, transparent);
  --link: color-mix(in srgb, var(--brand-cyan) 45%, black);
  --link-hover: var(--brand-navy);
  --switch-off: #cbd5e1;
  --topbar-bg: rgba(255, 255, 255, .8);
  --topbar-border: rgba(15, 23, 42, .08);
  --nav-bg: color-mix(in srgb, var(--brand-sidebar) 95%, transparent);
  --nav-border: rgba(255, 255, 255, .06);
  --nav-text: #cbd5e1;
  --nav-text-hover: #f1f5f9;
  --nav-hover: rgba(255, 255, 255, .06);
  --nav-label: #94a3b8;
  --nav-active-bg: color-mix(in srgb, var(--brand-cyan) 13%, transparent);
  --nav-active-text: var(--brand-cyan);

  --success-text: #047857; --success-bg: rgba(16, 185, 129, .1); --success-border: rgba(16, 185, 129, .3); --success-dot: #10b981;
  --warning-text: #92400e; --warning-bg: rgba(245, 158, 11, .12); --warning-border: rgba(245, 158, 11, .35); --warning-dot: #f59e0b;
  --danger-text: #b91c1c; --danger-bg: rgba(239, 68, 68, .09); --danger-border: rgba(239, 68, 68, .3); --danger-dot: #ef4444;
  --info-text: #0369a1; --info-bg: rgba(14, 165, 233, .1); --info-border: rgba(14, 165, 233, .3); --info-dot: #0ea5e9;
  --neutral-text: #475569; --neutral-bg: rgba(100, 116, 139, .1); --neutral-border: rgba(100, 116, 139, .25); --neutral-dot: #94a3b8;
  --dot-glow: 0 0 0 transparent;

  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  --checkbox-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 8.5 2.5 2.5L12 5.5'/%3E%3C/svg%3E");

  font-family: var(--font-sans);
  font-size: 100%;
  line-height: 1.5;
  color: var(--text-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --canvas: #030712;
  --canvas-mesh: radial-gradient(70rem 45rem at 100% 0%, #060b24, transparent 65%), radial-gradient(40rem 28rem at 96% 0%, color-mix(in srgb, var(--brand-cyan) 7%, transparent), transparent 70%);
  --surface: rgba(10, 18, 44, .6);
  --surface-solid: #070e24;
  --surface-elevated: rgba(11, 22, 59, .92);
  --surface-recessed: rgba(2, 5, 18, .7);
  --surface-hover: rgba(255, 255, 255, .05);
  --surface-subtle: rgba(255, 255, 255, .02);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .12);
  --rim: inset 0 1px 0 0 rgba(255, 255, 255, .12);
  --shadow-card: 0 20px 25px -5px rgba(0, 0, 0, .5), 0 8px 10px -6px rgba(0, 0, 0, .5);
  --shadow-pop: 0 30px 60px -12px rgba(0, 0, 0, .7);
  --text-strong: #f1f5f9;
  --text-body: #e2e8f0;
  --text-label: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --accent: var(--brand-cyan);
  --accent-hover: color-mix(in srgb, var(--brand-cyan) 72%, white);
  --accent-text: #030712;
  --accent-glow: 0 0 15px color-mix(in srgb, var(--brand-cyan) 25%, transparent);
  --accent-ring: color-mix(in srgb, var(--brand-cyan) 20%, transparent);
  --link: var(--brand-cyan);
  --link-hover: color-mix(in srgb, var(--brand-cyan) 72%, white);
  --switch-off: #1e293b;
  --topbar-bg: rgba(6, 11, 32, .75);
  --topbar-border: rgba(255, 255, 255, .06);
  --nav-bg: rgba(6, 11, 32, .75);

  --success-text: #6ee7b7; --success-bg: rgba(16, 185, 129, .12); --success-border: rgba(52, 211, 153, .25); --success-dot: #34d399;
  --warning-text: #fcd34d; --warning-bg: rgba(245, 158, 11, .12); --warning-border: rgba(251, 191, 36, .25); --warning-dot: #fbbf24;
  --danger-text: #fca5a5; --danger-bg: rgba(239, 68, 68, .12); --danger-border: rgba(248, 113, 113, .25); --danger-dot: #f87171;
  --info-text: #7dd3fc; --info-bg: rgba(56, 189, 248, .12); --info-border: rgba(56, 189, 248, .25); --info-dot: #38bdf8;
  --neutral-text: #cbd5e1; --neutral-bg: rgba(30, 41, 59, .8); --neutral-border: rgba(51, 65, 85, .6); --neutral-dot: #94a3b8;
  --dot-glow: 0 0 8px currentColor;

  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  --checkbox-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23030712' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 8.5 2.5 2.5L12 5.5'/%3E%3C/svg%3E");
}

/* Base */
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, .28) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border-radius: var(--radius-full); background: rgba(148, 163, 184, .28); }
html { min-width: 320px; min-height: 100%; background: var(--canvas); scroll-padding: calc(var(--topbar-height) + 16px) 0 16px; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas-mesh), var(--canvas); background-attachment: fixed; color: var(--text-body); font-size: .875rem; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; transition: color var(--motion-fast); }
a:hover { color: var(--link-hover); }
p a, .muted a, td a:not(.text-link) { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 1000; transform: translateY(-150%); border-radius: var(--radius-md); background: var(--brand-cyan); color: #030712; padding: 10px 14px; font-weight: 600; }
.skip-link:focus { transform: translateY(0); }
code { padding: 1px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-subtle); font-family: var(--font-mono); font-size: .85em; }
::selection { background: color-mix(in srgb, var(--brand-cyan) 35%, transparent); color: inherit; }

/* App bar */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; min-height: var(--topbar-height); align-items: center; justify-content: space-between; gap: 24px; padding: 0 20px; border-bottom: 1px solid var(--topbar-border); background: var(--topbar-bg); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.topbar-start, .topbar-actions { display: flex; min-width: 0; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 14px; color: var(--text-strong); text-decoration: none; }
.brand:hover { color: var(--text-strong); }
.brand-logo { display: block; width: 130px; height: auto; }
.brand-logo-dark, :root[data-theme='dark'] .brand-logo-light { display: none; }
:root[data-theme='dark'] .brand-logo-dark { display: block; }
.brand-divider, .topbar-divider { width: 1px; height: 24px; background: var(--border); }
.brand-name { display: grid; gap: 2px; font-size: .875rem; font-weight: 600; line-height: 1.1; }
.brand-name small { color: var(--link); font-family: var(--font-mono); font-size: .625rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; opacity: .85; }
.topbar-context { color: var(--text-muted); font-size: .8125rem; }
.command-trigger { display: inline-flex; min-width: 220px; height: var(--control-height-sm); align-items: center; gap: 8px; padding: 0 8px 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-hover); color: var(--text-muted); font-size: .75rem; text-align: left; transition: border-color var(--motion-fast), color var(--motion-fast); }
:root[data-theme='dark'] .command-trigger { border-color: rgba(255, 255, 255, .1); }
.command-trigger:hover { border-color: var(--text-faint); color: var(--text-label); }
.command-trigger > span:first-child { font-size: 1rem; line-height: 1; }
.command-trigger kbd { margin-left: auto; padding: 2px 6px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-hover); color: var(--text-label); font: 500 .625rem var(--font-mono); }
.icon-button { display: inline-grid; width: var(--control-height-sm); height: var(--control-height-sm); flex: 0 0 auto; place-items: center; border: 1px solid transparent; border-radius: var(--radius-md); background: transparent; color: var(--text-label); font-size: 1rem; }
.icon-button:hover { background: var(--surface-hover); color: var(--text-strong); }
.nav-toggle { display: none; }

/* Sidebar */
.shell { display: grid; min-height: calc(100vh - var(--topbar-height)); grid-template-columns: var(--sidebar-width) minmax(0, 1fr); transition: grid-template-columns var(--motion-base); }
.nav-drawer-open { overflow: hidden; }
.shell.nav-collapsed { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }
.sidebar { position: sticky; top: var(--topbar-height); display: flex; height: calc(100vh - var(--topbar-height)); flex-direction: column; padding: 16px 12px 12px; overflow: hidden; border-right: 1px solid var(--nav-border); background: var(--nav-bg); color: var(--nav-text); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); scrollbar-color: rgba(255, 255, 255, .1) transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); }
.sidebar-heading, .nav-section-label { padding: 8px 12px; color: var(--nav-label); font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-heading { margin: 0 0 4px; }
.sidebar-nav { display: grid; min-height: 0; flex: 1 1 auto; align-content: start; gap: 2px; margin: 0 -12px; padding: 0 12px 12px; overflow-x: hidden; overflow-y: auto; scrollbar-color: rgba(255, 255, 255, .1) transparent; }
.nav-collapsed .sidebar-nav { margin: 0 -8px; padding: 0 8px 12px; }
.nav-link { position: relative; display: flex; min-height: var(--control-height); align-items: center; gap: 10px; padding: 0 12px; border-radius: var(--radius-md); color: var(--nav-text); font-size: .875rem; text-decoration: none; white-space: nowrap; transition: background-color var(--motion-fast), color var(--motion-fast); }
.nav-link:hover { background: var(--nav-hover); color: var(--nav-text-hover); }
.nav-link.active { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 500; }
.nav-link.active::before { position: absolute; top: 50%; left: -10px; width: 4px; height: 20px; transform: translateY(-50%); border-radius: var(--radius-full); background: var(--brand-cyan); box-shadow: 0 0 10px var(--brand-cyan); content: ''; }
.nav-link:focus-visible { outline-color: var(--brand-cyan); outline-offset: -2px; }
.nav-icon { display: inline-grid; width: 18px; flex: 0 0 18px; place-items: center; color: currentColor; font-size: 1rem; line-height: 1; opacity: .9; }
.nav-section-label { margin: 16px 0 2px; }
/* The sidebar is dark in both themes, so its footer controls use fixed light-on-dark colours. */
.sidebar-footer { --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); display: grid; gap: 10px; margin-top: auto; padding: 14px 4px 2px; border-top: 1px solid var(--nav-border); }
.sidebar-user { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 0 4px; }
.user-avatar { display: inline-grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: var(--radius-full); background: var(--nav-active-bg); color: var(--nav-active-text); font-size: .75rem; font-weight: 700; letter-spacing: .02em; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-cyan) 35%, transparent); }
.user-name { overflow: hidden; color: var(--nav-text-hover); font-size: .8125rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-controls { display: flex; align-items: center; gap: 6px; }
.sidebar-controls form { margin: 0; }
.theme-control { display: flex; min-width: 0; flex: 1; }
.theme-control select { width: 100%; height: var(--control-height-sm); min-height: 0; padding: 0 28px 0 10px; border: 1px solid var(--nav-border); background-color: rgba(255, 255, 255, .04); background-position: right 8px center; color: var(--nav-text); font-size: .75rem; }
.theme-control select:hover { border-color: rgba(255, 255, 255, .2); }
.theme-control select:focus { border-color: var(--brand-cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-cyan) 25%, transparent); }
.logout-button { display: inline-flex; height: var(--control-height-sm); align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--nav-border); border-radius: var(--radius-md); background: transparent; color: var(--nav-text); font-size: .75rem; font-weight: 500; white-space: nowrap; transition: background-color var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast); }
.logout-button:hover { border-color: rgba(248, 113, 113, .45); background: rgba(239, 68, 68, .14); color: #fca5a5; }
.logout-button:focus-visible { outline-color: var(--brand-cyan); }
.logout-icon { font-size: .875rem; line-height: 1; }
.nav-collapsed .sidebar { padding-right: 8px; padding-left: 8px; }
.nav-collapsed .sidebar-heading, .nav-collapsed .nav-section-label { display: none; }
.nav-collapsed .nav-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.nav-collapsed .nav-link { justify-content: center; padding: 0; }
.nav-collapsed .nav-link.active::before { left: -6px; }
.nav-collapsed .sidebar-footer { justify-items: center; padding-right: 0; padding-left: 0; }
.nav-collapsed .sidebar-user { padding: 0; }
.nav-collapsed .theme-control { display: none; }
.nav-collapsed .logout-button { width: var(--control-height); justify-content: center; padding: 0; }

/* Page layout */
.content { min-width: 0; padding: 32px clamp(16px, 3.5vw, 40px) 64px; }
.content-inner { width: min(100%, 1440px); margin: 0 auto; }
.public-content { display: grid; min-height: calc(100vh - var(--topbar-height)); place-items: center; padding: 24px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading-copy { min-width: 0; }
.page-heading > .status { align-self: flex-start; }
.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; color: var(--text-muted); font-size: .75rem; font-weight: 500; }
h1, h2, h3 { color: var(--text-strong); }
h1 { margin: 0 0 6px; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
h2 { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.35; }
h3 { margin: 0 0 6px; font-size: .875rem; font-weight: 600; }
p { margin: 0 0 12px; line-height: 1.6; }
.page-heading .muted { max-width: 72ch; margin: 0; font-size: .875rem; }
.muted { color: var(--text-muted); }
.small { font-size: .75rem; }
.section-label { color: var(--text-muted); font-size: .6875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* Cards */
.metric, .section, .health-banner, .login-panel, .diagnostics-bar { border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--rim), var(--shadow-card); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.section { min-width: 0; margin-bottom: 24px; padding: 24px; }
.section > p { max-width: 80ch; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.section-heading .muted { margin: 0; font-size: .75rem; }
.section-heading a { font-size: .8125rem; font-weight: 500; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 16px; margin-bottom: 24px; }
.metric { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 20px; border-radius: var(--radius-lg); }
.metric > span, .metric-label { color: var(--text-muted); font-size: .6875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.metric > .small, .metric > .muted, .metric > .metric-trend { font-size: .75rem; font-weight: 400; letter-spacing: 0; text-transform: none; }
.metric strong { color: var(--text-strong); font-size: 1.5rem; font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.metric .status { width: fit-content; font-size: .75rem; letter-spacing: 0; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.card-header h2 { display: flex; align-items: center; gap: 8px; }
.card-subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: .75rem; }
.card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.card-footer .muted { font-size: .75rem; }
.diagnostics-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; padding: 14px 16px 14px 20px; border-radius: var(--radius-lg); }
.diagnostics-status { display: flex; min-width: 0; align-items: center; gap: 12px; color: var(--text-label); font-size: .8125rem; }
.diagnostics-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.beacon { width: 8px; height: 8px; flex: 0 0 8px; border-radius: var(--radius-full); background: var(--info-dot); box-shadow: 0 0 10px var(--info-dot); }
.beacon.healthy { background: var(--success-dot); box-shadow: 0 0 10px var(--success-dot); }
.beacon.warning { background: var(--warning-dot); box-shadow: 0 0 10px var(--warning-dot); }
.beacon.failed { background: var(--danger-dot); box-shadow: 0 0 10px var(--danger-dot); }

/* Buttons */
.primary, .secondary, .ghost, .destructive { display: inline-flex; height: var(--control-height); align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius-md); font-size: .8125rem; font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none; transition: background-color var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast); }
.primary { background: var(--accent); color: var(--accent-text); box-shadow: var(--accent-glow); }
.primary:hover { background: var(--accent-hover); color: var(--accent-text); }
.secondary { border-color: var(--border-strong); background: var(--surface-hover); color: var(--text-body); }
:root[data-theme='dark'] .secondary { border-color: rgba(255, 255, 255, .1); }
.secondary:hover { border-color: var(--text-faint); color: var(--text-strong); }
.ghost { background: transparent; color: var(--text-label); }
.ghost:hover { background: var(--surface-hover); color: var(--text-strong); }
.destructive { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger-text); }
.destructive:hover { background: color-mix(in srgb, var(--danger-dot) 22%, transparent); }
button:disabled, .primary:disabled, .secondary:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; }
.text-button, .text-link { display: inline-flex; min-height: 24px; align-items: center; gap: 4px; padding: 0; border: 0; background: transparent; color: var(--link); font: inherit; font-size: .8125rem; font-weight: 500; text-decoration: none; cursor: pointer; transition: color var(--motion-fast); }
.text-button:hover, .text-link:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }
td.row-actions { white-space: nowrap; }
td.row-actions .text-button + .text-button { margin-left: 14px; }
.text-button.danger-text, .text-button.danger-text:hover { color: var(--danger-text); }
td > .text-link + .text-link { margin-left: 12px; }
.form-actions, .action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.action-row { align-items: end; margin-bottom: 12px; }
.action-row label { flex: 1 1 220px; max-width: 320px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); align-items: end; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .wide, .form-grid .form-span, .form-grid > .form-actions, .form-grid > .action-row, .form-grid > fieldset { grid-column: 1 / -1; }
label, .field { display: grid; gap: 6px; color: var(--text-label); font-size: .75rem; font-weight: 500; line-height: 1.35; }
.field-label { color: var(--text-label); font-size: .75rem; font-weight: 500; }
.field-hint { margin: 8px 0 0; }
input, select, textarea { width: 100%; height: var(--control-height); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background-color: var(--surface-recessed); color: var(--text-body); font-size: .8125rem; font-weight: 400; transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background-color var(--motion-fast); }
:root[data-theme='dark'] :is(input, select, textarea) { border-color: rgba(255, 255, 255, .1); }
textarea { height: auto; min-height: 112px; padding: 10px 12px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--text-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
input::placeholder, textarea::placeholder { color: var(--text-faint); opacity: 1; }
select { appearance: none; padding-right: 34px; background-image: var(--select-chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; cursor: pointer; }
select option { background: var(--surface-solid); color: var(--text-body); }
/* Styled dropdown lists where the browser supports customizable selects; others keep the native list. */
@supports (appearance: base-select) {
  select, ::picker(select) { appearance: base-select; }
  select { display: flex; align-items: center; gap: 8px; padding-right: 10px; background-image: none; }
  select::picker-icon { width: 16px; height: 16px; margin-left: auto; background: var(--select-chevron) center / 16px no-repeat; color: transparent; content: ''; transition: rotate var(--motion-fast); }
  select:open::picker-icon { rotate: 180deg; }
  select:open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
  ::picker(select) { margin-block: 6px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-elevated); color: var(--text-body); box-shadow: var(--rim), var(--shadow-pop); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); opacity: 0; transform: translateY(-4px); transition: opacity var(--motion-fast), transform var(--motion-fast), overlay var(--motion-fast) allow-discrete, display var(--motion-fast) allow-discrete; }
  ::picker(select):popover-open { opacity: 1; transform: translateY(0); }
  @starting-style { ::picker(select):popover-open { opacity: 0; transform: translateY(-4px); } }
  select option { display: flex; min-height: 32px; align-items: center; gap: 8px; padding: 0 10px; border-radius: var(--radius-md); background: transparent; color: var(--text-body); font-size: .8125rem; cursor: pointer; }
  select option:hover, select option:focus-visible { background: var(--surface-hover); color: var(--text-strong); outline: none; }
  select option:checked { color: var(--link); font-weight: 500; }
  select option::checkmark { order: 1; margin-left: auto; color: var(--link); content: '✓'; }
  .theme-control select { padding-right: 8px; }
}
.mono-input, .colour-inputs input:not([type='color']) { font-family: var(--font-mono); font-size: .75rem; letter-spacing: -.01em; }
.input-affix { position: relative; display: block; }
.input-affix input { padding-right: 64px; }
.copy-button { position: absolute; top: 50%; right: 6px; height: 24px; padding: 0 8px; transform: translateY(-50%); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-hover); color: var(--text-muted); font-family: var(--font-mono); font-size: .6875rem; transition: color var(--motion-fast), border-color var(--motion-fast); }
.copy-button:hover { border-color: var(--accent); color: var(--link); }
input[type='checkbox'], input[type='radio'] { width: 16px; height: 16px; min-height: 16px; flex: 0 0 16px; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
input[type='checkbox'] { appearance: none; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-recessed); }
input[type='checkbox']:checked { border-color: var(--accent); background: var(--accent) var(--checkbox-tick) center / 14px no-repeat; }
:root[data-theme='dark'] input[type='checkbox']:not([role='switch']):not(:checked) { border-color: #64748b; }
input[type='checkbox'][role='switch'] { width: 36px; height: 20px; min-height: 20px; flex: 0 0 36px; border: 0; border-radius: var(--radius-full); background: radial-gradient(circle at 10px 50%, #ffffff 7px, transparent 7.5px) no-repeat var(--switch-off); transition: background-color var(--motion-fast), box-shadow var(--motion-fast); }
input[type='checkbox'][role='switch']:checked { background: radial-gradient(circle at 26px 50%, #ffffff 7px, transparent 7.5px) no-repeat var(--accent); box-shadow: var(--accent-glow); }
:root[data-theme='dark'] input[type='checkbox'][role='switch']:checked { box-shadow: 0 0 12px color-mix(in srgb, var(--brand-cyan) 40%, transparent); }
input[type='checkbox']:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; }
.switch { display: inline-flex; height: var(--control-height); align-items: center; gap: 10px; color: var(--text-body); font-size: .8125rem; font-weight: 400; cursor: pointer; }
input[type='file'] { height: auto; padding: 8px 12px; }
input[type='color'] { width: 48px; height: var(--control-height); flex: 0 0 48px; padding: 3px; cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .55; }
input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true'] { border-color: var(--danger-dot); box-shadow: 0 0 0 3px var(--danger-bg); }
fieldset { min-width: 0; margin: 0; padding: 12px 16px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
legend { padding: 0 6px; color: var(--text-label); font-size: .75rem; font-weight: 600; }
.stack { display: grid; gap: 16px; margin-top: 20px; }
.check-row { display: inline-flex; min-height: 28px; align-items: center; gap: 10px; color: var(--text-body); font-size: .8125rem; font-weight: 400; cursor: pointer; }
.check-group { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.permission-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 16px; }
.permission-grid .check-row { font-family: var(--font-mono); font-size: .75rem; }
form + .table-wrap { margin-top: 20px; }

/* Messages */
.alert, .inline-alert, .validation-meta { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--neutral-border); border-radius: var(--radius-md); background: var(--neutral-bg); color: var(--neutral-text); font-size: .8125rem; line-height: 1.5; }
.alert { margin-top: 12px; }
.alert.error, .inline-alert, .validation-meta.failed { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger-text); }
.validation-meta.healthy { border-color: var(--success-border); background: var(--success-bg); color: var(--success-text); }
.validation-meta.warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }

/* Status pills always pair the coloured dot with a text label. */
.status { --dot: var(--neutral-dot); display: inline-flex; min-height: 22px; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid var(--neutral-border); border-radius: var(--radius-full); background: var(--neutral-bg); color: var(--neutral-text); font-size: .75rem; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.status::before { width: 6px; height: 6px; flex: 0 0 6px; border-radius: var(--radius-full); background: var(--dot); box-shadow: 0 0 6px color-mix(in srgb, var(--dot) 70%, transparent); content: ''; }
.status.healthy, .status.succeeded, .status.success, .status.completed { --dot: var(--success-dot); border-color: var(--success-border); background: var(--success-bg); color: var(--success-text); }
.status.queued, .status.running, .status.processing, .status.uploading, .status.info { --dot: var(--info-dot); border-color: var(--info-border); background: var(--info-bg); color: var(--info-text); }
.status.degraded, .status.warning { --dot: var(--warning-dot); border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }
.status.unhealthy, .status.failed, .status.failure, .status.stalled { --dot: var(--danger-dot); border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger-text); }
.status.untested { --dot: var(--warning-dot); }
.status-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 8px; border-radius: var(--radius-full); background: var(--neutral-dot); }
.status-dot.healthy { background: var(--success-dot); box-shadow: 0 0 8px var(--success-dot); }
.status-dot.degraded { background: var(--warning-dot); box-shadow: 0 0 8px var(--warning-dot); }
.status-dot.unhealthy { background: var(--danger-dot); box-shadow: 0 0 8px var(--danger-dot); }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-subtle); }
table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-solid); color: var(--text-muted); font-size: .6875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
:root[data-theme='dark'] th { background: #081030; }
td { color: var(--text-body); font-size: .8125rem; line-height: 1.45; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color var(--motion-fast); }
tbody tr:hover td { background: var(--surface-hover); }
.mono { font-family: var(--font-mono); font-size: .75rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.empty { padding: 32px 16px; color: var(--text-muted); text-align: center; }

/* Health */
.health-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; padding: 14px 20px; border-radius: var(--radius-lg); }
.health-list { display: grid; }
.health-list > div { display: grid; grid-template-columns: auto minmax(140px, .7fr) minmax(220px, 2fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.health-list > div:last-child, .health-card:last-child { border-bottom: 0; }
.health-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.health-card > div { display: flex; align-items: center; gap: 10px; }
.health-card p, .health-card dl { grid-column: 1 / -1; margin: 0; }
.health-card p { color: var(--text-muted); }
.health-card dl { display: grid; grid-template-columns: minmax(140px, .35fr) minmax(0, 1fr); gap: 4px 16px; font-size: .8125rem; }
.health-card dt { color: var(--text-muted); }
.health-card dd { margin: 0; font-family: var(--font-mono); font-size: .75rem; overflow-wrap: anywhere; }

/* Sign-in */
.login-panel { width: min(420px, 100%); padding: 32px; }
.login-panel h1 { margin-bottom: 6px; }
.login-panel .primary { width: 100%; margin-top: 4px; }

/* Sign-in scene: a fixed dark palette, independent of the console theme and admin branding. */
.auth-page {
  --auth-base: #01040d;
  --auth-mesh: #012f3d;
  --auth-neon: #00e5ff;
  --auth-button: #00dfff;
  --auth-mint: #e6fffa;
  --auth-steel: #8fb2cc;
  --auth-muted: #a6a6a6;
  --auth-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
  background: var(--auth-base);
  color: #ffffff;
}
.auth-page::after { position: fixed; inset: 0; z-index: 1; background: var(--auth-grain); opacity: .015; pointer-events: none; content: ''; }
.auth-page .topbar { display: none; }
.auth-page .public-content { position: relative; z-index: 2; min-height: 100vh; padding: 32px 20px; }
.auth-backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: radial-gradient(38vw 38vw at 94% 6%, rgba(0, 229, 255, .07), transparent 70%), radial-gradient(34vw 34vw at 4% 98%, rgba(0, 229, 255, .05), transparent 70%), var(--auth-base); pointer-events: none; }
.auth-backdrop::before, .auth-backdrop::after { position: absolute; inset: -3%; background: url("brand/neural-mesh.svg") center / cover no-repeat; content: ''; }
/* The 12px-blurred copy gives the mesh depth; the lightly softened copy keeps its structure legible. */
.auth-backdrop::before { filter: blur(12px); transform: scale(1.04); }
.auth-backdrop::after { filter: blur(.6px); }
.auth-card { position: relative; display: flex; width: clamp(340px, 23.5vw, 600px); max-width: 100%; aspect-ratio: 6 / 7; flex-direction: column; justify-content: center; padding: 20px clamp(28px, 2.6vw, 64px) clamp(28px, 2.4vw, 56px); border: 1.5px solid var(--auth-neon); border-radius: 14px; background: rgba(6, 22, 36, .6); -webkit-backdrop-filter: blur(24px) saturate(130%); backdrop-filter: blur(24px) saturate(130%); box-shadow: 0 0 80px color-mix(in srgb, var(--auth-neon) 30%, transparent), 0 0 22px color-mix(in srgb, var(--auth-neon) 24%, transparent), inset 0 0 28px color-mix(in srgb, var(--auth-neon) 8%, transparent), inset 0 1px 0 rgba(255, 255, 255, .12); color: #ffffff; }
.auth-logo { display: block; width: clamp(92px, 4.6vw, 124px); height: auto; margin: 0 0 clamp(22px, 2vw, 44px); }
.auth-title { width: fit-content; margin: 0 0 6px; background: linear-gradient(100deg, #ffffff 0%, #ffffff 25%, #a8f5ff 65%, var(--auth-neon) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: clamp(1.625rem, 1.55vw, 2.375rem); font-weight: 600; letter-spacing: -.015em; line-height: 1.15; }
.auth-description { margin: 0 0 clamp(18px, 2vw, 44px); color: var(--auth-muted); font-size: clamp(.8125rem, .6vw, 1rem); }
.auth-card .alert.error { border-color: rgba(255, 107, 129, .5); background: rgba(255, 77, 109, .12); color: #ffc2cc; }
.auth-form { display: grid; gap: clamp(6px, .4vw, 10px); }
.auth-form label { display: block; margin-top: clamp(10px, .9vw, 22px); color: #ffffff; font-size: clamp(.75rem, .55vw, .9375rem); font-weight: 600; }
.auth-form label:first-child { margin-top: 0; }
.auth-form input { height: clamp(40px, 2.6vw, 56px); border: 1px solid color-mix(in srgb, var(--auth-neon) 30%, transparent); border-radius: var(--radius-md); background: #020914; box-shadow: inset 0 2px 8px rgba(0, 0, 0, .65); color: #ffffff; font-size: clamp(.875rem, .62vw, 1.0625rem); }
.auth-form input:hover { border-color: color-mix(in srgb, var(--auth-neon) 55%, transparent); }
.auth-form input:focus { border-color: var(--auth-neon); box-shadow: inset 0 2px 8px rgba(0, 0, 0, .65), 0 0 0 1px var(--auth-neon), 0 0 16px color-mix(in srgb, var(--auth-neon) 35%, transparent); }
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-toggle { position: absolute; top: 50%; right: 6px; display: inline-grid; width: 32px; height: 32px; place-items: center; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--auth-muted); transform: translateY(-50%); transition: color var(--motion-fast); }
.password-toggle:hover, .password-toggle[aria-pressed='true'] { color: var(--auth-neon); }
.password-toggle-slash { display: none; }
.password-toggle[aria-pressed='true'] .password-toggle-slash { display: inline; }
.auth-submit { height: clamp(42px, 2.8vw, 60px); margin-top: clamp(20px, 2vw, 44px); border: 0; border-radius: var(--radius-md); background: linear-gradient(90deg, var(--auth-button) 0%, var(--auth-mint) 100%); box-shadow: 0 0 15px var(--auth-button); color: var(--auth-base); font-size: clamp(.9375rem, .7vw, 1.125rem); font-weight: 700; transition: box-shadow var(--motion-fast), filter var(--motion-fast); }
.auth-submit:hover { box-shadow: 0 0 24px var(--auth-button); filter: brightness(1.06); }
.auth-submit:active { filter: brightness(.96); }
.auth-card :focus-visible { outline: 2px solid #ffffff; outline-offset: 3px; }
.auth-form input:focus-visible { outline: none; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; margin-top: clamp(16px, 1.6vw, 36px); }
.auth-link { padding: 2px 0; border: 0; background: none; color: var(--auth-muted); font-size: clamp(.75rem, .55vw, .9375rem); }
.auth-link:hover, .auth-link[aria-expanded='true'] { color: var(--auth-mint); text-decoration: underline; text-underline-offset: 3px; }
.auth-help { margin: 12px 0 0; color: var(--auth-muted); font-size: .75rem; line-height: 1.5; text-align: center; }
.auth-providers { display: grid; gap: 10px; }
/* Without the password form the fixed 6:7 card is mostly empty, so size it to its content. */
.auth-card.sso-only { aspect-ratio: auto; padding-top: clamp(32px, 2.6vw, 56px); padding-bottom: clamp(32px, 2.6vw, 56px); }
.auth-card.sso-only .auth-description { margin-bottom: clamp(24px, 2.2vw, 40px); }
.auth-provider { display: flex; height: clamp(42px, 2.8vw, 60px); align-items: center; justify-content: center; padding: 0 16px; border: 1px solid var(--auth-neon); border-radius: var(--radius-md); background: color-mix(in srgb, var(--auth-neon) 8%, transparent); color: #ffffff; font-size: clamp(.875rem, .66vw, 1.0625rem); font-weight: 600; text-align: center; transition: background-color var(--motion-fast), box-shadow var(--motion-fast); }
.auth-provider:hover { background: color-mix(in srgb, var(--auth-neon) 16%, transparent); box-shadow: 0 0 14px color-mix(in srgb, var(--auth-neon) 45%, transparent); color: #ffffff; }
.auth-providers.primary-only .auth-provider { border: 0; background: linear-gradient(90deg, var(--auth-button) 0%, var(--auth-mint) 100%); box-shadow: 0 0 15px var(--auth-button); color: var(--auth-base); font-weight: 700; }
.auth-providers.primary-only .auth-provider:hover { box-shadow: 0 0 24px var(--auth-button); filter: brightness(1.06); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: clamp(18px, 1.6vw, 32px) 0 clamp(12px, 1.2vw, 24px); color: var(--auth-muted); font-size: .75rem; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; background: color-mix(in srgb, var(--auth-neon) 25%, transparent); content: ''; }
@media (max-width: 480px) {
  .auth-card { width: 100%; aspect-ratio: auto; padding: 24px 22px 28px; }
}
@media (forced-colors: active) { .auth-title { background: none; color: CanvasText; } .auth-card { border-color: CanvasText; } }

/* Files and uploads */
.output-actions { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.file-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 20px; }
.file-filters label { flex: 1 1 180px; }
.file-filters label:first-child { flex: 2 1 280px; }
.upload-section { padding: 24px; }
.client-picker { max-width: 320px; margin-bottom: 20px; }
.client-required { max-width: 520px; margin-top: -8px; }
.upload-dropzone { position: relative; display: grid; min-height: 220px; place-content: center; justify-items: center; gap: 10px; padding: 24px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-xl); background: var(--surface-subtle); color: var(--text-muted); font-size: .8125rem; font-weight: 400; text-align: center; cursor: pointer; transition: border-color var(--motion-fast), background-color var(--motion-fast), box-shadow var(--motion-fast); }
:root[data-theme='dark'] .upload-dropzone { border-color: rgba(255, 255, 255, .15); }
.upload-dropzone:hover, .upload-dropzone.drag-active { border-color: var(--accent); background: color-mix(in srgb, var(--brand-cyan) 6%, transparent); box-shadow: var(--accent-glow); }
.upload-dropzone input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.upload-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: var(--radius-lg); background: var(--accent); color: var(--accent-text); font-size: 1.25rem; box-shadow: var(--accent-glow); }
.upload-dropzone strong { color: var(--text-strong); font-size: .9375rem; font-weight: 600; }
.upload-dropzone + .secondary { margin-top: 12px; }
.upload-queue-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.upload-queue { display: grid; }
.upload-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.upload-file-info { display: grid; flex: 1; min-width: 0; gap: 4px; }
.upload-file-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.upload-file-title strong { max-width: 100%; color: var(--text-strong); font-weight: 500; overflow-wrap: anywhere; }
.upload-file-status { margin: 0; color: var(--text-muted); font-size: .75rem; }
.upload-file-info .page-progress { width: 100%; max-width: 520px; }
.upload-row-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.upload-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.file-error-panel { border-color: var(--danger-border); }
.file-error-detail { max-height: 320px; margin: 12px 0; padding: 14px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-recessed); color: var(--text-body); font: .75rem/1.6 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.file-error-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Storage */
.storage-grid { display: grid; grid-template-columns: 1fr; align-items: stretch; gap: 24px; margin-bottom: 24px; }
.storage-card { display: flex; height: 100%; flex-direction: column; margin-bottom: 0; }
.storage-card .card-footer { margin-top: auto; }
.validation-panel { margin-top: 16px; }
.validation-steps { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.validation-step { display: grid; grid-template-columns: 18px 140px minmax(0, 1fr) 72px; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-subtle); font-size: .75rem; }
.validation-step.success .step-state { color: var(--success-text); }
.validation-step.warning .step-state { color: var(--warning-text); }
.validation-step.failed .step-state { color: var(--danger-text); }
.step-state, .step-label { font-weight: 600; }
.step-message { color: var(--text-muted); }
.step-duration { color: var(--text-faint); font-family: var(--font-mono); font-size: .6875rem; text-align: right; }

/* Progress */
.progress-label { display: block; margin-bottom: 4px; color: var(--text-muted); font-size: .75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.page-progress { display: block; width: min(100%, 160px); height: 6px; overflow: hidden; border: 0; border-radius: var(--radius-full); appearance: none; background: var(--surface-hover); accent-color: var(--accent); }
.page-progress::-webkit-progress-bar { border-radius: var(--radius-full); background: var(--surface-hover); }
.page-progress::-webkit-progress-value { border-radius: var(--radius-full); background: var(--accent); box-shadow: var(--accent-glow); transition: width var(--motion-base); }
.page-progress::-moz-progress-bar { border-radius: var(--radius-full); background: var(--accent); }

/* Live updates */
.live-indicator { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: .75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-dot { position: relative; width: 8px; height: 8px; flex: 0 0 8px; border-radius: var(--radius-full); background: var(--neutral-dot); }
.live-indicator[data-state='live'] .live-dot { background: var(--success-dot); box-shadow: 0 0 8px var(--success-dot); }
.live-indicator[data-state='live'] .live-dot::after { position: absolute; inset: -4px; border: 1px solid var(--success-dot); border-radius: inherit; content: ''; animation: live-ping 2s ease-out infinite; }
.live-indicator[data-state='error'] .live-dot { background: var(--warning-dot); }
.live-indicator[data-state='idle'] .live-dot { background: var(--info-dot); }
@keyframes live-ping { from { opacity: .8; transform: scale(.6); } to { opacity: 0; transform: scale(1.6); } }
.page-heading-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row-progress { display: grid; gap: 4px; margin-top: 6px; }
.row-progress .page-progress { width: min(100%, 140px); }
.row-progress span { color: var(--text-muted); font-size: .6875rem; }
.metric-trend { color: var(--text-muted); font-size: .75rem; }

/* Reports */
.metric-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .metric-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .metric-grid-4 { grid-template-columns: 1fr; } }
.report-filters .switch { align-self: end; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 0; padding: 0; color: var(--text-muted); font-size: .75rem; list-style: none; }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend li::before { width: 10px; height: 10px; border-radius: 3px; background: var(--swatch); content: ''; }
.bar-chart { display: grid; height: 200px; grid-auto-columns: minmax(3px, 1fr); grid-auto-flow: column; align-items: end; gap: 3px; padding-top: 8px; border-bottom: 1px solid var(--border); }
.bar { display: flex; height: 100%; flex-direction: column-reverse; justify-content: flex-start; border-radius: 4px 4px 0 0; overflow: hidden; }
.bar:hover { filter: brightness(1.15); }
.bar-segment { width: 100%; min-height: 0; }
.bar-segment.completed { background: var(--success-dot); }
.bar-segment.failed { background: var(--danger-dot); }
.bar-segment.other { background: var(--info-dot); }
.chart-legend .completed { --swatch: var(--success-dot); }
.chart-legend .failed { --swatch: var(--danger-dot); }
.chart-legend .other { --swatch: var(--info-dot); }
.chart-axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--text-faint); font-family: var(--font-mono); font-size: .6875rem; }
.share-bar { display: block; width: 100%; min-width: 60px; height: 6px; margin-top: 4px; overflow: hidden; border-radius: var(--radius-full); background: var(--surface-hover); }
.share-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.numeric { font-variant-numeric: tabular-nums; text-align: right; }
th.numeric { text-align: right; }

/* Review blades: panels open to the right as the user drills into a result. */
.review-heading { margin-bottom: 12px; }
.content-inner:has(.review-layout) { width: 100%; }
.content:has(.review-layout) { padding-bottom: 20px; }
@media (min-width: 1101px) {
  .content:has(.review-layout) { display: flex; height: calc(100dvh - var(--topbar-height)); }
  .content-inner:has(.review-layout) { display: flex; min-height: 0; flex-direction: column; }
}
.blade-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 28px; margin-bottom: 12px; color: var(--text-muted); font-size: .75rem; }
.blade-crumb { padding: 2px 6px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--link); font-size: .75rem; font-weight: 500; }
.blade-crumb:hover { background: var(--surface-hover); }
.blade-crumb[aria-current='location'] { color: var(--text-strong); font-weight: 600; }
.blade-crumb-separator { color: var(--text-faint); }
.review-layout { display: grid; min-height: 420px; flex: 1 1 auto; grid-template-columns: minmax(360px, 1fr) fit-content(calc(100% - 376px)); grid-template-rows: minmax(0, 1fr); gap: 16px; }
.review-layout.document-maximised { grid-template-columns: minmax(0, 1fr) minmax(0, 320px); }
.review-document { display: flex; min-width: 0; }
.review-document .blade { width: 100%; }
.blade-host { display: flex; min-width: 0; gap: 16px; padding-bottom: 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
.blade { display: flex; width: 380px; flex: 0 0 auto; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--rim), var(--shadow-card); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); scroll-snap-align: start; animation: blade-in var(--motion-base) both; }
.blade-detail { width: 420px; }
.blade-restore { display: none; }
.blade.blade-collapsed { width: 48px; scroll-snap-align: none; }
.blade-collapsed > .blade-header, .blade-collapsed > .blade-body { display: none; }
.blade-collapsed > .blade-restore { display: flex; min-height: 0; flex: 1; align-items: center; justify-content: flex-start; padding: 16px 0; border: 0; background: transparent; color: var(--text-strong); font-size: .8125rem; font-weight: 600; writing-mode: vertical-rl; cursor: pointer; }
.blade-collapsed > .blade-restore span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blade-collapsed > .blade-restore:hover { background: var(--surface-hover); }
.blade-collapsed > .blade-restore:focus-visible { outline-offset: -4px; }
.blade.maximised { width: max(60%, 560px); }
@keyframes blade-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
.blade-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 12px 12px 18px; border-bottom: 1px solid var(--border); }
.blade-heading { min-width: 0; }
.blade-title { overflow: hidden; font-size: .9375rem; text-overflow: ellipsis; white-space: nowrap; }
.blade-title:focus { outline: none; }
.blade-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.blade-subtitle { margin: 2px 0 0; overflow: hidden; color: var(--text-muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.blade-actions { display: flex; flex: 0 0 auto; gap: 2px; }
.blade-body { display: grid; flex: 1; align-content: start; gap: 12px; padding: 16px 18px; overflow-y: auto; }
.blade-body-flush { display: flex; padding: 0; }
.blade-frame { width: 100%; min-height: 0; flex: 1; border: 0; background: #ffffff; }
.blade-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.blade-stats div { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-subtle); }
.blade-stats dt { color: var(--text-muted); font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.blade-stats dd { margin: 4px 0 0; color: var(--text-strong); font-size: 1.125rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.blade-meter { width: 100%; }
.blade-section-label { margin: 8px 0 -4px; color: var(--text-muted); font-size: .6875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.blade-list { display: grid; gap: 4px; }
.blade-item { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto 12px; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-md); background: var(--surface-subtle); color: var(--text-body); text-align: left; transition: background-color var(--motion-fast), border-color var(--motion-fast); }
.blade-item:hover:not(:disabled) { border-color: var(--border); background: var(--surface-hover); }
.blade-item[aria-current='true'] { border-color: color-mix(in srgb, var(--brand-cyan) 40%, transparent); background: var(--nav-active-bg); }
.blade-item:disabled { cursor: default; opacity: .5; }
.blade-item-text { display: grid; min-width: 0; gap: 2px; }
.blade-item-text strong { overflow: hidden; color: var(--text-strong); font-size: .8125rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.field-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blade-count { color: var(--text-muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.blade-chevron { color: var(--text-faint); font-size: 1rem; }
.detail-value { position: relative; padding: 14px 64px 14px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-recessed); color: var(--text-strong); font-size: 1rem; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.detail-copy { top: 14px; transform: none; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--text-muted); font-size: .75rem; }
.detail-list dd { margin: 0; font-size: .8125rem; overflow-wrap: anywhere; }
.detail-confidence { display: grid; justify-items: start; gap: 6px; }
.page-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.page-chip { height: 28px; padding: 0 10px; font-size: .75rem; }
.detail-nav { display: flex; justify-content: space-between; gap: 8px; padding-top: 4px; }
@media (max-width: 1100px) {
  .review-layout, .review-layout.document-maximised { height: auto; grid-template-columns: 1fr; grid-template-rows: 70vh 70vh; }
}
@media (max-width: 760px) {
  .blade-host { scroll-snap-type: x mandatory; }
  .blade, .blade-detail, .blade.maximised { width: calc(100vw - 40px); }
  .blade-stats { grid-template-columns: 1fr; }
}

/* Brand colours */
.colour-grid { align-items: start; }
.colour-field { display: grid; align-content: start; gap: 6px; }
.colour-field p { margin: 0; }
.colour-inputs { display: flex; gap: 8px; }
.contrast-checks { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.contrast-checks li { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: .8125rem; }

/* Command palette and toasts */
.command-dialog { width: min(560px, calc(100vw - 32px)); max-height: min(620px, calc(100dvh - 48px)); padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface-elevated); color: var(--text-body); box-shadow: var(--rim), var(--shadow-pop); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.command-dialog::backdrop { background: rgba(3, 7, 18, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.command-search { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.command-search input { min-width: 0; border: 0; background: transparent; font-size: .875rem; }
.command-search input:focus { box-shadow: none; }
.command-links { display: grid; gap: 2px; max-height: 420px; padding: 8px; overflow: auto; }
.command-links a { display: flex; min-height: 36px; align-items: center; padding: 0 12px; border-radius: var(--radius-md); color: var(--text-body); font-size: .8125rem; }
.command-links a:hover, .command-links a:focus-visible { background: var(--surface-hover); color: var(--text-strong); }
.command-links a:focus-visible { outline-offset: -2px; }
.command-hint { margin: 0; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .6875rem; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; width: min(380px, calc(100vw - 32px)); gap: 8px; }
.toast { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-elevated); color: var(--text-body); font-size: .8125rem; box-shadow: var(--rim), var(--shadow-pop); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); animation: toast-in var(--motion-base) both; }
.toast-success { border-color: var(--success-border); }
.toast-error { border-color: var(--danger-border); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (min-width: 1280px) { .storage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  :root { --sidebar-width: 236px; }
  .content { padding-right: 20px; padding-left: 20px; }
}
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .nav-toggle { display: inline-grid; font-size: 1.25rem; }
  .topbar-context, .topbar-divider, .command-trigger kbd { display: none; }
  .brand-logo { width: 110px; }
  .command-trigger { width: var(--control-height-sm); min-width: var(--control-height-sm); justify-content: center; padding: 0; }
  .command-trigger > span:not(:first-child) { display: none; }
  .shell { display: block; }
  .sidebar { position: fixed; top: var(--topbar-height); bottom: 0; left: 0; z-index: 60; width: min(288px, 84vw); height: auto; transform: translateX(-102%); background: color-mix(in srgb, var(--brand-sidebar) 98%, transparent); transition: transform var(--motion-base); }
  :root[data-theme='dark'] .sidebar { background: rgba(6, 11, 32, .97); }
  .shell.nav-open .sidebar { transform: translateX(0); }
  .sidebar-scrim:not([hidden]) { position: fixed; inset: var(--topbar-height) 0 0; z-index: 50; display: block; background: rgba(3, 7, 18, .55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .content { padding: 20px 12px 48px; }
  .page-heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-heading > button, .page-heading > .primary, .page-heading > .secondary { width: 100%; }
  .section { padding: 16px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .health-list > div { grid-template-columns: auto minmax(0, 1fr) auto; }
  .health-list > div > span:nth-child(3) { grid-column: 2 / -1; }
}
@media (max-width: 600px) { .upload-row { align-items: flex-start; } .upload-row-actions { flex-direction: column; } }
@media (max-width: 480px) {
  .brand-divider, .brand-name { display: none; }
  .metric strong { font-size: 1.25rem; }
  .card-header, .section-heading { align-items: flex-start; }
  .validation-step { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .step-message { grid-column: 2 / -1; }
  .step-duration { grid-column: 3; grid-row: 1; }
  .health-card dl { grid-template-columns: 1fr; gap: 2px; }
  .health-card dd { margin-bottom: 8px; }
}
/* Keep form text at 16px on touch devices so mobile browsers do not zoom on focus. */
@media (pointer: coarse) { input, select, textarea { font-size: 1rem; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
  .topbar, .sidebar, .skip-link, .command-dialog, .toast-region, .page-heading > button, .diagnostics-actions { display: none !important; }
  .shell { display: block; }
  body, .content { background: #ffffff; color: #000000; }
  .section, .metric, .health-banner, .diagnostics-bar { box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; break-inside: avoid; }
  thead { display: table-header-group; }
}
