/* Sit Happens backoffice. Design tokens follow the owner's CRTBrains project (frontend/src/styles.css): the same slate
   neutrals, one calm blue accent, 8 px radii, Inter or the system font, the dark sidebar and the light content area.
   Written anew here; no code or branding of that project is copied. No inline styles anywhere (strict CSP). */

:root {
  --c-bg: #f5f7fa;
  --c-surface: #ffffff;
  --c-surface-2: #f0f3f7;
  --c-sidebar: #0f1623;
  --c-sidebar-2: #1a2333;
  --c-text: #1c2430;
  --c-text-muted: #5b6776;
  --c-text-faint: #8a96a5;
  --c-border: #dde3ec;
  --c-border-strong: #c6cfdc;
  --c-accent: #2f6df0;
  --c-accent-hover: #245ad6;
  --c-accent-soft: #e8effd;
  --c-danger: #d23c3c;
  --c-danger-soft: #fbe9e9;
  --c-success: #1f9d5a;
  --c-success-soft: #e4f5ec;
  --c-warn: #c2840a;
  --c-warn-soft: #fbf2d9;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 22, 35, 0.06);
  --shadow: 0 2px 8px rgba(15, 22, 35, 0.08);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); color: var(--c-text); background: var(--c-bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 650; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* App shell + sidebar */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { background: var(--c-sidebar); color: #e7edf6; display: flex; flex-direction: column; min-height: 0; padding: 18px 14px; overflow: hidden; }
.sidebar-header { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.sidebar-brand { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: 0.2px; line-height: 1.2; }
.sidebar-sub { font-size: 12px; color: #8595a8; }
.nav { display: flex; flex-direction: column; gap: 10px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { padding: 4px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7a8e; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); color: #aab6c6; font-size: 14px; font-weight: 500; transition: background 0.12s, color 0.12s; }
.nav-link:hover { background: var(--c-sidebar-2); color: #fff; text-decoration: none; }
.nav-link-active, .nav-link-active:hover { background: var(--c-accent); color: #fff; }
.ico { flex: 0 0 auto; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 12px; margin-top: 8px; }
.user-card { padding: 2px 10px 8px; }
.user-id { font-size: 13px; font-weight: 600; color: #e7edf6; }
.user-role { font-size: 12px; color: #8595a8; }
.sidebar-actions { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 4px; }
.sidebar-actions form { margin: 0; }

/* Content */
.content { min-height: 0; overflow-y: auto; padding: 28px 32px 48px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-header p { color: var(--c-text-muted); margin: 0; max-width: 820px; }

/* Cards, tiles, grids */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-note { color: var(--c-text-muted); font-size: 13px; margin: 4px 0 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + .grid-2 { margin-top: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 16px; }
.tile-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--c-text-muted); }
.tile-value { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.2; }
.tile-sub { font-size: 12.5px; color: var(--c-text-muted); margin-top: 2px; }
.tile-good { border-left: 4px solid var(--c-success); }
.tile-warn { border-left: 4px solid var(--c-warn); }
.tile-bad { border-left: 4px solid var(--c-danger); }
.empty-state { text-align: center; color: var(--c-text-muted); padding: 32px 20px; border: 1px dashed var(--c-border-strong); border-radius: var(--radius); background: var(--c-surface); }

/* Forms and buttons */
.filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--c-text-muted); }
.field-label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }
.input, .select { width: 100%; padding: 8px 10px; border: 1px solid var(--c-border-strong); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; color: var(--c-text); background: #fff; }
.filters .select, .filters .input { width: auto; min-width: 120px; }
.input:focus, .select:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
.input-code { font-family: var(--mono); letter-spacing: 3px; font-size: 18px; text-align: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-primary { background: var(--c-accent); color: #fff; }
.btn-primary:hover { background: var(--c-accent-hover); }
.btn-secondary { background: #fff; border-color: var(--c-border-strong); color: var(--c-text); }
.btn-secondary:hover { background: var(--c-surface-2); }
.btn-ghost { background: transparent; color: #aab6c6; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.form-error { margin-top: 12px; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--c-danger-soft); color: var(--c-danger); font-size: 13px; border: 1px solid #f0cccc; }
.notice { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--c-accent-soft); color: var(--c-accent-hover); font-size: 13px; border: 1px solid #cfe0fb; margin-bottom: 16px; }
.notice-warn { background: var(--c-warn-soft); color: #8a5d00; border-color: #f0dfb0; }
.form-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--c-border); white-space: nowrap; }
.table th { background: var(--c-surface-2); font-weight: 600; color: var(--c-text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--c-surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-compact th, .table-compact td { padding: 6px 12px; }
.table td.wrap { white-space: normal; }
.table-view { margin-top: 10px; }
.table-view summary { cursor: pointer; color: var(--c-text-muted); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.frames { margin: 0; padding-left: 18px; font-family: var(--mono); font-size: 12px; color: var(--c-text-muted); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge-neutral { background: var(--c-surface-2); color: var(--c-text-muted); }
.badge-accent { background: var(--c-accent-soft); color: var(--c-accent-hover); }
.badge-success { background: var(--c-success-soft); color: var(--c-success); }
.badge-danger { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-warn { background: var(--c-warn-soft); color: var(--c-warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* Charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .ax { font-size: 11px; fill: var(--c-text-muted); font-family: var(--font); }
.chart .lbl { font-size: 12.5px; fill: var(--c-text); font-family: var(--font); }
.chart .val { font-size: 12.5px; fill: var(--c-text); font-family: var(--font); font-variant-numeric: tabular-nums; font-weight: 600; }
.chart .hit:hover { fill: rgba(47, 109, 240, 0.06); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--c-text-muted); margin-bottom: 6px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.meter { vertical-align: middle; margin-left: 8px; }

/* Server cards on the live page */
.server-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.server-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.server-card-missing { border-color: #f0cccc; background: #fffafa; }
.server-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.server-card-name { font-weight: 650; font-size: 15px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; }
.kv dt { color: var(--c-text-muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.live-state { font-size: 12.5px; }

/* Login */
.login-body { background: #0c121d; }
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(120% 80% at 50% -10%, #1b2740 0%, #0f1623 55%, #0c121d 100%); padding: 24px; }
.login-card { width: 100%; max-width: 420px; background: var(--c-surface); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); padding: 30px 28px 28px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-name { font-size: 20px; font-weight: 700; line-height: 1.2; }
.login-sub { font-size: 13px; color: var(--c-text-muted); }
.login-card h1 { font-size: 18px; }
.login-card p { color: var(--c-text-muted); margin: 0 0 6px; font-size: 13.5px; }
.qr { display: flex; justify-content: center; margin: 16px 0 10px; }
.qr svg { width: 220px; height: 220px; border: 1px solid var(--c-border); border-radius: var(--radius); padding: 8px; background: #fff; }
.secret { font-family: var(--mono); font-size: 13px; background: var(--c-surface-2); border-radius: var(--radius-sm); padding: 8px 10px; word-break: break-all; text-align: center; letter-spacing: 1px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; font-family: var(--mono); font-size: 15px; background: var(--c-surface-2); border-radius: var(--radius); padding: 14px 18px; margin: 12px 0; }

/* AI findings */
.finding { border-left: 3px solid var(--c-accent); padding: 6px 0 6px 12px; margin: 10px 0; }
.finding h3 { margin: 0 0 4px; }
.finding p { margin: 0; color: var(--c-text); }
.finding .evidence { color: var(--c-text-muted); font-size: 12.5px; margin-top: 4px; }
pre.preview { background: var(--c-surface-2); border-radius: var(--radius); padding: 12px; max-height: 320px; overflow: auto; font-size: 12px; }

@media (max-width: 1000px) {
  .grid-2, .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { padding: 12px; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav-group { flex-direction: row; }
  .nav-group-label { display: none; }
  .content { padding: 20px 16px 40px; }
}
/* "2FA is off" on every page while the owner has not turned it on (optional since 2026-11-25). */
.banner-2fa { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius-sm); background: var(--c-warn-soft); color: #8a5d00; border: 1px solid #f0dfb0; font-size: 13px; }
.banner-2fa strong { font-weight: 650; }
/* The MUST screens (docs/design.md 9): small samples greyed, the heat map and its legend, change-log markers. */
.small-n { color: var(--c-text-faint, #9aa6b8); }
.chart.heat { max-height: 680px; background: #e8f5e1; border-radius: var(--radius-sm); }
.map-label { font-size: 11px; fill: #1f3a68; font-weight: 600; paint-order: stroke; stroke: #ffffff; stroke-width: 3px; }
.heat-legend { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--c-text-muted, #5b6b82); }
.marker line { pointer-events: none; }
.filter-wide { flex: 1 1 280px; }
.filter-wide .input { width: 100%; }

/* The API docs page: Swagger UI's own styles, inside a card. */
.swagger-card { padding: 8px 12px; }
.swagger-card .swagger-ui .information-container { padding: 0; }
pre.preview-wrap { white-space: pre-wrap; overflow-wrap: anywhere; max-height: none; }
