:root {
  --bg: #f6f6f9;
  --surface: #ffffff;
  --ink: #12131a;
  --muted: #5f6173;
  --line: #e3e3ec;
  --brand: #2443c9;
  --brand-ink: #ffffff;
  --brand-soft: #e6eaff;
  --ok: #157f3b;
  --ok-soft: #e3f5e9;
  --warn: #9a5b00;
  --warn-soft: #fff1d6;
  --bad: #b42318;
  --bad-soft: #fde7e4;
  --radius: 12px;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1016; --surface: #181922; --ink: #ececf3; --muted: #a0a2b5; --line: #2a2b38;
    --brand: #7d96ff; --brand-ink: #0c1430; --brand-soft: #1f2b52;
    --ok: #5fd08a; --ok-soft: #173322; --warn: #f2b65a; --warn-soft: #3a2a10; --bad: #ff8a7a; --bad-soft: #3d1a17;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 8px 18px; color: var(--ink); }
.logo:hover { text-decoration: none; }
.mark { width: 26px; height: 26px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; color: var(--brand-ink); font-size: 14px; font-weight: 800; }
.side a.nav { color: var(--muted); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.side a.nav:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.side a.nav.active { background: var(--brand-soft); color: var(--brand); }
.side .grow { flex: 1; }
.side form button { width: 100%; }
.main { padding: 28px 32px 60px; max-width: 1180px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.sub { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }

.flash { background: var(--brand-soft); color: var(--ink); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }
.alert { border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 12px; }
.alert.info { background: var(--brand-soft); }
.alert.warning { background: var(--warn-soft); color: var(--warn); }
.alert.critical { background: var(--bad-soft); color: var(--bad); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); padding: 16px 8px; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.pill.ok, .pill.active { background: var(--ok-soft); color: var(--ok); }
.pill.late, .pill.warning, .pill.new { background: var(--warn-soft); color: var(--warn); }
.pill.lost, .pill.expired, .pill.suspended, .pill.unknown { background: var(--bad-soft); color: var(--bad); }
.pill.eval { background: var(--brand-soft); color: var(--brand); }

label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form .full { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; }

.key { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; min-height: 92px; word-break: break-all; }
dl.facts { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 12px; padding: 28px; }
.login .error { color: var(--bad); margin: 0; }
.qr { background: #fff; padding: 10px; border-radius: 10px; width: 200px; align-self: center; }
.qr svg { width: 100%; height: auto; display: block; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .grow { display: none; }
  .logo { padding: 4px 8px; width: 100%; }
  .main { padding: 20px 16px; }
  .stats, .grid2, .form { grid-template-columns: 1fr 1fr; }
  table { display: block; overflow-x: auto; }
}
