:root {
  --ink: #172033;
  --muted: #697386;
  --paper: #f4f6fa;
  --card: #ffffff;
  --line: #dfe4ec;
  --blue: #2563eb;
  --cyan: #0ea5a8;
  --green: #15966f;
  --orange: #d97706;
  --red: #dc3545;
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.login-shell { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 20%, #dff6f2, transparent 35%), #172033; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 45px rgba(15, 23, 42, .12); }
.login-card { width: min(420px, calc(100% - 32px)); padding: 38px; }
.login-card h1 { margin: 4px 0 28px; font-size: 34px; line-height: 1.05; }
.login-card h1 span, .brand span { color: var(--cyan); }
label { display: grid; gap: 6px; margin: 14px 0; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; color: var(--ink); background: white; }
button[type="submit"], .primary { width: 100%; border: 0; border-radius: 9px; padding: 11px 16px; color: white; background: var(--blue); font-weight: 800; }
.text-button { width: 100%; margin-top: 10px; border: 0; color: var(--blue); background: transparent; font-weight: 800; text-align: center; }
.error { color: var(--red); min-height: 22px; }
.success { color: var(--green); }
.app { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }
aside { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px; color: white; background: var(--ink); }
.brand { margin: 0 10px 34px; font-size: 25px; font-weight: 900; letter-spacing: -.05em; }
nav { display: grid; gap: 5px; }
nav button, .logout { border: 0; border-radius: 8px; padding: 10px 12px; color: #b9c2d4; background: transparent; text-align: left; }
nav button:hover, nav button.active { color: white; background: rgba(255,255,255,.1); }
.logout { margin-top: auto; }
main { min-width: 0; padding: 30px 36px 50px; }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
header h2 { margin: 0; font-size: 28px; }
.api-state { padding: 7px 11px; border-radius: 999px; color: var(--green); background: #dcf7ec; font-size: 12px; font-weight: 800; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric { padding: 20px; }
.metric strong { display: block; font-size: 31px; }
.metric span { color: var(--muted); font-size: 13px; }
.panel { padding: 22px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel h3 { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
tbody tr:hover { background: #f8faff; }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 800; background: #e7ebf1; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #7b879a; }
.status.up_to_date::before, .status.completed::before { background: var(--green); }
.status.updates_pending::before, .status.reboot_required::before, .status.warning::before, .status.pending::before { background: var(--orange); }
.status.critical::before, .status.offline::before, .status.failed::before { background: var(--red); }
.link-button { border: 0; color: var(--blue); background: transparent; font-weight: 800; }
.download-links { display: flex; flex-wrap: wrap; gap: 10px; }
.download-button { display: inline-block; border-radius: 9px; padding: 10px 14px; color: white; background: var(--blue); font-weight: 800; text-decoration: none; }
.download-button.secondary { background: var(--ink); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid label { margin: 0; }
.form-grid .full { grid-column: 1 / -1; }
.inline-button { width: auto !important; align-self: end; }
.muted { color: var(--muted); }
.recovery-code { display: block; margin: 18px 0; padding: 16px; border-radius: 10px; background: #eef3ff; color: var(--ink); font: 800 18px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; overflow-wrap: anywhere; }
.alert { border-left: 4px solid var(--orange); padding: 12px 14px; margin: 10px 0; background: #fffaf1; }
.alert.critical { border-color: var(--red); background: #fff4f4; }
.alert p { margin: 4px 0; }
dialog { width: min(820px, calc(100% - 30px)); max-height: 86vh; border: 0; border-radius: 16px; padding: 28px; box-shadow: 0 22px 70px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15, 23, 42, .65); }
.dialog-close { float: right; border: 0; border-radius: 8px; padding: 8px 10px; }
@media (max-width: 850px) {
  .app { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  nav { grid-template-columns: repeat(2, 1fr); }
  .logout { margin-top: 15px; }
  main { padding: 22px 16px; }
  .metrics, .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .metrics, .grid-2, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  header { align-items: flex-start; }
}
