/* BadgeLock console — visual system
   Subject: badge readers on walls, locked workstations, audit trails. The console borrows the reader's own
   status language (an LED per computer, a dark faceplate for state) and otherwise stays quiet: cool paper,
   white cards, one cobalt for actions, monospace for anything a reader or a log produced. */

:root {
  --ink: #111826; --ink-2: #1A2333; --ink-3: #26334A;
  --paper: #F2F4F7; --card: #FFFFFF; --line: #E4E8EE; --line-2: #C9D1DC;
  --text: #18202B; --muted: #5E6A79; --faint: #8B95A4;
  --cobalt: #2B4ACB; --cobalt-2: #1F3AA8; --cobalt-soft: #E9EDFB;
  --led-green: #22C55E; --led-amber: #F5A524; --led-red: #E5484D; --led-grey: #B3BBC7;
  --green-soft: #E4F7EB; --green-ink: #166534; --amber-soft: #FDF1DC; --amber-ink: #8A5A00; --red-soft: #FCE8E9; --red-ink: #9F1D22;
  --radius: 12px; --radius-sm: 8px;
  /* Native system type: Segoe UI on Windows, San Francisco on macOS. Nothing downloaded, nothing to load. */
  --font-display: -apple-system, "Segoe UI Variable Display", "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
  --font-body: -apple-system, "Segoe UI Variable Text", "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font: 14px/1.5 var(--font-body); }
a { color: var(--cobalt); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid rgba(43, 74, 203, .35); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: 0; margin: 0; }
h1 { font-size: 26px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }

/* ---------- top bar ---------- */
header.top { display: flex; align-items: center; gap: 28px; height: 56px; padding: 0 28px; background: var(--ink); color: #DCE2EC; }
header .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 16px; }
header .brand:hover { text-decoration: none; }
header .brand .logo { display: inline-block; width: 14px; height: 14px; border: 2px solid #7FA0FF; border-radius: 3px; position: relative; }
header .brand .logo::after { content: ""; position: absolute; inset: 3px; background: #7FA0FF; border-radius: 1px; }
header nav { display: flex; gap: 4px; height: 100%; }
header nav a { display: flex; align-items: center; padding: 0 12px; color: #B7C0CE; font-weight: 500; border-bottom: 2px solid transparent; border-top: 2px solid transparent; }
header nav a:hover { color: #fff; text-decoration: none; }
header nav a.active { color: #fff; border-bottom-color: #7FA0FF; }
header .who { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; }
header .who a { color: #DCE2EC; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid #3C4B66; border-radius: 999px; font-size: 12px; color: #DCE2EC; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #7FA0FF; }
button.link { background: none; border: 0; padding: 0; color: #B7C0CE; font: inherit; cursor: pointer; }
button.link:hover { color: #fff; text-decoration: underline; }

/* ---------- page frame ---------- */
main { max-width: 1180px; margin: 28px auto 60px; padding: 0 28px; }
main.narrow { max-width: 420px; margin-top: 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; }

/* ---------- LEDs (the signature) ---------- */
.dot, .led { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; background: var(--led-grey); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.dot.ok, .led.ok { background: var(--led-green); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.warn, .led.warn { background: var(--led-amber); box-shadow: 0 0 0 3px rgba(245,165,36,.18); }
.dot.bad, .led.bad { background: var(--led-red); box-shadow: 0 0 0 3px rgba(229,72,77,.18); }
.dot.off, .led.off { background: var(--led-grey); }

/* ---------- faceplate: the reader on the wall ---------- */
.faceplate { background: var(--ink); color: #E6EAF1; border-radius: var(--radius); padding: 22px 26px; display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 24px 32px; align-items: center; margin-bottom: 18px; }
.faceplate dl, .faceplate dt, .faceplate dd { margin: 0; }
.faceplate .state { display: flex; align-items: center; gap: 14px; }
.faceplate .led { width: 18px; height: 18px; margin: 0; flex: none; }
.faceplate .led.ok { box-shadow: 0 0 0 5px rgba(34,197,94,.22), 0 0 24px rgba(34,197,94,.45); animation: breathe 2.6s ease-in-out infinite; }
.faceplate .led.warn { box-shadow: 0 0 0 5px rgba(245,165,36,.22), 0 0 18px rgba(245,165,36,.35); }
.faceplate .led.bad { box-shadow: 0 0 0 5px rgba(229,72,77,.22), 0 0 18px rgba(229,72,77,.35); }
.faceplate .led.off { background: #4B5566; }
.faceplate .word { font-family: var(--font-display); font-size: 24px; font-weight: 600; line-height: 1.1; color: #fff; }
.faceplate .who { color: #B7C0CE; margin-top: 2px; }
.faceplate .facts { display: grid; grid-template-columns: repeat(5, minmax(0, auto)); gap: 14px 28px; justify-content: start; }
@media (max-width: 1100px) { .faceplate .facts { grid-template-columns: repeat(3, minmax(0, auto)); } }
.faceplate .fact .k { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #7E8A9C; margin-bottom: 3px; }
.faceplate .fact .v { font-size: 13.5px; color: #E6EAF1; white-space: nowrap; }
.faceplate .fact .v.mono { font-size: 13px; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .faceplate .led.ok { animation: none; } }

/* ---------- cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.card > h2:first-child, .card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.card-title .hint { font: 12px/1.4 var(--font-body); color: var(--muted); font-weight: 400; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 18px; align-items: start; }
.stack > .card { margin-bottom: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .faceplate { grid-template-columns: 1fr; } header.top { padding: 0 16px; gap: 16px; } main { padding: 0 16px; } }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .n { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, tr:hover td { background: #F8F9FB; }
td.time, .time { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.empty { color: var(--muted); padding: 18px 0 6px; }

/* ---------- badge credential chip ---------- */
.badge-chip { display: inline-block; font-family: var(--font-mono); font-size: 13px; letter-spacing: .06em; padding: 3px 9px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--paper); color: var(--text); }
.badge-hero { font-family: var(--font-mono); font-size: 28px; letter-spacing: .1em; padding: 16px 18px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--paper); text-align: center; }
code.big { display: block; font-family: var(--font-mono); font-size: 22px; letter-spacing: .1em; padding: 12px 16px; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius-sm); margin: 8px 0; text-align: center; }
pre.cmd { font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; background: var(--ink-2); color: #DCE2EC; padding: 12px 14px; border-radius: var(--radius-sm); margin: 8px 0; }

/* ---------- forms ---------- */
form.inline { display: inline; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.field label { margin: 0; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; font-weight: 400; }
input, select, textarea { font: inherit; color: var(--text); padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; min-width: 180px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(43,74,203,.15); }
input[type=checkbox] { min-width: 0; width: 16px; height: 16px; accent-color: var(--cobalt); margin: 0; }
input.mono { font-family: var(--font-mono); letter-spacing: .05em; }
.w-full { width: 100%; }
.help { font-size: 12px; color: var(--muted); }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--cobalt); background: var(--cobalt); color: #fff; cursor: pointer; white-space: nowrap; }
button:hover, .btn:hover { background: var(--cobalt-2); border-color: var(--cobalt-2); text-decoration: none; }
button.secondary, .btn.secondary { background: #fff; color: var(--text); border-color: var(--line-2); }
button.secondary:hover, .btn.secondary:hover { background: var(--paper); }
button.danger, .btn.danger { background: #fff; color: var(--red-ink); border-color: #F0B4B7; }
button.danger:hover, .btn.danger:hover { background: var(--red-soft); border-color: var(--led-red); }
button.small, .btn.small { padding: 4px 10px; font-size: 12.5px; }
.danger-zone { border-color: #F0B4B7; }
.danger-zone p { margin: 0 0 10px; color: var(--muted); }

/* ---------- messages ---------- */
.flash { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid transparent; }
.flash.ok { background: var(--green-soft); color: var(--green-ink); border-color: #BFE7CB; }
.flash.err { background: var(--red-soft); color: var(--red-ink); border-color: #F0B4B7; }
.validation-summary-errors, .field-validation-error { color: var(--red-ink); font-size: 13px; }
.validation-summary-errors ul { margin: 0 0 10px; padding-left: 18px; }

/* ---------- event tags ---------- */
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: #EEF1F5; color: #3A4556; white-space: nowrap; }
.tag.unlock { background: var(--green-soft); color: var(--green-ink); }
.tag.denied, .tag.emergency_failed, .tag.reader_error { background: var(--red-soft); color: var(--red-ink); }
.tag.emergency_override { background: var(--amber-soft); color: var(--amber-ink); }
.tag.lock_idle, .tag.lock_manual, .tag.lock_switch { background: #EEF1F5; color: #3A4556; }
.tag.agent_start, .tag.agent_stop { background: var(--cobalt-soft); color: var(--cobalt-2); }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
