:root {
  --navy: #1b2a6b; --blue: #1574b8; --green: #23804a; --amber: #96600f; --red: #c53030;
  --ink: #1f2733; --muted: #5b6678; --line: #e2e7ee; --bg: #f5f7fa; --card: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
h1 { font-size: 24px; margin: 0 0 4px; color: var(--navy); }
h2 { font-size: 17px; margin: 28px 0 10px; color: var(--navy); }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
p { margin: 0 0 6px; }
a { color: var(--blue); }
.muted, .sub { color: var(--muted); }
.sub { font-size: 13px; text-decoration: none; }
a.sub:hover { text-decoration: underline; }
.center { text-align: center; padding: 28px 12px !important; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 24px; background: var(--navy); color: #fff; }
.brand { font-weight: 700; font-size: 17px; }
.brand span { font-weight: 400; opacity: .85; }
.brand.big { font-size: 22px; color: var(--navy); margin-bottom: 6px; }
.who { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.who form { margin: 0; }
.topbar .link { color: #fff; }

.page { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { max-width: 720px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .n { font-size: 24px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.big { font-size: 19px; font-weight: 700; }
.name { font-weight: 600; }
.actions { text-align: right; white-space: nowrap; }
tr.detail td { padding: 0 14px 10px; background: #fafbfd; }
tr.detail summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 8px 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; padding: 6px 0 10px; font-size: 14px; }
.line { display: flex; justify-content: space-between; gap: 12px; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill.good { background: #e6f5ec; color: var(--green); }
.pill.warn { background: #fdf3dc; color: var(--amber); }
.pill.bad { background: #fde8e8; color: var(--red); }
.pill.idle { background: #edf0f5; color: var(--muted); }
.text-bad { color: var(--red); }
.text-warn { color: var(--amber); }
.bar { height: 6px; background: #edf0f5; border-radius: 999px; overflow: hidden; min-width: 140px; }
.bar span { display: block; height: 100%; background: var(--green); }
.bar span.warn { background: var(--amber); }
.bar span.bad { background: var(--red); }

.btn { display: inline-block; border: 1px solid #c9d1dc; background: #fff; color: var(--ink); border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #9aa7b8; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: #24378a; }
.btn.small { padding: 6px 12px; font-size: 13.5px; }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.flash.ok { background: #e6f5ec; color: #1f6b3f; }
.flash.bad { background: #fde8e8; color: var(--red); }
.error { color: var(--red); font-size: 14px; margin: 0; }

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; flex-direction: column; }
.auth .flash { width: 100%; max-width: 400px; }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 14px; }
label small { font-weight: 400; color: var(--muted); }
input { font: inherit; padding: 10px 12px; border: 1px solid #9aa7b8; border-radius: 8px; width: 100%; }
input.code { font-size: 22px; letter-spacing: .3em; text-align: center; }
.forgot { margin-top: 18px; font-size: 14px; }
.forgot summary { cursor: pointer; color: var(--blue); }
.row-between { display: flex; justify-content: space-between; margin-top: 16px; font-size: 14px; }
.row-between form { margin: 0; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; }

.models { border-top: 1px solid var(--line); padding: 14px 0 10px; font-size: 14px; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px 16px; margin: 10px 0 14px; }
.model-grid input { font-size: 13.5px; padding: 8px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.model-grid input::placeholder { color: #8591a3; }

dialog { border: 0; border-radius: 12px; padding: 24px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(15, 23, 42, .3); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog h2 { margin-top: 0; }
dialog .stack { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid #c9d1dc; background: #f3f6fa; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13.5px; cursor: pointer; }
.chip:hover { border-color: var(--blue); }

@media (max-width: 600px) {
  .topbar { padding: 10px 14px; }
  .who span { display: none; }
  .page { padding: 16px 12px 40px; }
}
