:root {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --surface-2: #f1f2f5;
  --text: #15171c;
  --muted: #5f6573;
  --border: #e4e6eb;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --success: #15803d;
  --success-soft: #e8f6ed;
  --warn: #a16207;
  --warn-soft: #fdf5e1;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 18, 27, .04), 0 4px 16px rgba(16, 18, 27, .04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --text: #eceef3;
    --muted: #9aa1b0;
    --border: #2a2f3a;
    --accent: #8b87ff;
    --accent-soft: #24234a;
    --success: #4ade80;
    --success-soft: #133222;
    --warn: #facc15;
    --warn-soft: #3a3110;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(24px + var(--sab));
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-left: calc(16px + var(--sal));
  padding-right: calc(16px + var(--sar));
}
@media (min-width: 720px) { .wrap { padding-left: calc(32px + var(--sal)); padding-right: calc(32px + var(--sar)); } }

.top {
  position: sticky; top: 0; z-index: 10;
  padding-top: var(--sat);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.top-inner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; padding-top: 14px; padding-bottom: 12px; }
h1 { font-size: 1.25rem; line-height: 1.2; margin: 0; letter-spacing: -0.01em; font-weight: 700; }
.updated { margin: 0; color: var(--muted); font-size: .85rem; }

.note {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px;
  background: var(--warn-soft); color: var(--warn); font-size: .9rem; font-weight: 500;
}

main { display: grid; gap: 20px; padding-top: 20px; }
@media (min-width: 720px) { main { gap: 28px; padding-top: 28px; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  min-width: 0;
}
@media (min-width: 720px) { .card { padding: 24px 26px; } }
.card > h2 { font-size: 1.1rem; margin: 0 0 4px; letter-spacing: -0.01em; }
.caption { margin: 0 0 16px; color: var(--muted); font-size: .9rem; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 14px; align-items: center; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: .875rem; font-weight: 500; padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  min-height: 36px;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
@media (prefers-color-scheme: dark) { .seg button[aria-pressed="true"] { background: #2b303b; } }
.seg .count { color: var(--muted); font-weight: 400; margin-left: 4px; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; min-width: 0; }
.field label { font-size: .8rem; color: var(--muted); font-weight: 500; }
input[type="search"], select {
  font: inherit; font-size: 16px; /* avoids iOS zoom */
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; width: 100%; min-height: 42px;
}
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.btn {
  appearance: none; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  background: var(--accent-soft); color: var(--accent); border: 0; border-radius: 10px; padding: 10px 16px; margin-top: 14px; min-height: 42px;
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
.end { text-align: right; }
.nowrap { white-space: nowrap; }
.url { font-size: .85rem; word-break: break-all; }
.num { font-variant-numeric: tabular-nums; }
.date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; white-space: nowrap; }
.tag.ok { background: var(--success-soft); color: var(--success); }
.tag.off { background: var(--surface-2); color: var(--muted); }
.tag.err { background: var(--warn-soft); color: var(--warn); }
.src { font-size: .78rem; color: var(--muted); }

/* stacked rows on small screens */
@media (max-width: 719px) {
  .stack thead { display: none; }
  .stack, .stack tbody, .stack tr, .stack td { display: block; width: 100%; }
  .stack tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .stack tr:last-child { border-bottom: 0; }
  .stack td { border: 0; padding: 2px 0 !important; text-align: left !important; }
  .stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8rem; }
  .stack td.primary { font-weight: 600; font-size: 1rem; padding-bottom: 4px !important; }
  .stack td.primary::before { content: none; }
  .stack td.inline { display: inline-block; width: auto; margin-right: 12px; }
  .table-wrap { margin: 0; padding: 0; overflow: visible; }
}

/* callout + list */
.callout { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.callout strong { display: block; margin-bottom: 4px; }
.callout p { margin: 0; font-size: .95rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 2px 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .lead { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; padding-top: 1px; }
.list .title { font-weight: 500; }
.list .detail { grid-column: 2; font-size: .85rem; color: var(--muted); }

/* bars */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr 3rem; gap: 12px; align-items: center; font-size: .9rem; }
.bar .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { display: block; height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

ul.bullets { margin: 0; padding-left: 1.2rem; }
ul.bullets li { margin: 6px 0; }
.foot { color: var(--muted); font-size: .8rem; padding-top: 24px; }

.skeleton .sk { height: 14px; border-radius: 6px; background: var(--surface-2); margin: 12px 0; animation: pulse 1.2s ease-in-out infinite; }
.skeleton .sk:nth-child(2) { width: 80%; } .skeleton .sk:nth-child(3) { width: 60%; }
@keyframes pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .skeleton .sk { animation: none; } }

.stamp { white-space: nowrap; }
