:root {
  --bg: #f2f5f9;
  --card: #ffffff;
  --ink: #1c2b3a;
  --muted: #64748b;
  --brand: #16324f;
  --brand2: #1d4ed8;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --line: #e2e8f0;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14.5px;
}
header {
  background: linear-gradient(135deg, #16324f, #1e4976);
  color: #fff; padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { border-radius: 9px; }
.brand h1 { font-size: 17px; margin: 0; line-height: 1.2; white-space: nowrap; }
.brand span { font-size: 12.5px; opacity: .85; }
.head-right { display: flex; align-items: center; gap: 8px; }
.chip {
  font-size: 11.5px; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.16); white-space: nowrap;
}
.chip.live { background: #16a34a; }
.chip.warn { background: #d97706; }
#installBtn {
  border: 0; border-radius: 999px; padding: 7px 14px;
  background: #fff; color: var(--brand); font-weight: 600; cursor: pointer;
}
nav {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px 0; max-width: 1100px; margin: 0 auto;
}
.tab {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 8px 16px; border-radius: 10px 10px 0 0; cursor: pointer; font-size: 14px;
  border-bottom: none;
}
.tab.active { color: var(--brand); font-weight: 700; border-color: #cbd5e1; }
.updated { margin-left: auto; font-size: 12px; color: var(--muted); }
main { max-width: 1100px; margin: 0 auto; padding: 14px 14px 60px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card .num { font-size: 26px; font-weight: 800; }
.card .lbl { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card.ok .num { color: var(--ok); } .card.warn .num { color: var(--warn); } .card.bad .num { color: var(--bad); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.toolbar { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar input, .toolbar select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; background: #fff;
}
.toolbar input { flex: 1; min-width: 140px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: #f8fafc; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }

.mwrap { overflow: auto; max-height: 70vh; }
.matrix td, .matrix th { text-align: center; padding: 6px 4px; font-size: 12px; white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; background: #fff; text-align: left; min-width: 170px; font-weight: 600; }
.matrix th:first-child { background: #f8fafc; z-index: 2; }
.c-ok { background: #dcfce7; color: #14532d; }
.c-short { background: #fef3c7; color: #78350f; }
.c-abs { background: #fee2e2; color: #7f1d1d; }
.legend { display: flex; gap: 14px; padding: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend b { padding: 1px 7px; border-radius: 6px; margin-right: 4px; }

.dept { color: var(--muted); font-size: 12px; }
.badges { display: flex; gap: 6px; }
.bdg { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.bdg.ok { background: #dcfce7; color: #166534; }
.bdg.short { background: #fef3c7; color: #92400e; }
.bdg.abs { background: #fee2e2; color: #991b1b; }

select#empSel { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; max-width: 320px; }
#offline {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: #7c2d12; color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 13px; z-index: 50;
}
.empty { padding: 30px; text-align: center; color: var(--muted); }
@media (max-width: 640px) {
  .brand h1 { font-size: 15px; }
  th, td { padding: 7px 8px; }
  .matrix th:first-child, .matrix td:first-child { min-width: 120px; }
}
