:root {
  --bg: #f4f7fd; --card: #fff; --line: #dbe4f3; --line2: #c4d3ec; --fg: #0b1f44; --mut: #4b5f82; --faint: #6b7da3;
  --blue: #1d4ed8; --blue2: #2563eb; --sky: #e8f0ff; --in: #0b7a52; --out: #b92a45; --warn: #9a5b06;
  --red-bg: #fdecef; --amber-bg: #fff5e0; --green-bg: #e6f6ef;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Nirmala UI", sans-serif; min-height: 100vh; }
a { color: var(--blue); }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 18px 16px 56px; }
.muted { color: var(--mut); }
.faint { color: var(--faint); font-size: 0.85rem; }
.num { font-variant-numeric: tabular-nums; }
.in { color: var(--in); }
.out { color: var(--out); }

.top { position: sticky; top: 0; z-index: 20; background: var(--blue); color: #fff; box-shadow: 0 2px 10px rgba(29, 78, 216, 0.25); }
.bar { display: flex; align-items: center; gap: 12px; max-width: 1140px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.brand img { background: #fff; border-radius: 9px; padding: 1px; }
.who { margin-left: auto; display: flex; gap: 12px; font-size: 0.85rem; white-space: nowrap; }
.who a { color: #fff; }
@media (max-width: 480px) { .who span { display: none; } }
.tabs { scrollbar-width: none; display: flex; gap: 2px; max-width: 1140px; margin: 0 auto; padding: 0 8px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; color: rgba(255, 255, 255, 0.82); padding: 10px 14px 11px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button[aria-current="page"] { color: #fff; border-bottom-color: #fff; }

.fresh { text-align: center; padding: 6px 12px; font-size: 0.83rem; background: var(--sky); color: var(--mut); }
.fresh.stale { background: var(--red-bg); color: var(--out); font-weight: 600; }

h1 { font-size: 1.4rem; line-height: 1.25; margin: 2px 0 14px; }
h2 { font-size: 1.02rem; margin: 22px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(11, 31, 68, 0.04); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.tile { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; }
.tile:hover { border-color: var(--blue2); }
.tile small { display: block; color: var(--mut); font-weight: 500; }
.tile b { display: block; font-size: 1.5rem; line-height: 1.35; overflow-wrap: anywhere; }
.tile span { color: var(--faint); font-size: 0.82rem; }
.tile.hot { background: var(--red-bg); border-color: #f3c1ca; }
.tile.hot b { color: var(--out); }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 0 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border: 0; }
.link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.link:hover { text-decoration: underline; }

.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tools input { flex: 1 1 220px; min-height: 42px; padding: 9px 12px; background: #fff; border: 1px solid var(--line2); border-radius: 10px; outline: none; }
.tools input:focus { border-color: var(--blue2); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip, .btn { min-height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: #fff; color: var(--blue); font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"], .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }

.alert { margin-bottom: 10px; border-left: 5px solid var(--warn); }
.alert.urgent { border-left-color: var(--out); }
.alert header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.alert h3 { margin: 0; font-size: 1rem; }
.alert ul { margin: 6px 0; padding-left: 18px; color: var(--mut); overflow-wrap: anywhere; }
.alert p { margin: 4px 0; }
.tag { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--amber-bg); color: var(--warn); white-space: nowrap; }
.tag.ok { background: var(--green-bg); color: var(--in); }
.tag.bad { background: var(--red-bg); color: var(--out); }
.note { background: var(--sky); border-radius: 10px; padding: 6px 10px; margin-top: 6px; overflow-wrap: anywhere; }

.scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { background: #f8faff; color: var(--mut); font-weight: 600; }
th button { background: none; border: 0; padding: 0; font-weight: 600; color: inherit; cursor: pointer; }
th[aria-sort] button { color: var(--blue); }
tbody tr:hover { background: #f8faff; }
tbody tr:last-child td { border: 0; }
td:first-child { white-space: normal; min-width: 150px; }

dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); border: 0; border-radius: 16px; padding: 18px; color: var(--fg); background: var(--bg); box-shadow: 0 24px 60px rgba(11, 31, 68, 0.35); }
dialog::backdrop { background: rgba(11, 31, 68, 0.45); }
dialog .head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
dialog h1 { margin: 0; font-size: 1.2rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 12px 0; }
.facts div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.facts small { display: block; color: var(--mut); }
.facts b { overflow-wrap: anywhere; }

.door { max-width: 420px; margin: 12vh auto; text-align: center; }
.door .btn { width: 100%; margin-top: 6px; }
dialog td:first-child { min-width: 0; white-space: nowrap; }
@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile b { font-size: 1.25rem; }
  .tabs button { padding-left: 10px; padding-right: 10px; }
  th, td { padding: 8px 8px; font-size: 0.86rem; }
  td:first-child { min-width: 112px; }
  dialog { padding: 14px; }
}
