:root {
  --bg: #efe8dc;
  --paper: #f7f3eb;
  --ink: #221c16;
  --muted: #6f655b;
  --line: #e2d8c8;
  --side: #241c16;
  --side-text: #f6efe6;
  --copper: #9a3412;
  --copper-soft: #fde7d4;
  --ok: #3f6212;
  --ok-soft: #e8f3d4;
  --bad: #9f1239;
  --bad-soft: #ffe4e6;
  --warn: #a16207;
  --warn-soft: #fef3c7;
  --info: #1e3a5f;
  --info-soft: #e0e9f4;
  --shadow: 0 16px 40px rgba(48, 32, 16, 0.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 15px/1.55 "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: "Iowan Old Style", Palatino, "Songti SC", "PingFang SC", serif; font-weight: 600; letter-spacing: 0; }
h1 { margin: 0; font-size: 32px; }
h2 { margin: 0 0 8px; font-size: 22px; }
h3 { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.eyebrow {
  margin: 0;
  color: #c4a484;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--side);
  color: var(--side-text);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.brand { margin: 4px 0 18px; font-family: "Iowan Old Style", Palatino, "Songti SC", serif; font-size: 28px; line-height: 1.15; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav button, .collect {
  text-align: left;
  background: transparent;
  color: var(--side-text);
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.side nav button.active, .side nav button:hover { background: rgba(255, 244, 230, 0.1); }
.collect {
  margin-top: auto;
  background: #f3e6d4;
  color: var(--ink);
  text-align: center;
}
.collect:disabled { opacity: 0.6; cursor: wait; }
.side-note { margin: 8px 0 0; color: #cbbba8; font-size: 12px; }
main { padding: 28px 32px 48px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 22px; }
.pill, .badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  background: var(--copper-soft);
  color: var(--copper);
}
.badge.critical, .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.high { background: #ffedd5; color: #9a3412; }
.badge.medium, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok, .badge.open { background: var(--ok-soft); color: var(--ok); }
.badge.acked, .badge.unknown { background: var(--info-soft); color: var(--info); }
.badge.resolved { background: #eee; color: #666; }
.hints { display: grid; gap: 8px; margin-bottom: 16px; }
.hint, .panel, .card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.hint { padding: 12px 14px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.card { padding: 16px; }
.card .label { color: var(--muted); font-size: 13px; }
.card strong { display: block; margin-top: 6px; font-size: 28px; font-family: "Iowan Old Style", Palatino, "Songti SC", serif; }
.card small { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 12px; }
.panel { padding: 16px 18px 18px; margin-bottom: 12px; }
.bars { height: 160px; display: flex; align-items: flex-end; gap: 6px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bar-fill { width: 100%; background: #9a3412; border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar span { margin-top: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar button, .linkish, .primary {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.toolbar button.active { background: var(--ink); color: white; border-color: var(--ink); }
.toolbar button:disabled { opacity: 0.45; cursor: default; }
.primary { background: var(--ink); color: white; border-color: var(--ink); }
.filters { display: flex; gap: 8px; align-items: center; }
select, input[type="text"], input[type="number"], input[type="password"] {
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 8px 10px;
}
.rule { display: grid; grid-template-columns: 180px 1fr 120px 90px; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rule p { margin: 0; color: var(--muted); font-size: 13px; }
.pre { white-space: pre-wrap; margin: 6px 0 0; }
.actions { display: flex; gap: 6px; }
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card { width: min(420px, 100%); background: var(--paper); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.gate-card input { width: 100%; margin: 12px 0; }
.gate-card button { width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: var(--ink); color: white; cursor: pointer; }
.error { color: var(--bad); min-height: 1.2em; }
.check { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { padding: 16px; }
  .side nav { flex-direction: row; overflow-x: auto; }
  .collect { margin-top: 12px; }
  .cards, .grid-2, .rule { grid-template-columns: 1fr; }
  main { padding: 18px 14px 32px; }
  h1 { font-size: 26px; }
}
