:root {
  --red: #C31414; --bordeaux: #861623; --ink: #000; --muted: #5E5457; --line: #DCD3D6; --line2: #C8BCBF;
  --soft: #EDE9EC; --bg: #FFFFFF; --ok: #2F7D4F; --okbg: #DDF1E4; --warn: #B87400; --warnbg: #FDEBC8;
  --err: #B3261E; --errbg: #FBE3E1; --info: #1F5FA8; --infobg: #E3EDF8; --radius: 4px;
  --font: "COOP", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/22px var(--font); }
a { color: var(--red); } a:hover { color: var(--bordeaux); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { margin: 0; font-size: 28px; line-height: 34px; font-weight: 700; }
h2 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 600; }
h3 { margin: 0; font-size: 16px; line-height: 22px; font-weight: 600; }
p { margin: 0; }
.boot { padding: 48px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 18px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 0 24px; min-height: 60px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 20; }
.brand { display: flex; align-items: baseline; gap: 6px; text-decoration: none; color: var(--ink); }
.brand b { font-size: 22px; color: var(--red); } .brand span { font-size: 17px; font-weight: 600; }
.brand em { font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--bordeaux); border-radius: 3px; padding: 1px 6px; margin-left: 6px; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 520px; }
.nav a { padding: 18px 10px 15px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 3px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--red); }
.who { display: flex; align-items: center; gap: 12px; font-size: 13px; line-height: 17px; }
.who .n { font-weight: 600; } .who .r { color: var(--muted); }

main { max-width: 1440px; margin: 0 auto; padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 20px; }
.crumbs { font-size: 13px; color: var(--muted); } .crumbs a { text-decoration: none; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; }
.head p { margin-top: 4px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* buttons & forms */
.btn { min-height: 38px; padding: 0 14px; border: 1px solid var(--line2); background: #fff; border-radius: var(--radius); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--bordeaux); border-color: var(--bordeaux); color: #fff; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn.danger { color: var(--err); border-color: #E4B4B0; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; align-self: flex-start; flex-wrap: wrap; border: 1px solid var(--line2); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 12px; cursor: pointer; border-right: 1px solid var(--line); font-size: 14px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: #fff; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; color: var(--muted); }
input[type=text], input[type=password], input[type=date], input[type=datetime-local], input[type=number], input[type=search], select, textarea {
  min-height: 38px; padding: 6px 10px; border: 1px solid var(--line2); border-radius: var(--radius); background: #fff; color: var(--ink); font-size: 14px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--info); outline-offset: 1px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* cards */
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; background: #fff; }
.card > .ch { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .l { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font-size: 28px; line-height: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 13px; color: var(--muted); }
.kpi.alert .v { color: var(--err); }
.note { padding: 12px 14px; border-radius: var(--radius); background: var(--soft); font-size: 14px; line-height: 20px; }
.note.warn { background: #FFF6E5; border: 1px solid #E8C27A; }
.note.err { background: var(--errbg); border: 1px solid #E4B4B0; }
.note.info { background: var(--infobg); border: 1px solid #B9CDE6; }

/* tables */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
table.t th { text-align: left; background: var(--soft); font-weight: 600; padding: 8px 10px; white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #F7F4F6; }
table.t tr.sel td { background: #F3ECEF; }
table.t td .sub { color: var(--muted); font-size: 13px; }
table.t th.num, table.t td.num { text-align: right; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* badges */
.b { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; line-height: 20px; white-space: nowrap; background: var(--soft); color: var(--ink); }
.b.ok { background: var(--okbg); color: #1E5A37; } .b.warn { background: var(--warnbg); color: #6E4600; }
.b.err { background: var(--errbg); color: #8A1D17; } .b.info { background: var(--infobg); color: #17457A; }
.b.dark { background: var(--ink); color: #fff; } .b.red { background: var(--red); color: #fff; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 999px; background: var(--line2); vertical-align: middle; }
.dot.ok { background: var(--ok); } .dot.warn { background: #D98E04; } .dot.err { background: var(--err); border-radius: 2px; } .dot.none { background: #fff; border: 1px solid var(--line2); }
.dots { display: inline-flex; gap: 5px; align-items: center; }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 12px 8px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--red); }

/* charts */
.chart { width: 100%; min-height: 120px; }
.chart .u-legend { font-size: 13px; text-align: left; }
.chart .u-legend .u-marker { border-radius: 2px; }
.charth { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: -6px; }

/* heatmap */
.heat td.c { width: 34px; min-width: 34px; padding: 0; border-left: 2px solid #fff; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }
.heat .c0 { background: #F2EEF0; color: var(--muted); } .heat .c1 { background: #F4B5AE; } .heat .c2 { background: #FBD9A0; } .heat .c3 { background: #CFE9D8; } .heat .c4 { background: #9ED3B1; }
.heat .s-ok { background: #CFE9D8; } .heat .s-warning { background: #FBD9A0; } .heat .s-critical, .heat .s-alarm { background: #F4B5AE; } .heat .s-not_evaluated { background: #F2EEF0; color: var(--muted); }

/* layout pieces */
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.split > .side { flex: 1 1 360px; min-width: 0; position: sticky; top: 76px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.siglist { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 160px; overflow: auto; padding: 4px 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.timeline li { border-left: 3px solid var(--line); padding-left: 10px; }
.keybox { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; padding: 10px; background: var(--soft); border-radius: var(--radius); word-break: break-all; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--soft); }
.login form { width: 100%; max-width: 440px; background: #fff; border-radius: 8px; padding: 32px; display: flex; flex-direction: column; gap: 16px; border: 1px solid var(--line); }
.login .brand b { font-size: 30px; } .login .brand span { font-size: 22px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; }
#toast div { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius); font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
#toast div.err { background: var(--err); }

@media (max-width: 720px) {
  .top { padding: 0 12px; } main { padding: 16px 12px 40px; }
  .nav a { padding: 10px 8px; } .who .r { display: none; }
  .grid2 { grid-template-columns: 1fr; } .split > .side { position: static; }
  h1 { font-size: 23px; line-height: 29px; }
}
