/* Verifier config editor — switchboard/call-sheet visual language.
   One accent (operator green) reserved entirely for live/enabled state. */

:root {
  --ink: #16191f;
  --paper: #fbfaf8;
  --panel: #ffffff;
  --rule: #dfdcd5;
  --rule-soft: #ebe8e2;
  --muted: #6b6862;
  --signal: #1f6f5c;
  --signal-soft: #e7f1ee;
  --alert: #9c3521;
  --alert-soft: #fbeeeb;
  --amber: #8a6208;
  --amber-soft: #fdf3dd;

  --sidebar-w: 216px;
  --list-w: 264px;
  --radius: 5px;
  --field-h: 34px;

  --f-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"],
:root:not([data-theme="light"]) {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8e6e1;
    --paper: #14161a;
    --panel: #1a1d22;
    --rule: #2e323a;
    --rule-soft: #24272d;
    --muted: #949089;
    --signal: #4fb99a;
    --signal-soft: #16302a;
    --alert: #e4816c;
    --alert-soft: #35201c;
    --amber: #d9ac52;
    --amber-soft: #2f2717;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ink: #e8e6e1;
  --paper: #14161a;
  --panel: #1a1d22;
  --rule: #2e323a;
  --rule-soft: #24272d;
  --muted: #949089;
  --signal: #4fb99a;
  --signal-soft: #16302a;
  --alert: #e4816c;
  --alert-soft: #35201c;
  --amber: #d9ac52;
  --amber-soft: #2f2717;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--f-ui);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* ---------------------------------------------------------------- shell */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr auto;
  height: 100vh;
}

.sidebar {
  grid-row: 1 / 3;
  background: var(--panel);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--rule-soft);
}

.brand h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.nav { padding: 10px 10px; display: flex; flex-direction: column; gap: 1px; }

.nav button {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.nav button:hover { background: var(--rule-soft); }

.nav button[aria-current="true"] {
  background: var(--signal-soft);
  color: var(--signal);
  font-weight: 600;
}

.nav .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.nav button[aria-current="true"] .count { color: var(--signal); }

.sidebar-foot {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--rule-soft);
  font-size: 11px;
  color: var(--muted);
}

.sidebar-foot a { color: var(--muted); }

.main { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }

.section-head {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.section-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.section-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); max-width: 68ch; }

.section-body { flex: 1; min-height: 0; overflow: auto; }

/* ---------------------------------------------------------------- master/detail */

.split { display: grid; grid-template-columns: var(--list-w) 1fr; height: 100%; min-height: 0; }

.list-pane {
  border-right: 1px solid var(--rule);
  overflow: auto;
  background: var(--panel);
  display: flex;
  flex-direction: column;
}

.list-actions {
  padding: 10px;
  border-bottom: 1px solid var(--rule-soft);
  display: flex;
  gap: 6px;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

.rows { padding: 6px; }

.row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: var(--radius);
  padding: 8px 10px 8px 20px;
  cursor: pointer;
  position: relative;
  color: var(--ink);
}

.row:hover { background: var(--rule-soft); }
.row[aria-selected="true"] { background: var(--signal-soft); }

/* The switchboard tell: a live line lights up. */
.row::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: transparent;
}

.row[data-live="true"]::before {
  background: var(--signal);
  border-color: var(--signal);
}

.row[data-disabled="true"] .row-name { color: var(--muted); text-decoration: line-through; }

.row-name { font-weight: 550; font-size: 13px; }
.row-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.detail-pane { overflow: auto; padding: 20px 24px 40px; }
.detail-pane.empty { display: grid; place-items: center; color: var(--muted); }

/* ---------------------------------------------------------------- forms */

.group { margin-bottom: 26px; }

.group > h3 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-soft);
}

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.fields.single { grid-template-columns: minmax(0, 1fr); }
.field.wide { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.field > label { font-size: 11.5px; color: var(--muted); font-weight: 500; }

.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  min-height: var(--field-h);
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

.field textarea { resize: vertical; line-height: 1.55; min-height: 62px; }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
button:focus-visible,
.row:focus-visible,
.nav button:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 1px;
}

.field .help { font-size: 11px; color: var(--muted); }

.field[data-dirty="true"] > label { color: var(--amber); font-weight: 600; }
.field[data-dirty="true"] input,
.field[data-dirty="true"] select,
.field[data-dirty="true"] textarea { border-color: var(--amber); background: var(--amber-soft); }

.check { flex-direction: row; align-items: center; gap: 8px; }
.check input { width: 15px; height: 15px; accent-color: var(--signal); margin: 0; }
.check > label { font-size: 13px; color: var(--ink); }

.token-hint { font-size: 11px; color: var(--muted); }

/* ---------------------------------------------------------------- roster */

.roster-list { padding: 18px 24px 40px; display: grid; gap: 6px; max-width: 640px; }

.roster-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
}

.roster-item[data-on="true"] { border-color: var(--signal); background: var(--signal-soft); }
.roster-item input { width: 16px; height: 16px; accent-color: var(--signal); margin: 0; }
.roster-item .who { font-weight: 550; }
.roster-item .meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.roster-item .off { margin-left: auto; font-size: 11px; color: var(--alert); }

/* ---------------------------------------------------------------- kv editor */

.kv { display: grid; gap: 8px; max-width: 720px; }
.kv-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- identity */

.identity-email { color: var(--ink); font-weight: 550; word-break: break-all; font-size: 11.5px; }
.identity-role { color: var(--muted); margin-top: 1px; }

.linklike {
  border: 0; background: none; padding: 0; margin-top: 6px;
  color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 11px;
}
.linklike:hover { color: var(--ink); }

/* ---------------------------------------------------------------- users */

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 150px auto;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
}

.user-row .who { font-weight: 550; word-break: break-all; }
.user-row .meta { font-size: 11.5px; color: var(--muted); }
.user-row select { min-height: var(--field-h); padding: 5px 8px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }

/* ---------------------------------------------------------------- model */

.model-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  max-width: 720px;
}

.model-actions .spacer { margin-left: auto; }

/* ---------------------------------------------------------------- audit */

.audit { display: grid; gap: 8px; max-width: 860px; }

.audit-row {
  border: 1px solid var(--rule-soft);
  border-left: 2px solid var(--rule);
  border-radius: var(--radius);
  padding: 9px 12px;
  background: var(--panel);
}

.audit-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.audit-when { color: var(--muted); font-size: 11.5px; min-width: 140px; }
.audit-who { font-weight: 600; }
.audit-what { color: var(--muted); }

.tag {
  font-size: 10px; padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--rule); color: var(--muted);
}

.audit-changes { margin-top: 7px; display: grid; gap: 3px; }

.change {
  display: grid;
  grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  font-size: 11.5px;
  padding: 2px 0;
}

.change-path { color: var(--muted); }
.change-before { color: var(--alert); overflow-wrap: anywhere; }
.change-arrow { color: var(--muted); }
.change-after { color: var(--signal); overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .change { grid-template-columns: minmax(0, 1fr); gap: 1px; }
  .user-row { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- buttons */

.btn {
  padding: 6px 11px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn.danger { color: var(--alert); }
.btn.danger:hover:not(:disabled) { border-color: var(--alert); background: var(--alert-soft); }

/* ---------------------------------------------------------------- status bar */

.statusbar {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border-top: 1px solid var(--rule);
  background: var(--panel);
}

.state { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.state::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
}
.state[data-state="dirty"] { color: var(--amber); font-weight: 550; }
.state[data-state="dirty"]::before { background: var(--amber); }
.state[data-state="saved"]::before { background: var(--signal); }
.state[data-state="error"] { color: var(--alert); font-weight: 550; }
.state[data-state="error"]::before { background: var(--alert); }

.statusbar .spacer { margin-left: auto; }

/* ---------------------------------------------------------------- messages */

.banner {
  margin: 14px 24px 0;
  padding: 10px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--alert);
  background: var(--alert-soft);
  color: var(--alert);
  font-size: 12.5px;
}

.banner ul { margin: 6px 0 0; padding-left: 18px; }
.banner[hidden] { display: none !important; }

.loading { padding: 40px 24px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { grid-row: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .count { display: none; }
  .split { grid-template-columns: 1fr; }
  .list-pane { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .statusbar { grid-column: 1; }
}
