/* AXIOM Command. Dark by default, light on request; AA contrast in both. No external assets. */
:root {
  --fx-black-0: #050506; --fx-black-1: #0b0c0e; --fx-black-2: #141518; --fx-line: rgba(255,255,255,0.10);
  --fx-ink: #f4f3ef; --fx-ink-2: #c9c7c0; --fx-ink-quiet: #a8a59d;
  --fx-orange: #ff7a1a; --fx-orange-2: #ff9447; --fx-orange-ink: #170900;
  --fx-red: #ff5a4f; --fx-red-deep: #b3201a; --fx-green: #33d17a;
  --fx-glass-bg: linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.04));
  --fx-glass-border: rgba(255,255,255,0.22); --fx-glass-edge-orange: rgba(255,122,26,0.55);
  --fx-glass-blur: 18px; --fx-glass-highlight: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -1px 0 rgba(0,0,0,0.5);
  --fx-shadow: 0 18px 50px rgba(0,0,0,0.55); --fx-radius: 14px;
  --fx-font-display: "Segoe UI Variable Display", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --fx-font-label: "Cascadia Mono", "SFMono-Regular", ui-monospace, monospace;
  --bg: var(--fx-black-0); --surface: var(--fx-black-1); --surface-2: var(--fx-black-2);
  --line: var(--fx-line); --line-strong: rgba(255,255,255,0.22);
  --text: var(--fx-ink); --muted: var(--fx-ink-quiet);
  --accent: var(--fx-orange); --accent-ink: var(--fx-orange-ink); --focus: var(--fx-orange);
  --ok: var(--fx-green); --bad: var(--fx-red); --warn: var(--fx-orange); --info: var(--fx-orange); --neutral: var(--fx-ink-2);
  --ok-bg: rgba(51,209,122,.14); --bad-bg: rgba(255,90,79,.14); --warn-bg: rgba(255,122,26,.14); --info-bg: rgba(255,122,26,.12); --neutral-bg: rgba(201,199,192,.12);
  --radius: var(--fx-radius); --gap: clamp(12px, 1.2vw, 24px);
  --font: var(--fx-font-display); --mono: var(--fx-font-label);
  color-scheme: dark;
}
}
@media (prefers-contrast: more) { :root { --line: var(--line-strong); --muted: var(--text); } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: clamp(14px, 0.35vw + 12px, 20px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.5 var(--font); min-height: 100vh; overflow-x: hidden; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.05rem; } h3 { font-size: 1rem; }
.mono { font-family: var(--mono); font-size: .9em; overflow-wrap: anywhere; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.pre { white-space: pre-wrap; font-family: var(--mono); font-size: .85rem; overflow-wrap: anywhere; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: var(--radius); z-index: 100; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
kbd { font-family: var(--mono); font-size: .75rem; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--muted); }

/* Buttons and inputs: 44px minimum targets on coarse pointers, 32px on fine. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 4px 12px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-quiet { background: transparent; border-color: transparent; }
.btn-link { background: none; border: none; color: var(--accent); text-decoration: underline; padding: 4px 0; }
.btn-block { width: 100%; margin-top: 16px; min-height: 40px; }
.btn[disabled] { opacity: .6; cursor: progress; }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 10px; min-height: 36px; max-width: 100%; }
@media (pointer: coarse) { .btn, input, select { min-height: 44px; } .grid-select tbody tr { min-height: 44px; } }

/* Boot and login */
.boot { display: flex; gap: 10px; align-items: center; justify-content: center; min-height: 100vh; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 4vw, 32px); }
.login-card label { display: block; margin-top: 14px; margin-bottom: 4px; font-weight: 600; }
.login-card input { width: 100%; }
.form-msg:empty { display: none; }
.form-msg { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--bad-bg); color: var(--text); border-left: 4px solid var(--bad); }
.form-msg.info { background: var(--info-bg); border-left-color: var(--info); }
.form-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; letter-spacing: .02em; }
.login .brand { font-size: 1.4rem; margin-bottom: 6px; }
/* brand-mark overridden below */

/* Shell: top bar, section rail, content grid */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "top top" "rail main"; min-height: 100vh; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px var(--gap); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.who { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.conn { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.conn.offline, .conn.error { color: var(--bad); font-weight: 600; }
.conn.stale { color: var(--warn); font-weight: 600; }
.rail { grid-area: rail; border-right: 1px solid var(--line); padding: var(--gap) 8px; position: sticky; top: 56px; align-self: start; }
.rail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rail a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); color: var(--text); text-decoration: none; min-height: 40px; }
.rail a:hover, .rail a[aria-current="true"] { background: var(--surface-2); }
.count { margin-left: auto; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.hot { color: var(--accent-ink); background: var(--warn); border-radius: 999px; padding: 0 8px; font-weight: 700; }
.content { grid-area: main; padding: var(--gap); display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-content: start; min-width: 0; }
@media (min-width: 1200px) {
  .content { grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.6fr); grid-template-areas: "actions services" "work work" "agents agents"; }
  .panel-actions { grid-area: actions; } .panel-services { grid-area: services; } .panel-work { grid-area: work; } .panel-agents { grid-area: agents; }
}
@media (min-width: 2400px) {
  .content { grid-template-columns: minmax(380px, 0.7fr) minmax(0, 1.5fr) minmax(0, 1fr); grid-template-areas: "actions services agents" "work work work"; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "rail" "main"; }
  .rail { position: static; border-right: none; border-bottom: 1px solid var(--line); padding: 6px 8px; }
  .rail ul { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); overflow-x: auto; }
  .rail a { justify-content: center; font-size: .85rem; padding: 6px; }
  .rail a kbd { display: none; }
}
@media (max-width: 560px) { .rail a .label-long { display: none; } .topbar .btn-quiet kbd { display: none; } .content { padding: 12px; } }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.panel:focus { outline: none; }
.panel:focus-visible { outline: 3px solid var(--focus); }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-meta { margin-left: auto; color: var(--muted); font-size: .85rem; }
.panel-body { padding: 12px 16px; min-width: 0; }
.panel.is-stale .panel-body { opacity: .75; }
.toolbar { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.toolbar input { width: min(260px, 100%); }
.skeleton { height: 96px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* States */
.state { padding: 18px; border-radius: var(--radius); border: 1px dashed var(--line-strong); }
.state p { margin: 4px 0; } .state-title { font-weight: 600; }
.state-error { border-style: solid; border-color: var(--bad); background: var(--bad-bg); }
.note { margin: 0 0 10px; padding: 8px 12px; border-radius: var(--radius); background: var(--info-bg); font-size: .9rem; }
.note-warn { background: var(--warn-bg); border-left: 4px solid var(--warn); }

/* Badges: colour plus shape plus text, never colour alone */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.badge .shape { width: 8px; height: 8px; background: currentColor; flex: none; }
.t-ok { color: var(--ok); background: var(--ok-bg); } .t-ok .shape { border-radius: 50%; }
.t-bad { color: var(--bad); background: var(--bad-bg); } .t-bad .shape { transform: rotate(45deg); }
.t-warn { color: var(--warn); background: var(--warn-bg); } .t-warn .shape { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.t-info { color: var(--info); background: var(--info-bg); } .t-info .shape { border-radius: 2px; }
.t-neutral { color: var(--neutral); background: var(--neutral-bg); } .t-neutral .shape { background: transparent; border: 2px solid currentColor; border-radius: 50%; }

/* Data grids: tables on wide screens, labelled stacks on narrow ones (no horizontal page scroll) */
.grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
.grid th, .grid td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); position: sticky; top: 0; background: var(--surface); }
.grid tbody th { font-weight: 600; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid .detail { color: var(--muted); overflow-wrap: anywhere; max-width: 40ch; }
.group-row th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.svc-name, .task-title { display: block; }
.svc-target { display: block; color: var(--muted); font-weight: 400; font-size: .78rem; }
.grid-select tbody tr { cursor: pointer; }
.grid-select tbody tr:hover { background: var(--surface-2); }
.grid-select tbody tr[aria-selected="true"] { background: var(--info-bg); box-shadow: inset 3px 0 0 var(--accent); }
.grid-select tbody tr:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
@media (max-width: 760px) {
  .grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .grid, .grid tbody, .grid tr, .grid th, .grid td { display: block; width: 100%; }
  .grid tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .grid th, .grid td { border: none; padding: 3px 4px; }
  .grid td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8rem; }
  .grid .num { text-align: left; }
  .grid .detail { max-width: none; }
  .group-row th { margin-top: 6px; }
}

/* Work split: list plus detail pane */
.work-split { display: grid; grid-template-columns: minmax(0, 1fr); }
.work-split.has-detail { grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); }
.detail-pane { border-left: 1px solid var(--line); padding: 12px 16px; background: var(--surface-2); min-width: 0; }
.detail-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.detail-title { margin-bottom: 10px; overflow-wrap: anywhere; }
@media (max-width: 1000px) { .work-split.has-detail { grid-template-columns: minmax(0, 1fr); } .detail-pane { border-left: none; border-top: 1px solid var(--line); } }

/* Key-value lists and actions */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 8px 0; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 420px) { .kv { grid-template-columns: minmax(0, 1fr); } .kv dd { margin-bottom: 6px; } }
.actions { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.action { border: 1px solid var(--line); border-left: 4px solid var(--info); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); }
.action[data-urgency="now"] { border-left-color: var(--bad); } .action[data-urgency="today"] { border-left-color: var(--warn); }
.action-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action-title { font-size: 1rem; overflow-wrap: anywhere; }
.action-why { margin: 6px 0; }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 12px; padding: 20px; max-width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.55); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .badge, .btn, .panel, .action { border: 1px solid CanvasText; } .badge .shape { forced-color-adjust: none; background: CanvasText; } :focus-visible { outline: 3px solid Highlight; } }


/* Founder glass + canvas */
.fx-body, body { position: relative; isolation: isolate; }
.fx-canvas {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 18% 22%, rgba(255,122,26,0.22), transparent 55%),
    radial-gradient(ellipse 55% 45% at 82% 78%, rgba(179,32,26,0.28), transparent 60%),
    radial-gradient(ellipse 40% 35% at 60% 30%, rgba(255,90,79,0.12), transparent 50%),
    linear-gradient(180deg, #050506 0%, #0b0c0e 100%);
}
.fx-canvas::after {
  content: ""; position: absolute; inset: 0; opacity: 0.35;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}
.fx-glass {
  background: var(--fx-black-2);
  border: 1px solid var(--fx-glass-border);
  border-radius: var(--fx-radius);
  box-shadow: var(--fx-glass-highlight), var(--fx-shadow);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .fx-glass {
    background: var(--fx-glass-bg);
    -webkit-backdrop-filter: blur(var(--fx-glass-blur)) saturate(1.3);
    backdrop-filter: blur(var(--fx-glass-blur)) saturate(1.3);
  }
}
.fx-glass--edge { border-color: var(--fx-glass-edge-orange); }
.brand-accent { color: var(--fx-orange); }
.brand-mark {
  width: 18px; height: 18px; flex: none; border: none; border-radius: 0; transform: none;
  background:
    linear-gradient(135deg, transparent 42%, var(--fx-orange) 42%, var(--fx-orange) 58%, transparent 58%),
    linear-gradient(45deg, transparent 42%, var(--fx-red) 42%, var(--fx-red) 58%, transparent 58%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  box-shadow: 0 0 0 1px rgba(255,122,26,0.35);
}
.btn-primary { background: var(--fx-orange); border-color: var(--fx-orange); color: var(--fx-orange-ink); }
.btn-primary:hover { background: var(--fx-orange-2); border-color: var(--fx-orange-2); }
.btn-secondary { background: transparent; border-color: var(--fx-glass-edge-orange); color: var(--fx-ink); }
.spinner { border-color: rgba(255,255,255,0.12); border-top-color: var(--fx-orange); }
.first-time { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--fx-line); display: grid; gap: 8px; }
@media (prefers-reduced-motion: reduce) {
  .fx-canvas { background: #050506; }
  .fx-canvas::after { display: none; }
}
