/* ===========================================================================
   SystemMatch Monitor — console

   The token set below is lifted verbatim from the pre-sales site's
   css/site.css, so the two products read as one. Only the monitoring-specific
   components are new.

   The four semantic colours map straight onto the four states, which is a
   fortunate accident of the original palette:

       teal   → OK          amber → WARNING
       red    → CRITICAL    faint → UNKNOWN

   This is an operations console: dark ground, dense information, and every
   colour carrying meaning. Nothing is coloured for decoration, because in a
   room where someone is looking for the one red row, a decorative red is a
   fault in the product.
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=Public+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Ink ground, as the pre-sales site's .band */
  --bg: #0D0F12;
  --surface: #15181C;
  --surface-raised: #1B2026;
  --surface-hover: #212831;
  --sunk: #0A0C0F;
  --border: rgba(255,255,255,.09);
  --border-soft: rgba(255,255,255,.055);
  --border-strong: rgba(255,255,255,.16);
  --text: #F4F6F8;
  --text-dim: #A5AEB7;
  --text-faint: #7E8791;

  --teal: #2FCDC4;
  --teal-bright: #57DED6;
  --teal-bg: rgba(47,205,196,.12);
  --teal-border: rgba(47,205,196,.4);
  --amber: #E3B45C;
  --amber-bg: rgba(227,180,92,.11);
  --amber-border: rgba(227,180,92,.34);
  --red: #F2836D;
  --red-bg: rgba(242,131,109,.11);
  --red-border: rgba(242,131,109,.36);
  --green: #7ED3A6;
  --green-bg: rgba(126,211,166,.1);

  /* State colours — named for what they mean, not what they look like */
  --ok: var(--teal);
  --ok-bg: var(--teal-bg);
  --ok-border: var(--teal-border);
  --warning: var(--amber);
  --warning-bg: var(--amber-bg);
  --warning-border: var(--amber-border);
  --critical: var(--red);
  --critical-bg: var(--red-bg);
  --critical-border: var(--red-border);
  --unknown: #8791A0;
  --unknown-bg: rgba(135,145,160,.10);
  --unknown-border: rgba(135,145,160,.30);

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 1px 12px rgba(0,0,0,.28);
  --shadow-lift: 0 14px 44px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.34);
  --radius: 10px;
  --radius-sm: 6px;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --nav-w: 232px;
  --header-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-bright); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ===========================================================================
   Sign in
   =========================================================================== */

.signin-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(47,205,196,.07), transparent 60%),
    var(--bg);
}
.signin-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lift);
}
.signin-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 4px;
}
.signin-brand img { width: 30px; height: 30px; }
.signin-brand span { font-family: var(--serif); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.signin-sub { color: var(--text-faint); font-size: 12.5px; margin-bottom: 26px; letter-spacing: .02em; text-transform: uppercase; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; font-weight: 500; }
.field input {
  width: 100%;
  background: var(--sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
  font-family: var(--sans);
  font-size: 14px;
}
.field input:focus { outline: none; border-color: var(--teal-border); box-shadow: 0 0 0 3px var(--teal-bg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--teal); color: #05201F;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; font-weight: 600; font-size: 13.5px;
  cursor: pointer; transition: background .12s ease;
}
.btn:hover { background: var(--teal-bright); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }

.form-error {
  background: var(--critical-bg);
  border: 1px solid var(--critical-border);
  color: var(--critical);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ===========================================================================
   App shell
   =========================================================================== */

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

.sidebar {
  background: var(--sunk);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  height: var(--header-h);
  display: flex; align-items: center; gap: 9px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-brand img { width: 24px; height: 24px; }
.sidebar-brand b { font-family: var(--serif); font-size: 15px; letter-spacing: -.01em; font-weight: 700; }
.sidebar-brand em { font-style: normal; color: var(--text-faint); font-size: 12px; font-weight: 500; }

.nav { padding: 14px 10px; overflow-y: auto; flex: 1; }
.nav-group { margin-bottom: 18px; }
.nav-group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-faint); padding: 0 10px; margin-bottom: 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 13.5px; cursor: pointer;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--teal-bg); color: var(--teal-bright); border-color: var(--teal-border); font-weight: 500; }
.nav-item .count {
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  background: var(--surface-raised); padding: 1px 6px; border-radius: 20px;
}
.nav-item.active .count { background: rgba(47,205,196,.18); color: var(--teal-bright); }
.nav-item.planned { opacity: .45; cursor: not-allowed; }
.nav-item.planned:hover { background: transparent; color: var(--text-dim); }
.nav-item .tag-planned {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em;
  border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; color: var(--text-faint);
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 12px; color: var(--text-faint);
  flex-shrink: 0;
}
.sidebar-foot .who { color: var(--text-dim); display: block; margin-bottom: 2px; }

/* ===========================================================================
   Main region
   =========================================================================== */

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

.topbar {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-family: var(--serif); font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }

.scope-select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 5px 9px; font-size: 12.5px; font-family: var(--sans);
}
.scope-select:focus { outline: none; border-color: var(--teal-border); }

.refresh-note { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); }

.content { padding: 22px; max-width: 1500px; }

.breadcrumb { font-size: 12.5px; color: var(--text-faint); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--teal); }
.breadcrumb span { margin: 0 6px; opacity: .5; }

/* ===========================================================================
   Health hero
   =========================================================================== */

.health-hero {
  display: grid; grid-template-columns: 220px 1fr;
  gap: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
@media (max-width: 780px) { .health-hero { grid-template-columns: 1fr; } }

.score-block { text-align: center; border-right: 1px solid var(--border-soft); padding-right: 22px; }
@media (max-width: 780px) { .score-block { border-right: none; border-bottom: 1px solid var(--border-soft); padding-right: 0; padding-bottom: 18px; } }

.score-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); margin-bottom: 6px; }
.score-value { font-family: var(--serif); font-size: 54px; font-weight: 700; line-height: 1; letter-spacing: -.03em; }
.score-value small { font-size: 24px; opacity: .55; font-weight: 600; }
.score-ring { margin: 10px auto 0; display: block; }
.score-explain-toggle {
  margin-top: 12px; background: none; border: none; cursor: pointer;
  color: var(--text-faint); font-size: 11.5px; text-decoration: underline dotted;
}
.score-explain-toggle:hover { color: var(--teal); }

.tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.tally-cell {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; background: var(--surface-raised);
}
.tally-cell .n { font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1.1; }
.tally-cell .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-top: 2px; }
.tally-cell.s-critical { border-color: var(--critical-border); background: var(--critical-bg); }
.tally-cell.s-critical .n { color: var(--critical); }
.tally-cell.s-warning  { border-color: var(--warning-border); background: var(--warning-bg); }
.tally-cell.s-warning .n { color: var(--warning); }
.tally-cell.s-ok .n { color: var(--ok); }
.tally-cell.s-unknown .n { color: var(--unknown); }

/* Per-category bars */
.categories { display: grid; gap: 9px; }
.cat-row { display: grid; grid-template-columns: 88px 1fr 148px; gap: 12px; align-items: center; }
.cat-name { font-size: 12.5px; color: var(--text-dim); font-weight: 500; }
.cat-bar { height: 8px; background: var(--sunk); border-radius: 4px; overflow: hidden; display: flex; }
.cat-bar i { display: block; height: 100%; }
.cat-bar i.ok { background: var(--ok); }
.cat-bar i.warning { background: var(--warning); }
.cat-bar i.critical { background: var(--critical); }
.cat-bar i.unknown { background: var(--unknown); }
.cat-counts { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); text-align: right; }
.cat-counts b { color: var(--text-dim); font-weight: 500; }

.explain-panel {
  margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border);
  font-size: 12.5px; color: var(--text-dim); line-height: 1.65;
}
.explain-panel li { margin-left: 16px; margin-bottom: 4px; }
.explain-panel .method {
  margin-top: 10px; padding: 9px 11px; background: var(--sunk);
  border-radius: var(--radius-sm); color: var(--text-faint); font-size: 11.5px;
}

/* ===========================================================================
   Cards, tables, states
   =========================================================================== */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 18px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-family: var(--serif); font-size: 14px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-head .sub { font-size: 12px; color: var(--text-faint); }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); font-weight: 600;
  padding: 9px 16px; border-bottom: 1px solid var(--border); background: var(--sunk);
  position: sticky; top: 0;
}
tbody td { padding: 10px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-hover); }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
td.dim { color: var(--text-faint); }
td.num { text-align: right; font-family: var(--mono); font-size: 12px; }

/* State pill — the single most-read element in the whole console */
.state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 8px 2px 6px; border-radius: 20px; border: 1px solid;
  white-space: nowrap;
}
.state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.state.ok       { color: var(--ok);       background: var(--ok-bg);       border-color: var(--ok-border); }
.state.warning  { color: var(--warning);  background: var(--warning-bg);  border-color: var(--warning-border); }
.state.critical { color: var(--critical); background: var(--critical-bg); border-color: var(--critical-border); }
.state.unknown  { color: var(--unknown);  background: var(--unknown-bg);  border-color: var(--unknown-border); }

/* A critical row must be findable at a glance from across a room. */
tr.row-critical td:first-child { box-shadow: inset 3px 0 0 var(--critical); }
tr.row-warning  td:first-child { box-shadow: inset 3px 0 0 var(--warning); }

.chip {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 4px;
  background: var(--surface-raised); border: 1px solid var(--border); color: var(--text-dim);
}
.chip.planned { color: var(--text-faint); border-style: dashed; }

.empty {
  padding: 40px 20px; text-align: center; color: var(--text-faint); font-size: 13px;
}
.empty strong { display: block; color: var(--text-dim); margin-bottom: 5px; font-size: 14px; }

.banner {
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px;
  margin-bottom: 16px; border: 1px solid; line-height: 1.55;
}
.banner.info    { background: var(--teal-bg);     border-color: var(--teal-border);     color: var(--text-dim); }
.banner.warning { background: var(--warning-bg);  border-color: var(--warning-border);  color: var(--text-dim); }
.banner.critical{ background: var(--critical-bg); border-color: var(--critical-border); color: var(--text-dim); }
.banner b { color: var(--text); }

/* Agent liveness */
.liveness { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.liveness::before { content: ''; width: 7px; height: 7px; border-radius: 50%; }
.liveness.healthy::before   { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.liveness.late::before      { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }
.liveness.offline::before,
.liveness.never_seen::before{ background: var(--critical); box-shadow: 0 0 0 3px var(--critical-bg); }
.liveness.pending::before   { background: var(--unknown); box-shadow: 0 0 0 3px var(--unknown-bg); }

/* Enrolment token — shown once, and the page says so */
.token-box {
  font-family: var(--mono); font-size: 13px; word-break: break-all;
  background: var(--sunk); border: 1px dashed var(--teal-border);
  border-radius: var(--radius-sm); padding: 12px; margin: 10px 0; color: var(--teal-bright);
}

.timeline { list-style: none; }
.timeline li {
  display: grid; grid-template-columns: 68px 1fr; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 12.5px;
}
.timeline li:last-child { border-bottom: none; }
.timeline time { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }
.timeline .msg { color: var(--text-dim); }
.timeline li.sev-critical .msg { color: var(--critical); }
.timeline li.sev-warning  .msg { color: var(--warning); }

.spinner {
  width: 15px; height: 15px; border: 2px solid var(--border-strong);
  border-top-color: var(--teal); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading { padding: 36px; text-align: center; color: var(--text-faint); font-size: 13px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,7,9,.72);
  display: grid; place-items: center; padding: 20px; z-index: 100;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lift); max-height: 88vh; overflow-y: auto;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h2 { font-family: var(--serif); font-size: 15px; font-weight: 600; flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-end; }

.close-x { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 20px; line-height: 1; }
.close-x:hover { color: var(--text); }

.footnote { font-size: 11.5px; color: var(--text-faint); margin-top: 18px; line-height: 1.6; }
.footnote code { font-family: var(--mono); color: var(--text-dim); }

/* ===========================================================================
   Forms — add site / device / check
   =========================================================================== */

.field-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.5;
  margin-top: 5px;
}

.field select,
.field input[type="number"] {
  width: 100%;
  background: var(--sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
  font-family: var(--sans);
  font-size: 14px;
}
.field select:focus,
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--teal-border);
  box-shadow: 0 0 0 3px var(--teal-bg);
}
.field select optgroup {
  background: var(--surface);
  color: var(--text-faint);
  font-style: normal;
  font-weight: 600;
}
.field select option { background: var(--surface); color: var(--text); }
.field select option:disabled { color: var(--text-faint); font-style: italic; }

/* Checkbox rows read as a sentence, not as a control with a label beside it. */
.check-line {
  display: flex; align-items: flex-start; gap: 9px;
  cursor: pointer; font-size: 13px; color: var(--text-dim);
  padding: 7px 0;
}
.check-line input[type="checkbox"] {
  width: 15px; height: 15px; margin-top: 1px;
  accent-color: var(--teal); flex-shrink: 0; cursor: pointer;
}
.check-line span { line-height: 1.45; }

/* Bulk-add preview: shows exactly what is about to be created. */
.bulk-preview {
  margin-top: 6px; padding: 11px 13px;
  background: var(--sunk); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.bulk-list { display: grid; gap: 3px; font-size: 12.5px; }
.bulk-list > div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 2px 0; color: var(--text-dim);
}

/* The modal body can get long on the HTTP check form. */
.modal-body .field:last-child { margin-bottom: 0; }

/* Destructive actions. Deliberately quiet until hovered - a delete control
   that shouts is a delete control that gets clicked by accident. */
.btn-danger-ghost {
  color: var(--text-faint);
  border-color: var(--border);
}
.btn-danger-ghost:hover {
  color: var(--critical);
  border-color: var(--critical-border);
  background: var(--critical-bg);
}
.btn-danger {
  background: var(--critical);
  color: #2A0B05;
  border-color: transparent;
}
.btn-danger:hover { background: #F79A86; }
.btn-danger:disabled { opacity: .4; cursor: not-allowed; background: var(--critical); }

/* ===========================================================================
 *  ADMINISTRATION
 * ===========================================================================
 *  Company profile, people, roles, audit trail, and the first-run checklist a
 *  brand-new empty company sees instead of a dashboard of zeros.
 * ========================================================================= */

/* --- Form feedback -------------------------------------------------------- */
.form-ok {
  background: var(--green-bg);
  border: 1px solid var(--green);
  color: var(--green);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.field-help {
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 5px;
  line-height: 1.45;
}

.field textarea {
  width: 100%;
  background: var(--sunk);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
}
.field textarea:focus {
  outline: none;
  border-color: var(--teal-border);
}
.field input:disabled,
.field textarea:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* --- Tags ----------------------------------------------------------------- */
.tag {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-faint);
  vertical-align: middle;
}
.tag-owner   { background: var(--teal-bg);  border-color: var(--teal-border);  color: var(--teal); }
.tag-warn    { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber); }
.tag-pending { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber); }
.tag-accepted{ background: var(--green-bg); border-color: var(--green);        color: var(--green); }
.tag-expired,
.tag-revoked { background: var(--surface-hover); color: var(--text-faint); }

/* --- Tables --------------------------------------------------------------- */
td.center, th.center { text-align: center; }
tr.row-dim td { opacity: .55; }
tr.row-group td {
  background: var(--sunk);
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: .08em;
  font-weight: 600;
}
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { margin-left: 6px; }

.inline-select {
  background: var(--sunk);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 8px;
  font: inherit;
  font-size: 12.5px;
}
.inline-select:focus { outline: none; border-color: var(--teal-border); }

/* --- Licence usage bars ---------------------------------------------------
 * Reported, never enforced - so they are drawn calmly. A bar going amber is
 * information, not an obstruction.
 * ------------------------------------------------------------------------ */
.usage-row {
  display: grid;
  grid-template-columns: 90px 1fr 150px;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}
.usage-row:last-of-type { border-bottom: 0; }
.usage-label { color: var(--text-dim); font-size: 13px; }
.usage-track {
  height: 7px;
  background: var(--sunk);
  border-radius: 20px;
  overflow: hidden;
}
.usage-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 20px;
  transition: width .3s ease;
}
.usage-fill.over { background: var(--amber); }
.usage-value {
  text-align: right;
  color: var(--text-dim);
  font-size: 12.5px;
  font-family: var(--mono);
}

/* --- First-run checklist --------------------------------------------------
 * What a genuinely empty company sees. No invented sites, no sample graph,
 * no placeholder pins on a map - just the real next steps.
 * ------------------------------------------------------------------------ */
.first-run .sub { display: block; margin: 2px 0 20px; line-height: 1.55; max-width: 70ch; }

.steps { list-style: none; margin: 0; padding: 0; }

.step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  padding: 15px 0;
  border-top: 1px solid var(--border-soft);
}
.step:first-child { border-top: 0; }

.step-n {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}
.step.done .step-n {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
  font-size: 9.5px;
  letter-spacing: .03em;
}
.step.done .step-title { color: var(--text-dim); }

.step-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.step-detail {
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.55;
  max-width: 68ch;
  margin-bottom: 9px;
}
.step .btn { margin-top: 2px; }

/* --- Unmonitored devices and the import screen ---------------------------- */
.chip-warn {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: var(--amber);
}

.table-scroll { overflow-x: auto; max-height: 60vh; overflow-y: auto; }

.import-problem { color: var(--red); font-size: 12.5px; }
.import-warn    { color: var(--amber); font-size: 12.5px; }

textarea.drop-target {
  border-color: var(--teal);
  background: var(--teal-bg);
}

.code-block {
  background: var(--sunk);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 13px;
  font-family: var(--mono);
  font-size: 12px;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-dim);
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin: 10px 0 4px;
}
.type-cat {
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.card h3 {
  font-size: 13px;
  margin: 18px 0 7px;
  color: var(--text);
}

/* --- "Nobody is being told" ------------------------------------------------
 * The most dangerous state a monitoring product can be in is one where
 * everything looks alive and no human is ever notified. It gets a red card.
 * ------------------------------------------------------------------------ */
.card-danger {
  border-color: var(--red-border);
  background: linear-gradient(var(--red-bg), var(--red-bg)) padding-box, var(--surface);
}
.card-danger h2 { color: var(--red); }

/* ===========================================================================
 *  THE HEARTBEAT
 * ===========================================================================
 *  A beating core sending a pulse out to every kind of check that is really
 *  running. See js/heartbeat.js for the rule this is built around: it never
 *  beats when nothing is happening, and each ray moves at the interval that
 *  check genuinely runs at.
 *
 *  All of it is SVG plus CSS transforms and opacity - properties the browser
 *  composites on its own thread. Nothing here animates a layout property, so a
 *  console left open on a wall display all day costs almost nothing.
 * ========================================================================= */

.heartbeat {
  position: relative;
  margin: 0 0 18px;
  padding: 18px 16px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  /* The deep navy of the reference: light appears to come from inside the
     core rather than from a flat background fill. */
  background:
    radial-gradient(120% 90% at 50% 42%, rgba(47,205,196,.07), transparent 62%),
    radial-gradient(150% 120% at 50% 120%, rgba(20,42,66,.55), transparent 70%),
    var(--sunk);
  overflow: hidden;
}

.hb-svg {
  display: block;
  width: 100%;
  max-height: 300px;
  height: auto;
}

/* --- The core ------------------------------------------------------------ */
.hb-core-body {
  fill: var(--surface-raised);
  stroke: none;
}
.hb-core-edge {
  fill: none;
  stroke: var(--hb-core-colour, var(--teal));
  stroke-width: 1.4;
  opacity: .85;
}
.hb-core.s-ok       { --hb-core-colour: var(--ok); }
.hb-core.s-warning  { --hb-core-colour: var(--warning); }
.hb-core.s-critical { --hb-core-colour: var(--critical); }

.hb-core-trace {
  fill: none;
  stroke: var(--hb-core-colour, var(--teal));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The expanding ring: one beat, leaving the core.
 *
 * ANIMATED ON `r`, NOT ON A TRANSFORM, AND THAT MATTERS.
 *
 * The first version scaled these with `transform: scale()` plus
 * `transform-box: fill-box`. It drew a large stray ring away to the upper
 * left of the core, because the group is already positioned with an SVG
 * translate and the fill-box origin is computed from the group's own bounding
 * box - which the expanding rings themselves keep changing. The origin chased
 * the animation.
 *
 * `r` is an animatable geometry property on an SVG circle and has no origin to
 * get wrong: the circle grows around its own centre, wherever that is. Fewer
 * moving parts, and it composites just as cheaply.
 */
.hb-core-wave {
  fill: none;
  stroke: var(--hb-core-colour, var(--teal));
  stroke-width: 1.2;
  opacity: 0;
  animation: hb-wave var(--hb-period, 4s) cubic-bezier(.22,.61,.36,1) infinite;
}
.hb-core-wave-2 { animation-delay: calc(var(--hb-period, 4s) / 2); }

@keyframes hb-wave {
  0%   { r: 36px;  opacity: .5; }
  70%  {           opacity: .05; }
  100% { r: 104px; opacity: 0; }
}

/* The core swells very slightly on the beat. Small on purpose - a thumping
   graphic on a dashboard somebody watches all day is exhausting. */
.hb-core-body,
.hb-core-edge {
  animation: hb-beat var(--hb-period, 4s) ease-in-out infinite;
}
@keyframes hb-beat {
  0%, 62%, 100% { r: 34px; }
  8%            { r: 36px; }
  16%           { r: 34px; }
  24%           { r: 35px; }
}

/* --- Rays ---------------------------------------------------------------- */
.hb-track {
  /* Bright enough to read as a connection at a glance. The first attempt used
     var(--border) at 50% opacity, which on the dark panel was invisible - the
     nodes looked unconnected to the core and the whole idea was lost. */
  stroke: var(--hb-colour, var(--teal));
  stroke-width: 1;
  stroke-dasharray: 2 6;
  opacity: .28;
}

/* The pulse is a short bright segment travelling along the line, drawn with a
   dash pattern rather than a moving element - the browser animates one
   property and nothing reflows. */
.hb-pulse {
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 16 400;
  filter: drop-shadow(0 0 4px var(--hb-colour));
  animation: hb-travel var(--hb-period, 4s) linear infinite;
  animation-delay: var(--hb-delay, 0s);
}
.hb-in {
  /* The answer coming back: dimmer and later, so the round trip reads in the
     right order rather than as two things crossing. */
  opacity: .5;
  stroke-width: 1.6;
  animation-delay: calc(var(--hb-delay, 0s) + var(--hb-period, 4s) * .34);
}
@keyframes hb-travel {
  0%        { stroke-dashoffset: 416; opacity: 0; }
  6%        { opacity: 1; }
  46%, 100% { stroke-dashoffset: 0; opacity: 0; }
}

/* --- Nodes --------------------------------------------------------------- */
.hb-node-ring {
  fill: var(--sunk);
  stroke: var(--hb-colour, var(--teal));
  stroke-width: 1.1;
  opacity: .45;
}
.hb-node-dot {
  /* `r` again, for the same reason as the core waves. */
  animation: hb-node-pop var(--hb-period, 4s) ease-out infinite;
  animation-delay: calc(var(--hb-delay, 0s) + var(--hb-period, 4s) * .3);
}
@keyframes hb-node-pop {
  0%, 40%, 100% { r: 5.5px; opacity: .85; }
  6%            { r: 9px;   opacity: 1; }
}

.hb-label {
  fill: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
}
.hb-count {
  fill: var(--text-faint);
  font-size: 10.5px;
}

/* Stale: nothing is arriving, so nothing moves. This is the state that makes
   the animation worth having - it is visibly different from healthy. */
.hb-ray.is-stale .hb-track { opacity: .22; }
.hb-node.is-stale .hb-node-ring { opacity: .2; }
.hb-node.is-stale .hb-node-dot {
  animation: none;
  opacity: .35;
  fill: var(--unknown);
}
.hb-node.is-stale .hb-label,
.hb-node.is-stale .hb-count { fill: var(--text-faint); opacity: .6; }

/* --- Flatline ------------------------------------------------------------ */
.hb-flat { padding: 26px 0 8px; }
.hb-flatline { display: block; width: 100%; max-height: 44px; }
.hb-flat-path {
  fill: none;
  stroke: var(--unknown);
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: .7;
}
.hb-flat-path.hb-dead { stroke: var(--critical); opacity: .85; }
.heartbeat.hb-idle { background: var(--sunk); }

.hb-caption {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-dim);
  text-align: center;
}
.hb-caption b { color: var(--text); }
.hb-caption-bad b { color: var(--critical); }

/* ---------------------------------------------------------------------------
 *  Reduced motion
 * -------------------------------------------------------------------------
 *  Everything stops. Nothing is hidden: the rays, the colours, the labels and
 *  the caption all stay, and the stale rays are still visibly stale. Somebody
 *  who cannot tolerate moving interfaces loses the animation, not the
 *  information.
 * ------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .hb-core-body,
  .hb-core-edge,
  .hb-core-wave,
  .hb-pulse,
  .hb-node-dot {
    animation: none !important;
  }
  .hb-core-wave { opacity: .18; }
  .hb-pulse     { opacity: .5; stroke-dasharray: none; }
  .hb-in        { opacity: .25; }
}

/* Sign-in helpers: forgotten password, second factor, reset confirmation. */
.signin-lead { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; line-height: 1.55; }
.signin-alt { margin-top: 14px; text-align: center; font-size: 13px; }
.signin-note {
  background: var(--teal-bg);
  border: 1px solid var(--teal-border);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

/* ===========================================================================
 *  Capacity trends
 * ========================================================================= */
.page-head { margin-bottom: 16px; }
.page-head h1 { font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.page-head .sub { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.trend-headline {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  padding: 20px 22px;
}
.trend-headline-figure .n {
  font-family: var(--serif); font-size: 34px; font-weight: 700; line-height: 1.05;
  letter-spacing: -.02em;
}
.trend-headline-figure .l { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }
.trend-headline-detail { font-size: 13.5px; line-height: 1.6; }
.trend-headline-detail .sub { color: var(--text-dim); font-size: 12.5px; }

.trend-headline.s-critical { border-color: var(--critical-border); }
.trend-headline.s-critical .trend-headline-figure .n { color: var(--critical); }
.trend-headline.s-warning  { border-color: var(--warning-border); }
.trend-headline.s-warning  .trend-headline-figure .n { color: var(--warning); }
.trend-headline.s-ok       .trend-headline-figure .n { color: var(--ok); }

.trend-table { width: 100%; }
.trend-table td, .trend-table th { vertical-align: middle; }
.trend-table .sub { color: var(--text-dim); font-size: 12px; }
.trend-days { font-family: var(--mono); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.trend-table tr.s-critical .trend-days { color: var(--critical); }
.trend-table tr.s-warning  .trend-days { color: var(--warning); }
.trend-table tr.s-ok       .trend-days { color: var(--ok); }

.trend-spark-cell { width: 230px; }
.trend-spark { display: block; width: 220px; height: 40px; }
/* Drawn from the real series, unsmoothed: a jagged line is information, and
   it is exactly the case where the projection deserves least trust. */
.trend-spark-line {
  fill: none;
  stroke: var(--teal);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: .85;
}

.method-card p { color: var(--text-dim); font-size: 13px; line-height: 1.6; margin: 8px 0; }
.method-card ul { margin: 8px 0 8px 18px; color: var(--text-dim); font-size: 13px; line-height: 1.7; }
