/* ColdTrace back office: the monitor's insulated-steel palette, calmer and denser for configuration work. */

:root {
  --steel-950: #060d10;
  --steel-900: #0a1518;
  --steel-850: #0e1c20;
  --steel-800: #132529;
  --steel-700: #1c3338;
  --hairline: rgba(166, 236, 255, 0.14);
  --frost: #a6ecff;
  --ice: #e8f8fc;
  --mist: #9ab4bb;
  --dim: #93aeb5;
  --hazard: #ff5b1a;
  --amber: #ffb52e;
  --good: #5fd39a;
  --f-ui: system-ui, "Segoe UI", Roboto, sans-serif;
  --f-mono: "Consolas", "SFMono-Regular", monospace;
  --radius: 4px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; color: var(--ice); font: 15px/1.45 var(--f-ui);
  background: linear-gradient(180deg, var(--steel-850), var(--steel-950)) fixed;
}
code { font: 13px var(--f-mono); color: var(--frost); }
.muted { color: var(--mist); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--frost); color: var(--steel-950); padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }
[hidden] { display: none !important; }

button, select, input { font: inherit; }
button {
  min-height: 40px; padding: 7px 14px; color: var(--ice); background: var(--steel-800);
  border: 1px solid var(--hairline); border-radius: var(--radius); cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--frost); }
button:disabled { opacity: 0.5; cursor: wait; }
button.primary { background: var(--frost); color: var(--steel-950); border-color: var(--frost); font-weight: 600; }
button.danger { color: #ffb39a; border-color: rgba(255, 91, 26, 0.45); }
button.danger:hover { border-color: var(--hazard); }
:focus-visible { outline: 2px solid var(--frost); outline-offset: 2px; }

/* ---------- top bar ---------- */

.bar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px;
  padding: 10px clamp(14px, 3vw, 32px); background: rgba(6, 13, 16, 0.92); border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--frost); font-size: 22px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: 0.04em; }
.brand h1 span { color: var(--mist); font-weight: 400; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.tabs button { background: transparent; border-color: transparent; color: var(--mist); }
.tabs button[aria-current="page"] { color: var(--ice); border-color: var(--hairline); background: var(--steel-800);
  box-shadow: inset 0 -2px 0 var(--frost); }
.who { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--mist); margin-left: auto; }
.who a { color: var(--frost); }

/* ---------- panels ---------- */

main { padding: 18px clamp(14px, 3vw, 32px) 60px; max-width: 1400px; margin: 0 auto; }
.panel h2 { margin: 0; font-size: 24px; }
.panel h3 { margin: 26px 0 8px; font-size: 13px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.14em; }
.panel > p.muted { margin: 6px 0 14px; max-width: 80ch; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.panel-head h2 { margin-right: auto; }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--mist); font-size: 13px; }
label.inline select { min-height: 40px; padding: 6px 10px; color: var(--ice); background: var(--steel-950);
  border: 1px solid var(--hairline); border-radius: var(--radius); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 14px 0; }
.stats > div { padding: 12px 14px; background: rgba(10, 21, 24, 0.8); border: 1px solid var(--hairline); border-radius: var(--radius); }
.stats dt { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.12em; }
.stats dd { margin: 2px 0; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats .muted { font-size: 12px; }
.stats .warn { border-color: rgba(255, 181, 46, 0.55); }
.stats .warn dd { color: var(--amber); }

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

.table-wrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--radius); background: rgba(10, 21, 24, 0.6); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em;
  padding: 10px 12px; border-bottom: 1px solid var(--hairline); white-space: nowrap; background: var(--steel-900); }
td { padding: 8px 12px; border-bottom: 1px solid rgba(166, 236, 255, 0.06); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(166, 236, 255, 0.03); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.bad { color: var(--amber); }
tr.inactive td { color: var(--mist); }
tr.inactive td:first-child code { color: var(--mist); text-decoration: line-through; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions button { min-height: 34px; padding: 4px 10px; margin-left: 4px; font-size: 13px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--hairline);
  color: var(--mist); margin-right: 4px; }
.badge.ok { color: var(--good); border-color: rgba(95, 211, 154, 0.45); }
.badge.ok::before { content: "● "; }
.badge.warn { color: var(--amber); border-color: rgba(255, 181, 46, 0.5); }
.badge.warn::before { content: "◐ "; }
.badge.bad { color: #ffb39a; border-color: rgba(255, 91, 26, 0.5); }
.badge.bad::before { content: "○ "; }
.badge.role { color: var(--frost); }

/* ---------- cards, login, dialog ---------- */

.card { background: var(--steel-900); border: 1px solid var(--hairline); border-radius: 6px; padding: 22px; }
.card label { display: grid; gap: 5px; font-size: 12px; color: var(--mist); margin-bottom: 12px; }
.card input[type="text"], .card input[type="password"], .card input[type="number"], .card input:not([type]), .card select {
  min-height: 42px; padding: 8px 10px; color: var(--ice); background: var(--steel-950);
  border: 1px solid var(--hairline); border-radius: var(--radius); font-size: 15px; width: 100%;
}
.card input:disabled { color: var(--mist); }
.card input:invalid:not(:placeholder-shown):not(:focus) { border-color: var(--amber); }
.card label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ice); margin: 4px 0; }
.card label.check input { width: 18px; height: 18px; }
.card fieldset.multi { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 12px; }
.card fieldset.multi legend { font-size: 12px; color: var(--mist); padding: 0 4px; }
.card .help { margin: -8px 0 12px; font-size: 12px; color: var(--dim); }
.error { color: #ffb39a; font-size: 13px; margin: 6px 0; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.login-screen { display: grid; place-items: center; min-height: calc(100vh - 70px); padding: 20px; }
.login-card { width: min(380px, 100%); }
.login-card h2 { margin: 6px 0 2px; }
.login-card .primary { width: 100%; margin-top: 4px; }

dialog { padding: 0; border: 0; background: transparent; color: var(--ice); width: min(520px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog .card { max-height: calc(100vh - 40px); overflow: auto; }
dialog h2 { margin: 0 0 16px; font-size: 20px; }

.toast { position: fixed; right: 16px; bottom: 16px; z-index: 20; max-width: min(460px, calc(100vw - 32px));
  padding: 12px 16px; background: var(--steel-800); border: 1px solid var(--frost); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.toast.error { border-color: var(--hazard); color: #ffd2c2; }

@media (max-width: 700px) {
  .who { margin-left: 0; }
  .stats dd { font-size: 22px; }
}
