/* ──────────────────────────────────────────────────────────────────────
   Kairospex design tokens — completed palette derived from the brand kit.

   Official brand colors (brand README, do not drift):
     Ink   #101A2B   primary / text on light, base surface on dark
     Gold  #E2A53C   "the seized moment" — THE single most important
                     action on a screen, and nothing else
     Teal  #2BB6A4   everything interactive / live / "Kai working"
     Slate #6B7686   secondary text
     Paper #F5F2EA   light surface

   Completion (Kairospex extensions, dark-first console):
     ink scale for layered dark surfaces, slate tints for hierarchy,
     semantic colors tuned to harmonize with gold/teal without competing:
     danger is a warm clay red, warning a deep amber clearly darker than
     Kairos gold so gold keeps its meaning.
   ────────────────────────────────────────────────────────────────────── */

:root {
  /* brand */
  --ink: #101a2b;
  --gold: #e2a53c;
  --teal: #2bb6a4;
  --slate: #6b7686;
  --paper: #f5f2ea;

  /* ink scale (dark surfaces, low → high elevation) */
  --ink-950: #0a111d;
  --ink-900: #0d1524;
  --ink-800: #101a2b;
  --ink-700: #17233a;
  --ink-600: #213149;
  --line: #283751;          /* hairline borders on ink */

  /* text on ink */
  --text: var(--paper);
  --text-dim: #aeb6c2;      /* slate tinted toward paper */
  --text-faint: #6b7686;

  /* interaction */
  --teal-hover: #25a091;
  --teal-wash: rgba(43, 182, 164, 0.12);
  --gold-hover: #d3972f;
  --gold-wash: rgba(226, 165, 60, 0.14);

  /* semantic */
  --ok: var(--teal);
  --warn: #b97a22;          /* deep amber — never confusable with gold */
  --danger: #d25b4e;        /* warm clay red */
  --danger-wash: rgba(210, 91, 78, 0.12);

  /* type & rhythm */
  --font-ui: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --gap: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink-950);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
}

/* ── shell ─────────────────────────────────────────────────────────── */

header.shell {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: var(--ink-900);
  border-bottom: 1px solid var(--line);
}
header.shell img.mark { height: 30px; }
header.shell .title { font-weight: 600; letter-spacing: 0.01em; }
header.shell .title small {
  display: block; font-weight: 400; color: var(--text-faint); font-size: 12px;
}
header.shell .spacer { flex: 1; }
header.shell .live {
  font-size: 12px; color: var(--teal); display: flex; align-items: center; gap: 6px;
}
header.shell .live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal); box-shadow: 0 0 6px var(--teal);
}

nav.tabs {
  display: flex; gap: 4px; padding: 10px 22px 0;
  background: var(--ink-900); border-bottom: 1px solid var(--line);
}
nav.tabs button {
  appearance: none; border: 0; background: transparent;
  color: var(--text-dim); font: inherit; padding: 8px 14px 10px;
  cursor: pointer; border-bottom: 2px solid transparent;
}
nav.tabs button:hover { color: var(--text); }
nav.tabs button.active {
  color: var(--teal); border-bottom-color: var(--teal); font-weight: 600;
}
nav.tabs button .count {
  background: var(--teal-wash); color: var(--teal);
  border-radius: 999px; padding: 0 8px; font-size: 12px; margin-left: 6px;
}

main {
  padding: 32px 24px; max-width: 920px; margin: 0 auto;
}

/* ── cards & lists ─────────────────────────────────────────────────── */

.card {
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: var(--gap);
}
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card .meta {
  color: var(--text-faint); font-size: 12.5px;
  display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px;
}
.card .meta .mono { font-family: var(--font-mono); }

.trace {
  background: var(--ink-900); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--text-dim); padding: 10px 12px; margin: 10px 0;
  white-space: pre-wrap; word-break: break-word;
}

.badge {
  display: inline-block; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.03em;
  padding: 2px 10px; text-transform: uppercase;
}
.badge.pending  { background: var(--gold-wash); color: var(--gold); }
.badge.approved { background: var(--teal-wash); color: var(--teal); }
.badge.executed { background: var(--teal-wash); color: var(--teal); }
.badge.denied   { background: var(--danger-wash); color: var(--danger); }
.badge.expired  { background: rgba(107,118,134,.18); color: var(--slate); }
.badge.taint    { background: var(--danger-wash); color: var(--danger); }

/* ── actions: gold is the ONE primary action on screen ─────────────── */

.actions {
  display: flex; gap: 12px; align-items: center; margin-top: 24px;
  padding-top: 18px; border-top: 1px solid var(--line);
}

button.approve {
  appearance: none; border: 0; cursor: pointer;
  background: var(--gold); color: var(--ink-900);
  font: inherit; font-weight: 700;
  padding: 8px 18px; border-radius: var(--radius-sm);
}
button.approve:hover { background: var(--gold-hover); }

button.deny {
  appearance: none; cursor: pointer; font: inherit;
  background: transparent; color: var(--danger);
  border: 1px solid var(--danger); border-radius: var(--radius-sm);
  padding: 7px 16px;
}
button.deny:hover { background: var(--danger-wash); }

button.ghost {
  appearance: none; cursor: pointer; font: inherit;
  background: transparent; color: var(--teal);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 13.5px; transition: all 0.15s ease;
}
button.ghost:hover { background: var(--teal-wash); color: var(--teal); }

input.note {
  flex: 1; min-width: 160px;
  background: var(--ink-900); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 8px 10px; font: inherit;
}
input.note:focus { outline: none; border-color: var(--teal); }

/* ── tables (work log, cost) ───────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; color: var(--text-faint); font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 8px 10px; border-bottom: 1px solid var(--ink-700); }
td.mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); }

.empty {
  color: var(--text-faint); text-align: center; padding: 40px 0;
  border: 1px dashed var(--line); border-radius: var(--radius);
}

.kpis { display: flex; gap: var(--gap); flex-wrap: wrap; margin-bottom: var(--gap); }
.kpi {
  flex: 1; min-width: 180px;
  background: var(--ink-800); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px;
}
.kpi .label { color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 24px; font-weight: 650; margin-top: 2px; }
.kpi .value.ok { color: var(--teal); }
.kpi .value.warn { color: var(--warn); }
.kpi .value.danger { color: var(--danger); }

.flash {
  position: fixed; bottom: 18px; right: 18px;
  background: var(--ink-700); border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius-sm); padding: 10px 16px; font-size: 13.5px;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.flash.error { border-left-color: var(--danger); }

/* ── onboarding form (control-plane) ───────────────────────────────────
   Extends the console tokens above; same brand discipline — gold is the
   ONE primary action on screen (Submit), teal carries everything live. */

.gate {
  position: fixed; inset: 0; z-index: 50;
  background: var(--ink-950);
  display: flex; align-items: center; justify-content: center;
}
.gate .panel {
  background: var(--ink-800); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; width: min(440px, 92vw);
}
.gate h2 { margin: 0 0 6px; font-size: 18px; }
.gate p { color: var(--text-dim); font-size: 13.5px; margin: 0 0 16px; }
.gate textarea {
  width: 100%; min-height: 90px; resize: vertical;
  background: var(--ink-900); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 10px; font-family: var(--font-mono); font-size: 12px;
}
.hidden { display: none !important; }

.tenant {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline;
  font-size: 12.5px; color: var(--text-dim);
}
.tenant .mono { font-family: var(--font-mono); color: var(--text); }
.tenant .role { color: var(--teal); }

section.fs {
  background: var(--ink-800); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
}
section.fs > h2 {
  margin: 0 0 8px; font-size: 17px; font-weight: 650; letter-spacing: -0.01em;
  color: var(--text);
}
section.fs > .hint {
  color: var(--text-faint); font-size: 12.5px; margin: 0 0 18px; line-height: 1.5;
}

.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 11.5px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px;
  font-weight: 600;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }

input[type=text], input[type=number], input[type=date], select, textarea.f {
  width: 100%; background: var(--ink-900); border: 1.5px solid var(--line);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 9px 11px; font: inherit; font-size: 14px;
  transition: all 0.15s ease;
}
input:hover, select:hover, textarea:hover {
  border-color: var(--ink-600);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal); background: var(--ink-900);
  box-shadow: inset 0 0 0 2px rgba(43, 182, 164, 0.1);
}
textarea.f { min-height: 80px; resize: vertical; line-height: 1.5; }

.caps { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0; }
.caps label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); text-transform: none; letter-spacing: 0; }

.repeat {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 12px; background: var(--ink-700);
  position: relative;
}
.repeat .rm {
  position: absolute; top: 12px; right: 12px;
  font-size: 12px; padding: 4px 8px;
}
button.add {
  margin-top: 8px; font-size: 13px;
}

/* Catalog checklists (task classes, connectors, guardrails) — single-sourced
   from the engine; the form only checks boxes, never authors capabilities. */
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist.mini { gap: 6px; margin: 4px 0; }
.checklist .ck {
  display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px;
  color: var(--text-dim); text-transform: none; letter-spacing: 0; line-height: 1.4;
}
.checklist .ck.inline { display: inline-flex; margin-right: 14px; }
.checklist .ck input {
  margin-top: 3px; flex: none; width: 18px; height: 18px; cursor: pointer;
  appearance: none; border: 1.5px solid var(--line); border-radius: 50%;
  background: var(--ink-900); transition: all 0.15s ease;
}
.checklist .ck input:hover { border-color: var(--teal); }
.checklist .ck input:checked {
  background: var(--teal); border-color: var(--teal);
  box-shadow: inset 0 0 0 2px var(--ink-900);
}
.checklist .ck input:focus { outline: none; border-color: var(--teal); }
.checklist .ck b { color: var(--text); font-weight: 600; }
.checklist .sub, small.sub { display: block; color: var(--text-faint); font-size: 12px; }
.checklist.by-category { gap: 18px; }
.catgroup {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 0;
}
.catname {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); font-weight: 700;
}

.chips {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 10px; min-height: 28px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--teal-wash); color: var(--teal);
  border-radius: 999px; padding: 4px 12px; font-size: 12px;
  font-weight: 500; transition: all 0.15s ease;
}
.chip:hover { background: rgba(43, 182, 164, 0.18); }
.chip.deny { background: var(--danger-wash); color: var(--danger); }
.chip button {
  appearance: none; border: 0; background: transparent; color: inherit;
  cursor: pointer; font-size: 14px; line-height: 1; padding: 0; margin-left: 2px;
  opacity: 0.7; transition: opacity 0.15s ease;
}
.chip button:hover { opacity: 1; }

button.submit {
  appearance: none; border: 0; cursor: pointer;
  background: var(--gold); color: var(--ink-900);
  font: inherit; font-weight: 700; padding: 10px 24px; border-radius: var(--radius-sm);
  font-size: 14px; transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(226, 165, 60, 0.2);
}
button.submit:hover { background: var(--gold-hover); box-shadow: 0 4px 12px rgba(226, 165, 60, 0.3); }
button.submit:active { transform: translateY(1px); }
button.submit:disabled { opacity: 0.6; cursor: not-allowed; }

.errors {
  border-left: 3px solid var(--danger); background: var(--danger-wash);
  padding: 12px 14px; border-radius: var(--radius-sm); margin: 16px 0;
  font-size: 13px; line-height: 1.6;
}
.errors strong { display: block; margin-bottom: 8px; color: var(--danger); }
.errors li { color: var(--danger); }

.preview-grid { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
.yaml { white-space: pre; overflow-x: auto; }
