:root {
  --red: #dc2626;
  --red-hover: #b91c1c;
  --red-light: #fef2f2;
  --red-ring: rgba(220, 38, 38, 0.22);
  --ink: #0a0a0a;
  --ink-2: #404040;
  --muted: #737373;
  --line: #e5e5e5;
  --surface: #fafafa;
  --white: #fff;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --blue: #2563eb;
  --sidebar: 248px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--red); }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  flex: none;
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brand { padding: 4px 10px 18px; }
.kicker {
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}
.brand h1 {
  margin: 6px 0 0;
  font-size: 22px;
  letter-spacing: -0.5px;
  font-weight: 800;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 650;
}
.nav-btn:hover { background: var(--red-light); color: var(--red); }
.nav-btn.active { background: var(--red); color: #fff; }
.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  background: var(--red-light);
  color: var(--red);
  padding: 2px 7px;
  border-radius: 999px;
}
.nav-btn.active .nav-count { background: rgba(255,255,255,.2); color: #fff; }
.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.main { flex: 1; min-width: 0; padding: 28px 32px 64px; }
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.top h2 { margin: 4px 0 0; font-size: 28px; letter-spacing: -0.6px; font-weight: 800; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f5f5f5;
  color: var(--muted);
}
.pill.ok { background: var(--success-soft); color: var(--success); }
.pill.wait { background: var(--amber-soft); color: var(--amber); }
.pill.bad { background: var(--red-light); color: var(--red); }

.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards { grid-template-columns: 1.4fr 1fr; }
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.stat .label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.stat .value { font-size: 28px; font-weight: 800; margin-top: 6px; letter-spacing: -0.5px; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
h3 { margin: 0 0 12px; font-size: 15px; }
.empty { color: var(--muted); font-size: 14px; padding: 12px 0; }

.btn {
  background: var(--red);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
}
.btn:hover { background: var(--red-hover); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: var(--surface); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.danger { background: var(--red); }

label { display: block; font-size: 13px; font-weight: 650; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
textarea { min-height: 88px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.span-2 { grid-column: 1 / -1; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--red-light); }
.dot { width: 10px; height: 10px; border-radius: 99px; background: #d4d4d4; display: inline-block; }
.dot.on { background: #16a34a; box-shadow: 0 0 0 4px #dcfce7; }
.dot.push { background: #2563eb; box-shadow: 0 0 0 4px #dbeafe; }
.meta { font-size: 12px; color: var(--muted); }
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--red-light);
  color: var(--red);
}
.tag.muted { background: #f5f5f5; color: var(--muted); }
.tag.ok { background: var(--success-soft); color: var(--success); }
.tag.warn { background: var(--amber-soft); color: var(--amber); }

.modal-bg {
  position: fixed; inset: 0; background: rgba(10,10,10,.35);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 20;
}
.modal {
  background: #fff;
  border-radius: 20px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,.18);
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login .card { width: min(420px, 100%); }
.banner {
  background: var(--amber-soft);
  color: #92400e;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}
.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 650;
  background: #fff;
}
.group-chip input { width: auto; margin: 0; }
.color { width: 10px; height: 10px; border-radius: 99px; }
.alarm-row { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid #f0f0f0; cursor: pointer; }
.alarm-row:first-child { border-top: 0; }
.prio {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: var(--red-light); color: var(--red); font-weight: 800; flex: none;
}
.prio.critical { background: var(--red); color: #fff; }
.toast {
  position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff;
  padding: 12px 16px; border-radius: 12px; z-index: 30; font-size: 14px; font-weight: 650;
}
code { font-size: 12px; background: #f5f5f5; padding: 1px 6px; border-radius: 4px; }
.join {
  font-size: 28px;
  letter-spacing: 4px;
  font-weight: 800;
  color: var(--red);
}
.qr { width: 160px; height: 160px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.split { display: grid; grid-template-columns: 1.3fr .7fr; gap: 14px; }
.checks { display: grid; gap: 8px; }
.check {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.check input { width: auto; }

@media (max-width: 980px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-foot, .brand { display: none; }
  .nav-btn { width: auto; }
  .stats, .cards, .form-grid, .split { grid-template-columns: 1fr; }
  .main { padding: 18px 16px 48px; }
}
