/**
 * WHY Admin — component styles.
 * Every value references tokens.css (DRY) — colors, spacing, radii, shadows
 * AND the type scale (License+ / WHY family: 17px body base, --fs-* steps).
 * One class per pattern; pages compose classes — no page-specific one-offs.
 */

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

html { font-size: 16px; }
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  color: var(--text-1);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; font-size: inherit; color: var(--text-1); }
table { width: 100%; border-collapse: collapse; }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* =============================================================================
   LOGIN
   ============================================================================= */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sb-bg);
}
.login-card {
  width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 34px 32px 28px;
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 26px; }
.login-brand .app-logo { width: 46px; height: 46px; font-size: var(--fs-xl); }
.login-brand h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.3px; }
.login-brand p { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 1.4px; }

/* =============================================================================
   APP SHELL / SIDEBAR
   ============================================================================= */

.app-shell { display: flex; min-height: 100vh; }

.app-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #3b8bff);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: var(--fs-md); letter-spacing: -0.5px;
  flex-shrink: 0;
}

.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0;
  width: var(--sidebar-w);
  background: var(--sb-bg);
  display: flex; flex-direction: column;
  z-index: 100;
}
.sb-brand {
  padding: 22px 20px 18px;
  display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid var(--sb-border);
}
.sb-brand-name { font-size: var(--fs-md); font-weight: 700; color: #fff; letter-spacing: -0.2px; }
.sb-brand-sub { font-size: var(--fs-micro); color: var(--sb-text); text-transform: uppercase; letter-spacing: 1.6px; margin-top: 2px; }

.sb-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.sb-nav::-webkit-scrollbar { width: 0; }
.nav-label {
  font-size: var(--fs-xxs); text-transform: uppercase; letter-spacing: 1.3px;
  color: var(--sb-label); padding: 14px 12px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: start;
  padding: 10px 12px; border-radius: 7px; margin-bottom: 1px;
  color: var(--sb-text); font-size: var(--fs-sm); font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover { color: #d6dae3; background: var(--sb-hover); }
.nav-item.active { color: var(--sb-text-active); background: var(--sb-active); }
.nav-item.active::before {
  content: '';
  position: absolute; inset-inline-start: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--primary); border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.72; }
.nav-item.active svg { opacity: 1; }
.nav-count {
  margin-inline-start: auto;
  font-size: var(--fs-xxs); font-weight: 700;
  background: var(--danger); color: #fff;
  padding: 1px 7px; border-radius: var(--radius-pill);
  min-width: 19px; text-align: center;
}

.sb-footer { padding: 12px; border-top: 1px solid var(--sb-border); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 7px; transition: background var(--transition); }
.sb-user:hover { background: var(--sb-hover); }
.sb-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: var(--fs-xs); font-weight: 700; flex-shrink: 0;
}
.sb-user-name { font-size: var(--fs-xs); font-weight: 600; color: #fff; }
.sb-user-role { font-size: var(--fs-micro); color: var(--sb-text); }
.sb-logout { margin-inline-start: auto; color: var(--sb-text); padding: 5px; border-radius: 5px; }
.sb-logout:hover { color: var(--danger); }
.sb-logout svg { width: 15px; height: 15px; }

/* =============================================================================
   MAIN / TOPBAR
   ============================================================================= */

.main { margin-inline-start: var(--sidebar-w); min-height: 100vh; flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 32px 0;
  max-width: var(--content-max);
  margin-inline: auto; /* centered under the ceiling — same rule as .content */
  width: 100%;
}
.page-title { font-size: var(--fs-xxl); font-weight: 700; letter-spacing: -0.4px; }
.page-sub { font-size: var(--fs-sm); color: var(--text-2); margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.chip-live {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 13px;
  font-size: var(--fs-xs); color: var(--text-2);
  box-shadow: var(--shadow-sm);
}

.content {
  padding: 20px 32px 40px;
  max-width: var(--content-max);
  margin-inline: auto; /* fills up to the ceiling, centered — License+ pattern */
  width: 100%;
}

/* =============================================================================
   DOTS (freshness / liveness)
   ============================================================================= */

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.dot.glow { box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.15); }
.dot.amber { background: var(--warning); }
.dot.red { background: var(--danger); }
/* Neutral indicator: the base .dot is the SUCCESS colour, so a row that makes
   no freshness claim (not monitored, or silence not evaluated) had no way to
   avoid reading as healthy green. Uses the shared muted-text token. */
.dot.mute { background: var(--text-3); }

/* =============================================================================
   KPI TILES
   ============================================================================= */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
  position: relative; overflow: hidden;
}
.kpi:hover { box-shadow: var(--shadow-md); }
.kpi::after { content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px; background: transparent; }
.kpi.k-danger::after { background: var(--danger); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.9px; color: var(--text-3); font-weight: 600; }
.kpi-value { font-size: var(--fs-kpi); font-weight: 700; letter-spacing: -0.5px; font-family: var(--mono); }
.kpi-value.red { color: var(--danger); }
.kpi-value.green { color: var(--success); }
.kpi-sub { font-size: var(--fs-sm); color: var(--text-2); margin-top: 4px; }
.kpi-sub b { color: var(--danger); font-weight: 600; }

/* Icon chips — shared by KPIs and alert rows */
.ic { width: 34px; height: 34px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ic svg { width: 17px; height: 17px; }
.ic-blue { background: var(--primary-light); color: var(--primary); }
.ic-green { background: var(--success-bg); color: var(--success); }
.ic-red { background: var(--danger-bg); color: var(--danger); }
.ic-amber { background: var(--warning-bg); color: var(--warning); }

/* =============================================================================
   CARDS
   ============================================================================= */

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.card-hint { font-size: var(--fs-xs); color: var(--text-3); }
.card-body { padding: 6px 0; }
.card-body.pad { padding: 20px; }

.cards-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.cards-2 > .card { margin-bottom: 0; }
/* A column of stacked cards inside .cards-2. Grid alone cannot fill the space
   under a short card, because row 2 begins below the tallest row-1 item — so
   each column owns its own vertical flow instead. */
.card-col { display: flex; flex-direction: column; gap: 18px; }
.card-col > .card { margin-bottom: 0; }
/* Settings is the only user of .cards-2; side-by-side forms are unusable on
   a phone, so the grid collapses before the fields get too narrow to read.
   Columns then stack in source order: thresholds, watchman, email delivery. */
@media (max-width: 720px) {
  .cards-2 { grid-template-columns: 1fr; }
}

/* =============================================================================
   ALERT ROWS
   ============================================================================= */

.alert-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-light);
  border-inline-start: 3px solid transparent;
  transition: background var(--transition);
}
.alert-row:last-child { border-bottom: none; }
.alert-row:hover { background: var(--bg-card-alt); }
.alert-row.sev-critical { border-inline-start-color: var(--danger); }
.alert-row.sev-warn { border-inline-start-color: var(--warning); }
.alert-msg { flex: 1; min-width: 0; }
.alert-text { font-size: var(--fs-sm); font-weight: 500; }
.alert-meta { font-size: var(--fs-xs); color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.mail-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xxs); font-weight: 600;
  padding: 1px 8px; border-radius: var(--radius-pill);
  background: var(--success-bg); color: var(--success-fg);
  border: 1px solid var(--success-border);
}
.mail-chip.off { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--danger-border); }

/* =============================================================================
   BUTTONS
   ============================================================================= */

/* Author .btn display must not defeat the HTML hidden attribute (Reveal/Hide toggle). */
.btn[hidden],
[hidden] {
  display: none !important;
}
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-sm); font-weight: 600;
  padding: 8px 15px; border-radius: 7px;
  border: 1px solid transparent;
  transition: all var(--transition);
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(13, 110, 253, 0.3); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { border-color: var(--border); color: var(--text-2); background: var(--bg-card); }
.btn-ghost:hover:not(:disabled) { color: var(--text-1); box-shadow: var(--shadow-sm); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: var(--fs-xs); }
.btn-block { width: 100%; justify-content: center; }

/* =============================================================================
   TABLES
   ============================================================================= */

.tbl th {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-3); font-weight: 600;
  text-align: start;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-alt);
}
.tbl td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--fs-sm);
  vertical-align: middle;
}
.tbl th:first-child, .tbl td:first-child { padding-inline-start: 20px; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: var(--bg-card-alt); }
.tbl tr.dim { opacity: 0.55; }
.table-wrap { overflow-x: auto; }

.empty-state { text-align: center; color: var(--text-3); padding: 34px 20px; font-size: var(--fs-sm); }
/* §11/CSP: static spacing that was previously an inline style attribute. */
.empty-state-spaced { margin-top: 12px; }
.detail-callout-spaced { margin-top: 14px; }

/* §11: second-factor step on the login screen. */
.login-step-note { font-size: var(--fs-sm); color: var(--text-2); margin: 0 0 14px; }
.btn-link {
  background: none; border: none; color: var(--primary);
  font-size: var(--fs-sm); cursor: pointer; padding: 8px 0; margin-top: 4px;
}
.btn-link:hover { text-decoration: underline; }
/* ---- §11 two-factor -------------------------------------------------- */

/* Action row. Buttons group on one line and wrap together on narrow widths,
   instead of each sitting alone at full width. */
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.card-actions .btn { margin: 0; }

/* The destructive action is separated by the same divider every card uses
   for a secondary section, so "turn off" is never adjacent to a routine one. */
.card-danger-zone { padding-top: 14px; }
.card-danger-zone .card-hint { margin: 0; }

/* Recovery codes: a panel that takes over the card until acknowledged. */
.recovery-panel { display: flex; flex-direction: column; }
.recovery-warn {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--warning-bg); color: var(--warning-fg);
  border: 1px solid var(--warning-border); border-radius: var(--radius);
  padding: 12px 14px; font-size: var(--fs-sm); line-height: 1.5;
}
.recovery-warn b { font-size: var(--fs-sm); }

/* A grouped 16-character code is 19 characters wide — about 208px at 14px
   mono with this tracking. `auto-fit` drops to a single column whenever a
   cell would be narrower than that, at ANY viewport, rather than at one
   chosen breakpoint that squeezes at every width in between. The max-width
   keeps it to two columns on a wide card.
   THIS IS THE ONLY PLACE THE COLUMN COUNT IS DECIDED. A media query used to
   repeat the single-column case at 480px; two columns need 2x216 + 8 = 440px,
   which no viewport that narrow can offer, so the override only restated what
   auto-fit had already done — and a second declaration of a responsive rule
   is the one that gets edited when the first one is the one that matters. */
.backup-codes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 216px), 1fr));
  max-width: 440px; gap: 8px; margin: 14px 0 0;
  font-family: var(--mono); font-size: var(--fs-sm);
}
.backup-code {
  background: var(--bg-card-alt); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 9px 10px; text-align: center;
  letter-spacing: .1em; user-select: all;
  /* A code broken across two lines is misread and mistyped. */
  white-space: nowrap;
}

/* Setup: QR, key and confirmation field on one rhythm. */
.totp-setup { display: flex; flex-direction: column; gap: 12px; }
.totp-setup .card-hint { margin: 0; }
.totp-qr {
  display: block; width: 180px; height: 180px; align-self: center;
  background: #fff; padding: 8px; border: 1px solid var(--border-light);
  border-radius: var(--radius);
}
.totp-key {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-card-alt); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 10px 12px;
}
.totp-key-label {
  font-size: var(--fs-xxs); font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em;
}
.totp-secret {
  font-family: var(--mono); font-size: var(--fs-sm);
  letter-spacing: .12em; word-break: break-all; user-select: all; color: var(--text-1);
}

/* Narrow widths: a card's actions stack to full width so each stays a
   comfortable tap target. The code grid needs nothing here — it collapses on
   its own content, at every width; see .backup-codes above. */
@media (max-width: 480px) {
  .card-actions .btn { width: 100%; }
}

/* System identity cell */
.sys { display: flex; align-items: center; gap: 11px; }
.sys-chip {
  width: 34px; height: 34px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xxs); font-weight: 700; color: #fff; flex-shrink: 0;
}
/* §11/CSP: the chip palette. These moved out of an inline style attribute
   when the Content-Security-Policy dropped 'unsafe-inline' from style-src.
   The count is mirrored by CHIP_VARIANTS in app.js — keep them in step. */
.sys-chip-0 { background: linear-gradient(135deg, #0d6efd, #3b8bff); }
.sys-chip-1 { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.sys-chip-2 { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.sys-chip-3 { background: linear-gradient(135deg, #ea580c, #f97316); }
.sys-chip-4 { background: linear-gradient(135deg, #0891b2, #22d3ee); }
.sys-chip-5 { background: linear-gradient(135deg, #be185d, #ec4899); }

.sys-name { font-weight: 600; font-size: var(--fs-sm); color: var(--text-1); }
.sys-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 1px; }
/* System hub entry — same look as .sys-name; pointer + subtle hover + focus ring only. */
button.sys-link {
  display: inline;
  margin: 0; padding: 0;
  border: none; background: none;
  font: inherit; font-weight: 600; font-size: var(--fs-sm);
  color: var(--text-1); cursor: pointer;
  text-align: start; text-decoration: none;
}
button.sys-link:hover { color: var(--primary); }
button.sys-link:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 3px; }
.alert-system { margin-bottom: 4px; }
.alert-system .sys-link { font-size: var(--fs-sm); font-weight: 600; }
.system-unavailable-actions { margin-top: 16px; }
.system-hub .card { margin-bottom: 18px; }
/* License Details identity: keep hero type; still no underline. */
button.detail-identity-system.sys-link {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.35px;
  line-height: 1.2;
  word-break: break-word;
  color: var(--text-1);
  text-decoration: none;
}
button.detail-identity-system.sys-link:hover { color: var(--primary); text-decoration: none; }

/* System Details — Health snapshot tiles (no overlap; responsive grid) */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 12px;
  align-items: stretch;
}
.health-tile {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.health-tile-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-3);
  line-height: 1.3;
}
.health-tile-value {
  font-size: var(--fs-sm);
  color: var(--text-1);
  line-height: 1.45;
  min-width: 0;
  overflow-wrap: anywhere;
}
.health-tile-value .usage { min-width: 0; width: 100%; max-width: 100%; }
.health-tile-value .key { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.health-tile-value .pill { max-width: 100%; white-space: normal; }
.health-tile-meta {
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.4;
}
.health-tile-value .text-mute { color: var(--text-3); }
@media (max-width: 520px) {
  .health-grid { grid-template-columns: 1fr; }
}

/* License key */
.key {
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-2);
  background: var(--bg-card-alt); border: 1px solid var(--border-light);
  padding: 3px 8px; border-radius: 6px;
  white-space: nowrap;
}

/* Usage bar cell */
.usage { min-width: 130px; }
.usage-nums { font-size: var(--fs-xs); display: flex; justify-content: space-between; margin-bottom: 4px; }
.usage-nums .cap { color: var(--text-3); }
.usage-nums .over-num { color: var(--danger); font-weight: 700; }
.bar { height: 5px; border-radius: 3px; background: var(--border-light); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.bar i.warn { background: var(--warning); }
.bar i.over { background: var(--danger); }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-pill);
  white-space: nowrap;
  border: 1px solid;
}
.pill-ok { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-border); }
.pill-warn { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-border); }
.pill-bad { background: var(--danger-bg); color: var(--danger-fg); border-color: var(--danger-border); }
.pill-mute { background: var(--bg-card-alt); color: var(--text-2); border-color: var(--border); }
.pill-info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-border); }

/* Freshness cell */
.fresh { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); }
.fresh .late { color: var(--danger); font-weight: 600; }

/* Severity tags + count chips (errors page) */
.sev-tag { font-size: var(--fs-xxs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 8px; border-radius: 5px; }
.sev-tag.crit { background: var(--danger-bg); color: var(--danger-fg); }
.sev-tag.warn { background: var(--warning-bg); color: var(--warning-fg); }
.count-chip {
  font-family: var(--mono); font-weight: 700; font-size: var(--fs-xs);
  background: var(--bg-card-alt); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 9px;
}

/* Row actions (appear on hover) */
.row-actions { display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition); justify-content: flex-end; }
tr:hover .row-actions { opacity: 1; }
/* Always-visible actions (L5 license View — keyboard accessible) */
.row-actions-visible { opacity: 1; }
.mini-btn {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: all 0.12s;
}
.mini-btn:hover { background: var(--primary-light); color: var(--primary); }
.mini-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); opacity: 1; }
.mini-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.mini-btn svg { width: 14px; height: 14px; }

/* License list Actions column (default last-col end-align for action-only tables) */
.tbl th:last-child {
  text-align: end;
}
.col-actions {
  text-align: end;
  vertical-align: middle;
  width: 1%;
  white-space: nowrap;
}
/* Column alignment: header + body share the same class (after last-child so typed cols win). */
.tbl th.num,
.tbl td.num {
  text-align: end;
}
.tbl th.col-status,
.tbl td.col-status {
  text-align: center;
}
.tbl th.col-date,
.tbl td.col-date {
  text-align: start;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.tbl th.col-actions,
.tbl td.col-actions {
  text-align: end;
}
/*
 * System Details tables only: header + cell content share one start edge.
 * All columns left-aligned; Actions alone end-aligned. No center/end on num/status.
 * (Cells use span.num for mono digits without td.num text-align.)
 */
.system-hub .tbl th,
.system-hub .tbl td {
  text-align: start;
  vertical-align: middle;
}
/* Beat .tbl th:last-child { text-align: end } when last col is not Actions (e.g. Received). */
.system-hub .tbl thead th:last-child:not(.col-actions) {
  text-align: start;
}
.system-hub .tbl th.col-actions,
.system-hub .tbl td.col-actions {
  text-align: end;
}
/* Key chip / status pill: outer box starts at the cell content edge (same as header text). */
.system-hub .tbl td > .key,
.system-hub .tbl td > .pill {
  margin: 0;
  vertical-align: middle;
}
.system-hub .tbl td > .pill {
  justify-content: flex-start;
}
.table-action-btn {
  min-height: 34px;
  min-width: 72px;
  padding: 6px 12px;
  gap: 6px;
  justify-content: center;
  color: var(--text-1);
  border-color: var(--border);
}
.table-action-btn:hover:not(:disabled) {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}
.table-action-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* License details modal — polished section layout (wide modal) */
.license-detail {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.detail-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.detail-section-heading {
  margin: 0;
  font-size: var(--fs-xxs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
/* Identity: system is the hero; status sits to the side */
.detail-section-identity { gap: 10px; }
.detail-identity {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 20px;
  flex-wrap: wrap;
}
.detail-identity-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 12rem;
}
.detail-identity-system {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.35px;
  line-height: 1.2;
  word-break: break-word;
}
.detail-identity-company {
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.4;
}
.detail-identity-status {
  flex: 0 0 auto;
  padding-top: 2px;
}

/* Registration key: one soft panel, accent edge, no nested boxes */
.detail-section-key {
  background: linear-gradient(180deg, var(--bg-card-alt) 0%, #fff 100%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.detail-key-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.detail-key-chip,
.detail-key-display .key {
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.02em;
  word-break: break-all;
  white-space: normal;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.key-access {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.key-access-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.key-access-actions .btn {
  min-height: 34px;
}
.key-access-hint {
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.5;
  margin: 0;
  max-width: 40rem;
}
.key-security-details {
  margin: 0;
  max-width: 40rem;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}
.key-security-details summary {
  cursor: pointer;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
  padding: 2px 0;
  user-select: none;
}
.key-security-details summary:hover { color: var(--text-1); }
.key-security-details summary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 3px;
}
.key-security-details[open] summary { margin-bottom: 8px; }
.key-security-details .key-access-clipboard {
  margin: 0;
  padding: 8px 10px;
  background: var(--bg-card);
  border-radius: 7px;
  border: 1px solid var(--border-light);
}

/* Contract: value-first stats (readable hierarchy) */
.detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.detail-stats-primary {
  gap: 12px 16px;
}
.detail-stats-meta {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  gap: 10px 14px;
}
.detail-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-card-alt);
  border: 1px solid transparent;
}
.detail-stats-primary .detail-stat {
  border-color: var(--border-light);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.detail-stats-meta .detail-stat {
  padding: 6px 0;
  background: transparent;
  border: none;
}
.detail-stat-value {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.35;
  word-break: break-word;
}
.detail-stats-primary .detail-stat-value {
  font-size: var(--fs-md);
  letter-spacing: -0.15px;
}
.detail-stat-unit {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-3);
}
.detail-stat-label {
  font-size: var(--fs-xxs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
@media (min-width: 560px) {
  .detail-stats-primary { grid-template-columns: 1fr 1fr; }
  .detail-stats-meta { grid-template-columns: 1fr 1fr 1fr; }
}
@media (min-width: 640px) {
  .detail-stats-primary { grid-template-columns: 1.2fr 1fr 1fr 0.7fr; }
}

/* Shared fact/relationship lines (predecessor etc.) */
.detail-line {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-light);
}
.detail-line-full { grid-column: 1 / -1; }
.detail-label {
  flex: 0 0 auto;
  min-width: 5.5rem;
  color: var(--text-3);
  font-weight: 600;
  font-size: var(--fs-xxs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.detail-callout {
  margin-top: 2px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1.45;
}
.detail-callout-title {
  font-size: var(--fs-xxs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.detail-callout-body {
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.detail-relationships {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-relationships .detail-line .key {
  font-size: var(--fs-xs);
}

/* Actions: manage vs end-registration */
.detail-section-actions { gap: 14px; }
.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.detail-actions-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-actions-label {
  font-size: var(--fs-xxs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
}
.detail-actions-primary,
.detail-actions-danger {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}
.detail-actions-group-danger {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
}
.detail-actions-group-danger .detail-actions-label {
  color: var(--danger-fg);
}
.detail-actions-group-danger .action-why {
  color: var(--danger-fg);
  opacity: 0.85;
}
.action-disabled { display: flex; flex-direction: column; gap: 4px; max-width: 300px; }
.action-why { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.4; }

@media (max-width: 559px) {
  .license-detail { gap: 18px; }
  .detail-section-key { padding: 14px 12px 12px; }
  .detail-identity-system { font-size: var(--fs-lg); }
  .detail-stats,
  .detail-stats-primary,
  .detail-stats-meta {
    grid-template-columns: 1fr 1fr;
  }
  .detail-actions-primary,
  .detail-actions-danger {
    flex-direction: column;
    align-items: stretch;
  }
  .detail-actions-primary .btn,
  .detail-actions-danger .btn,
  .detail-actions-primary .action-disabled,
  .detail-actions-danger .action-disabled {
    width: 100%;
    max-width: none;
  }
  .detail-actions-primary .btn,
  .detail-actions-danger .btn {
    justify-content: center;
  }
  .action-disabled .btn { width: 100%; }
  .key-access-actions .btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    justify-content: center;
  }
}
.link-btn {
  background: none; border: none; color: var(--primary); font-size: var(--fs-xs);
  font-weight: 600; padding: 0 4px; cursor: pointer; text-decoration: underline;
}
.link-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 3px; }
.modal-warn {
  font-size: var(--fs-sm); color: var(--text-2); margin: 0 0 14px;
  padding: 10px 12px; background: var(--warning-bg); border: 1px solid var(--warning-border);
  border-radius: 7px; line-height: 1.45;
}
.field textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-card);
  font-family: inherit;
  resize: vertical;
  min-height: 72px;
}
.field textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.modal:focus { outline: none; }

/* =============================================================================
   TOOLBAR / FILTER CHIPS / NOTE
   ============================================================================= */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-reports {
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
}
.toolbar-reports .card-hint { align-self: flex-end; margin-top: -28px; }
/* Main Reports — UTC received-date filters + export (existing field/button tokens) */
.reports-date-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  width: 100%;
}
.reports-date-field {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
}
.reports-date-label { line-height: 1.2; }
.reports-date-input {
  font: inherit;
  font-weight: 600;
  color: var(--text-1);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  min-height: 34px;
}
.reports-date-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.reports-date-bar .btn { align-self: flex-end; }
/* Shared list pagination (Reports, System Details Recent reports, future Errors) */
.list-pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 16px; width: 100%;
  padding-top: 4px;
}
.list-pager-range { font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }
.list-pager-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.list-pager-page-size {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); color: var(--text-2); font-weight: 600;
}
.list-pager-page-size select {
  font: inherit; font-weight: 600;
  padding: 4px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-1);
}
@media (max-width: 720px) {
  .toolbar-reports .card-hint { align-self: flex-start; margin-top: 0; }
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: var(--fs-xs); font-weight: 600;
  padding: 6px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-2);
  transition: all var(--transition);
}
.chip:hover { color: var(--text-1); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
/* System/customer chips stay pill-style; license filter is a distinct control group */
.chip-system.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.license-filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  width: 100%;
  padding: 10px 12px;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius);
}
.license-filter-caption {
  font-size: var(--fs-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--info-fg);
  flex: 0 0 auto;
}
.chip-license {
  cursor: default;
  background: var(--bg-card);
  border: 1px solid var(--info-border);
  color: var(--text-1);
  border-radius: 8px;
  max-width: min(100%, 520px);
  padding: 7px 12px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-align: start;
  line-height: 1.35;
}
.chip-license:hover { color: var(--text-1); }
.chip-license-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip-license-clear {
  border-style: dashed;
  border-color: var(--info-border);
  color: var(--info-fg);
  background: transparent;
  font-weight: 700;
}
.chip-license-clear:hover {
  background: var(--bg-card);
  color: var(--text-1);
  border-color: var(--text-3);
}

.note {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--info-bg); border: 1px solid var(--info-border);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: var(--fs-sm); color: var(--info-fg);
  margin-bottom: 16px;
}
.note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

/* =============================================================================
   FORMS
   ============================================================================= */

.field { margin-bottom: 15px; }
.field label { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  padding: 9px 12px;
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-card);
  transition: all var(--transition);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.field .hint { font-size: var(--fs-xs); color: var(--text-3); margin-top: 5px; }
.field input.mono { font-family: var(--mono); font-size: var(--fs-xs); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Boolean controls. The box must not inherit the full-width input rule, and
   the label sits beside it rather than above it. */
.field-check { margin-bottom: 10px; }
.field-check label.check-line {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 0; cursor: pointer;
}
.field-check input[type="checkbox"] {
  width: 16px; height: 16px; flex: 0 0 auto;
  padding: 0; margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.field-check input[type="checkbox"]:focus-visible {
  outline: none; box-shadow: var(--focus-ring); border-radius: 3px;
}
.field-check .hint { margin-left: 26px; }

/* Grouped booleans (per-alert-type email toggles). */
.field-set {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px 14px 10px;
}
.field-set legend {
  font-size: var(--fs-sm); font-weight: 600;
  padding: 0 6px;
}
.field-set .field-check:last-of-type { margin-bottom: 4px; }

/* Live status appended below a card's form controls. */
.card-subsection { margin-top: 18px; border-top: 1px solid var(--border-light); }

.form-error {
  background: var(--danger-bg); color: var(--danger-fg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: var(--fs-sm);
  margin-bottom: 14px;
}

/* =============================================================================
   MODAL
   ============================================================================= */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(16, 20, 28, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 9vh;
  z-index: var(--z-modal);
}
.modal {
  background: var(--bg-card);
  border-radius: 14px;
  width: 480px; max-width: calc(100vw - 32px);
  max-height: 84vh; overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: modal-pop 0.18s ease;
}
/* License details only — Register / Cancel / Delete / Customer stay 480px.
   Wide modal: sticky head/foot with internal body scroll on short screens. */
.modal.modal-wide {
  width: min(740px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: min(88vh, 900px);
}
.modal.modal-wide .modal-head,
.modal.modal-wide .modal-foot {
  flex-shrink: 0;
}
.modal.modal-wide .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
@keyframes modal-pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.modal-title { font-size: var(--fs-lg); font-weight: 700; }
.modal-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.modal-x {
  width: 30px; height: 30px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  font-size: var(--fs-lg); line-height: 1;
}
.modal-x:hover { background: var(--bg-card-alt); color: var(--text-1); }
.modal-body { padding: 20px 22px; }
.modal-foot {
  padding: 15px 22px;
  border-top: 1px solid var(--border-light);
  display: flex; justify-content: flex-end; gap: 9px;
  background: var(--bg-card-alt);
}
@media (max-width: 559px) {
  .modal-backdrop { padding-top: 4vh; align-items: flex-start; }
  .modal.modal-wide {
    width: calc(100vw - 20px);
    max-height: 92vh;
  }
  .modal.modal-wide .modal-body { padding: 16px 16px; }
  .modal.modal-wide .modal-head,
  .modal.modal-wide .modal-foot { padding-left: 16px; padding-right: 16px; }
}

/* =============================================================================
   HELP PAGE (lifecycle guide — derived from owner runbook)
   Same outer bounds as .content (Reports/Licenses/etc.): no extra page max-width.
   Desktop: sticky TOC (~260–300px) | guide fills remaining width. Narrow: stack.
   ============================================================================= */

.help-page {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: 24px 32px;
  align-items: start;
  width: 100%;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
}
.help-main {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: none; /* fill remaining column — do not narrow the whole guide */
}
/* Typography: inherit app scale (body --fs-base, .note/.tbl/.nav-item/.card-title).
   Do not redeclare sizes that already exist on shared classes. */

.help-intro {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  /* .note supplies --fs-sm, colors, padding */
}
.help-intro > div {
  flex: 1 1 0%;
  min-width: 0;
  max-width: none;
}
.help-intro p {
  margin: 0 0 10px;
  /* size/color from .note */
  line-height: 1.5;
  max-width: none;
  width: 100%;
}
.help-intro p:last-child { margin-bottom: 0; }
.help-intro-auth {
  /* slightly quieter second line — same size as .card-hint */
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.5;
  max-width: none;
  width: 100%;
}
.help-code {
  font-family: var(--mono);
  /* inherit parent size — no 0.92em shrink */
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--text-2);
}
.help-toc {
  position: sticky;
  top: 12px;
  align-self: start;
  padding: 16px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* Match .card-title */
.help-toc-heading {
  margin: 0 0 12px;
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-1);
}
.help-toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.help-toc-list li { margin: 0; }
/* Match .nav-item text size (sidebar uses --fs-sm) */
.help-toc-link {
  display: block;
  width: 100%;
  padding: 7px 10px;
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-2);
  text-align: start;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.help-toc-link:hover {
  color: var(--primary);
  background: var(--primary-light);
}
.help-toc-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  color: var(--primary);
}
.help-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}
.help-section {
  padding: 20px 22px 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 16px;
  width: 100%;
  box-sizing: border-box;
}
.help-section:focus { outline: none; }
.help-section:focus-visible {
  box-shadow: var(--focus-ring);
}
/* Section titles: same scale as .card-title (not a shrunk “doc” heading) */
.help-section-title {
  margin: 0 0 6px;
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-1);
  line-height: 1.3;
}
/* Match .card-hint / table meta */
.help-runbook-ref {
  margin: 0 0 14px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-3);
  text-transform: none;
}
/* Body copy: inherit body --fs-base (same as html/body default) */
.help-p {
  margin: 0 0 12px;
  line-height: 1.55;
  color: var(--text-2);
  max-width: none;
}
.help-list {
  margin: 0 0 12px;
  padding: 0 0 0 1.35rem;
  line-height: 1.55;
  color: var(--text-2);
  max-width: none;
}
.help-list li { margin: 0 0 8px; }
.help-list li:last-child { margin-bottom: 0; }
.help-table-wrap {
  margin: 0 0 12px;
  width: 100%;
  max-width: none;
}
.help-table {
  width: 100%;
  max-width: none;
}
/* Rely on .tbl th / .tbl td for font-size — do not redeclare */
.help-table th,
.help-table td {
  vertical-align: top;
}
.help-callout {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
/* Match .kpi-label / uppercase meta labels */
.help-callout-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--warning-fg);
  margin-bottom: 6px;
}
/* Same as .note / alert body text */
.help-callout-body {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--warning-fg);
  max-width: none;
}

/* Narrow: single column, TOC above guide (same page padding as other routes) */
@media (max-width: 900px) {
  .help-page {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .help-toc {
    position: static;
    max-height: none;
    width: 100%;
    order: 0;
  }
  .help-main {
    width: 100%;
    order: 1;
  }
  .help-toc-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
  }
}
@media (max-width: 559px) {
  .help-page { gap: 14px; }
  .help-section { padding: 16px 14px; }
  .help-toc { padding: 12px; }
  .help-toc-list { grid-template-columns: 1fr; }
}

/* =============================================================================
   SETTINGS STATUS LINES
   ============================================================================= */

.status-line {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--fs-sm);
}
.status-line:last-child { border-bottom: none; }

/* Card action below the status lines — breathing room from the last rule. */
#watchman-body .btn { margin-top: 16px; }

/* =============================================================================
   TOAST
   ============================================================================= */

.toast-container {
  position: fixed;
  bottom: 22px; inset-inline-end: 22px;
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--text-1); color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 10px 16px;
  font-size: var(--fs-sm);
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* Re-authentication form: same vertical rhythm as the setup view. */
.reauth-form { display: flex; flex-direction: column; gap: 4px; }
.reauth-form .field { margin-bottom: 0; }
