:root {
  color-scheme: light;
  --bg: #f3efe6;
  --ink: #1c1915;
  --muted: #6b645b;
  --card: #fffdf8;
  --line: #e3d9c8;
  --amber: #9a4f08;
  --amber-bg: #fff4e6;
  --green: #215c3e;
  --green-bg: #e7f3ec;
  --red: #8d2a2a;
  --red-bg: #fdecec;
  --info: #f7f1e4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

body > header,
body > main,
body > footer {
  width: min(1080px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

h1, h2, h3, p { margin-top: 0; }

h1 { font-size: 1.7rem; font-weight: 500; margin-bottom: 0.2rem; }
h2 { font-size: 1.05rem; font-weight: 500; }
h3 { font-size: 0.95rem; font-weight: 500; margin-bottom: 0.3rem; }

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lede, .meta, .sub { color: var(--muted); }
.sub { font-size: 0.85rem; margin-bottom: 0; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.92em; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 8px;
  align-items: flex-start;
}

.top-side { text-align: right; }

.login {
  width: min(420px, calc(100% - 32px));
  margin: 10vh auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}

label { display: block; font-size: 0.92rem; }
input {
  display: block;
  width: 100%;
  margin: 6px 0 14px;
  padding: 8px 10px;
  font: inherit;
  color: inherit;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  font: inherit;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}

button.primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.banner {
  padding: 10px 12px;
  border-radius: 8px;
  margin: 0 0 12px;
}

.banner.warn { background: var(--red-bg); color: var(--red); }
.banner.info { background: var(--info); }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 12px 0 16px;
}

.tile, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.card { margin-bottom: 16px; }
.tile h2 { color: var(--muted); font-size: 0.8rem; font-weight: 500; margin-bottom: 6px; }
.tile .value { font-size: 1.55rem; font-weight: 500; margin: 0; font-variant-numeric: tabular-nums; }
.tile.armed { background: var(--green-bg); }
.tile.on { background: var(--amber-bg); }
.tile.unknown { background: #f6f1e8; }

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

dl {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) 1.2fr;
  gap: 6px 12px;
  margin: 0;
}

dt { color: var(--muted); }
dd { margin: 0; }

.row, .actions, .switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.row { justify-content: space-between; }
.actions { margin-bottom: 14px; }

a { color: var(--amber); }
.switcher a {
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.switcher a[aria-current="page"] {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.table-wrap { overflow-x: auto; }
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: 500; font-size: 0.85rem; }

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eeeae2;
  font-size: 0.85rem;
}
.chip.applied { background: var(--green-bg); color: var(--green); }
.chip.pending { background: var(--amber-bg); color: var(--amber); }
.chip.rejected, .chip.failed { background: var(--red-bg); color: var(--red); }
.chip.expired { color: var(--muted); }

.chart-frame { position: relative; }
canvas.chart { width: 100%; height: 220px; display: block; margin-bottom: 8px; cursor: crosshair; }
.chart-tip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 6px 20px rgba(28, 25, 21, 0.12);
  font-size: 0.85rem;
  min-width: 8.5rem;
}
.chart-tip[hidden] { display: none; }
.chart-tip-time { color: var(--muted); margin-bottom: 4px; }
.chart-tip-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tip-row b { font-weight: 500; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }
.swatch { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

footer { padding: 4px 0 28px; color: var(--muted); }

@media (max-width: 800px) {
  .columns { grid-template-columns: 1fr; }
  .top, .top-side { text-align: left; display: block; }
  .top { display: block; }
}
