/* Shared foundation for the operator console (/admin) and the customer portal (/).
   Dark only. One accent (verdigris). 4px spacing grid. Hairlines instead of shadows. */

:root {
  color-scheme: dark;

  --bg: #121110;          /* page */
  --surface: #181715;     /* panels, tables */
  --raised: #1f1e1b;      /* controls, table header, popovers */
  --hover: #262421;       /* row / control hover */
  --line: #2a2824;        /* hairline */
  --line-strong: #3b3833; /* table header baselines, chart axis, popovers */
  --control: #5a554c;     /* outline of inputs, selects and buttons */
  --control-hover: #6b655b;

  --text: #e8e4db;
  --text-2: #aca69b;
  --text-3: #938d81;

  --accent: #6cb8a6;
  --accent-strong: #84c9b8;
  --accent-dim: #2d554d;
  --accent-ink: #0d1a17;

  --ok: #8fb26b;
  --warn: #d2a24c;
  --bad: #d4735f;
  --bad-dim: #7c4338;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", Menlo, monospace;

  --r: 4px;
  --row: 34px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/20px var(--sans);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }

h1 { font-size: 15px; line-height: 20px; font-weight: 600; }
h2 { font-size: 13px; line-height: 20px; font-weight: 600; }
h3 { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-2); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono, td.num, code, kbd {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12px; line-height: 16px; }
.nowrap { white-space: nowrap; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

::selection { background: var(--accent-dim); color: var(--text); }

/* ---- controls ---------------------------------------------------------- */

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

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--control);
  border-radius: var(--r);
  background: var(--raised);
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .1s, border-color .1s, color .1s;
}
button:hover { background: var(--hover); border-color: var(--control-hover); }
button:disabled { opacity: .5; cursor: default; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.primary:focus-visible { outline-offset: 2px; }

button.quiet { background: transparent; border-color: transparent; color: var(--text-2); padding: 0 8px; }
button.quiet:hover { background: var(--hover); color: var(--text); }

button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad-dim); background: var(--raised); }

button.inline {
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  background: transparent;
}
button.inline:hover { background: var(--hover); }

input[type="text"], input[type="password"], input[type="search"], input[type="number"], input:not([type]), select, textarea {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--control);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--text);
  min-width: 0;
  transition: border-color .1s;
}
input:hover, select:hover, textarea:hover { border-color: var(--control-hover); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type="search"]::-webkit-search-cancel-button { display: none; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button { display: none; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); margin: 0; }
select { padding-right: 4px; }
textarea { height: auto; padding: 8px; line-height: 18px; resize: vertical; }

label.field { display: grid; gap: 4px; font-size: 12px; line-height: 16px; color: var(--text-2); }
label.field > input, label.field > select { font-size: 13px; color: var(--text); }
label.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); cursor: pointer; white-space: nowrap; }

/* segmented choice built from radio inputs */
.seg { display: inline-flex; border: 1px solid var(--control); border-radius: var(--r); overflow: hidden; }
.seg label { position: relative; display: inline-flex; align-items: center; height: 26px; padding: 0 10px; color: var(--text-2); cursor: pointer; border-left: 1px solid var(--control); }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg label:hover { background: var(--hover); }
.seg label:has(input:checked) { background: var(--raised); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---- status: a dot and a word ------------------------------------------ */

.st { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.st::before {
  content: "";
  flex: none;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  transform: translateY(-1px);
}
.st.ok::before { background: var(--ok); }
.st.warn::before { background: var(--warn); }
.st.bad::before { background: var(--bad); }
.st.off { color: var(--text-3); }
.st.off::before { background: transparent; box-shadow: inset 0 0 0 1px var(--text-3); }

.error { color: var(--bad); }

/* ---- tables ------------------------------------------------------------ */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  overflow: auto;
  max-width: 100%;
}

table { width: 100%; border-collapse: separate; border-spacing: 0; }

th, td {
  height: var(--row);
  padding: 0 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 30px;
  background: var(--raised);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  border-bottom-color: var(--line-strong);
}
th.num, td.num { text-align: right; }
td.wrap { white-space: normal; padding-top: 6px; padding-bottom: 6px; min-width: 200px; }
td.act { text-align: right; padding-right: 8px; width: 1%; }
tbody tr:last-child > td { border-bottom: 0; }
tbody tr:hover > td { background: var(--hover); }
tbody tr.plain:hover > td { background: transparent; }

tr.empty > td {
  height: 72px;
  text-align: center;
  color: var(--text-3);
  white-space: normal;
}

.cause-code {
  display: inline-block;
  min-width: 26px;
  margin-right: 6px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---- figure strip: one bordered band, hairline dividers ---------------- */

.strip {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.strip > div { background: var(--surface); padding: 12px 16px; min-width: 0; }
.strip .k { font-size: 12px; line-height: 16px; color: var(--text-2); }
.strip .v {
  margin-top: 4px;
  font: 500 22px/28px var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip .v.text { font: 500 15px/28px var(--sans); letter-spacing: 0; }
.strip .v.text.mono { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.strip .v.live { color: var(--accent); }
.strip .s { font-size: 12px; line-height: 16px; color: var(--text-3); min-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- definition lists -------------------------------------------------- */

dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; }
dl.kv dt { color: var(--text-2); }
dl.kv dd { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
