:root { --bg: #0f1420; --card: #171e2e; --line: #26304a; --fg: #e8ecf4; --muted: #8b95ab; --pos: #3ecf8e;
  --neg: #ff6b6b; --warn: #f5b942; --accent: #4f8cff; --field: #212a40; --logbg: #0b0f18; color-scheme: dark; }
/* Light: chosen with the switch in the header (theme.js), remembered on the phone. */
:root[data-theme="light"] { --bg: #f4f6fa; --card: #ffffff; --line: #dfe4ee; --fg: #141a26; --muted: #5f6b80;
  --pos: #138a4c; --neg: #d23c3c; --warn: #b86e00; --accent: #2f6bff; --field: #f4f6fa; --logbg: #eef1f7; color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); }
header h1 { margin: 0; font-size: 20px; flex: 1; }
/* the kit's marks are never recoloured: shown on a white tile in both themes */
.tile { display: grid; place-items: center; width: 30px; height: 30px; background: #fff; border-radius: 7px;
  box-shadow: 0 0 0 1px var(--line); }
.tile .mark { width: 24px; height: 24px; }
.tile.big { width: 60px; height: 60px; border-radius: 14px; } .tile.big .mark { width: 50px; height: 50px; }
.theme { background: none; border: 0; color: var(--muted); font-size: 16px; padding: 0 4px; cursor: pointer; }
main { max-width: 900px; margin: 0 auto; padding: 12px; }
h2 { font-size: 16px; margin: 14px 0 6px; }
.panel { display: none; } .panel.active { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.total { font-size: 20px; font-weight: 600; }
.sums { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sums .card { margin: 0; } .sums .total { margin-top: 2px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .error { color: var(--neg); }
.badge { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 9px; border: 1px solid var(--line);
  color: var(--muted); vertical-align: middle; font-weight: 400; }
.badge.ok { color: var(--pos); border-color: var(--pos); } .badge.bad { color: var(--neg); border-color: var(--neg); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: left; padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; } .num { text-align: right; white-space: nowrap; }
.pos-table td { font-size: 14px; padding: 6px 3px; } .pos-table td:first-child { overflow-wrap: anywhere; }
.card h2 { margin: 0; }
.sums { margin-bottom: 12px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
button, select, input { font: inherit; color: var(--fg); background: var(--field); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; }
button { cursor: pointer; } button.go { border-color: var(--pos); } button.danger { border-color: var(--neg); color: var(--neg); }
nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
nav .tab { flex: 1; background: none; border: 0; border-radius: 0; padding: 14px 0; color: var(--muted); }
nav .tab.active { color: var(--accent); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 320px; display: grid; gap: 8px; }
.login h1 { margin: 0; } .login button { margin-top: 8px; background: var(--accent); border: 0; color: #fff; }
.set label, #pw label { display: block; margin: 6px 0; }
.bhead { margin-bottom: 8px; } .bhead .controls { margin: 0; gap: 6px; flex-wrap: nowrap; }
.ico-btn { width: 34px; height: 34px; padding: 0; font-size: 13px; line-height: 1; }
.pwbox summary { cursor: pointer; font-weight: 600; } .pwbox[open] summary { margin-bottom: 8px; } #pw input { display: block; width: 100%; margin-top: 4px; }
.ov { display: flex; gap: 6px; margin: 6px 0; } .ov .sym { flex: 1; min-width: 0; }
.log { background: var(--logbg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 11px; overflow-x: auto;
  white-space: pre-wrap; max-height: 50vh; }
