/* Colours follow the Telegram theme when the page runs as a Mini App, and the system theme otherwise. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --fg: #1b2230; --muted: #5b6577; --line: #d9dee7; --edge: #9aa4b5; --accent: #2f6fd8;
  --ok: #1f8a55; --bad: #c0392b; --warn: #a86a00; --unsure: #7646c9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] { --bg: #11151c; --surface: #181e28; --fg: #e5e9f0; --muted: #9aa4b5; --line: #2a3342; --edge: #5b6577; --accent: #7fa2ff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #11151c; --surface: #181e28; --fg: #e5e9f0; --muted: #9aa4b5; --line: #2a3342; --edge: #5b6577; --accent: #7fa2ff; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0); }
.bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar h1 { font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back { border: 0; background: none; color: var(--accent); font-size: 26px; line-height: 1; padding: 0 6px 2px 0; cursor: pointer; }
main { padding: 12px 16px 96px; display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; text-align: left; color: inherit; font: inherit; width: 100%; }
.card:focus-visible { outline: 2px solid var(--accent); }
.row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.name { font-weight: 600; font-size: 15px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: var(--ok); } .chip.bad { color: var(--bad); border-color: var(--bad); }
.chip.warn { color: var(--warn); border-color: var(--warn); } .chip.unsure { color: var(--unsure); border-color: var(--unsure); }
.graph { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; height: 58vh; min-height: 320px; overflow: hidden; position: relative;
  box-shadow: 0 1px 2px rgba(16,24,40,.06) inset; }
.section { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 0; }
.list { display: flex; flex-direction: column; gap: 8px; }
select { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; background: var(--surface); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0)); box-shadow: 0 -8px 24px rgba(0,0,0,.12); max-height: 60vh; overflow: auto; }
.sheet h2 { font-size: 16px; margin: 0 0 6px; } .sheet dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 14px; }
.sheet dt { color: var(--muted); } .sheet dd { margin: 0; overflow-wrap: anywhere; }
.close { float: right; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.diff li { font-size: 14px; margin: 2px 0; }
