:root {
  --bg: #f6f7f8; --surface: #ffffff; --text: #16191d; --muted: #5d6670; --line: #dfe3e8;
  --accent: #0f766e; --accent-text: #ffffff; --danger: #b42318; --warn-bg: #fff4e5; --ok-bg: #e7f6f3;
  --radius: 12px; --tap: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1214; --surface: #181c20; --text: #eef1f4; --muted: #9aa4ae; --line: #2a3036;
    --accent: #2dd4bf; --accent-text: #062b27; --danger: #f97066; --warn-bg: #3a2a10; --ok-bg: #0e2e2a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1214; --surface: #181c20; --text: #eef1f4; --muted: #9aa4ae; --line: #2a3036;
  --accent: #2dd4bf; --accent-text: #062b27; --danger: #f97066; --warn-bg: #3a2a10; --ok-bg: #0e2e2a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
.bar {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 8px; align-items: center; font-weight: 700; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 20px 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.grid { display: grid; gap: 12px; }
@media (min-width: 560px) { .grid.two { grid-template-columns: 1fr 1fr; } }
label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.with-scan { display: flex; gap: 6px; }
.with-scan button { flex: none; width: var(--tap); padding: 0; }
button {
  min-height: var(--tap); padding: 0 18px; font: inherit; font-weight: 600; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
}
button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .55; cursor: wait; }
.wide { width: 100%; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chips button { flex: none; min-height: 40px; padding: 0 14px; background: transparent; color: var(--text); border-color: var(--line); }
.chips button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--ok-bg); }
.pill.warn { background: var(--warn-bg); }
.secret { font-family: ui-monospace, monospace; word-break: break-all; background: var(--warn-bg); padding: 10px; border-radius: 8px; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 3; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { border: 0; border-radius: 0; background: transparent; color: var(--muted); min-height: 58px; padding: 0; font-size: 14px; }
.tabs button[aria-current="page"] { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 4;
  max-width: 560px; margin: 0 auto; padding: 12px 16px; border-radius: 10px; background: var(--text); color: var(--bg);
}
#toast.error { background: var(--danger); color: #fff; }
dialog { border: 0; border-radius: var(--radius); padding: 16px; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--text); }
dialog video { width: 100%; border-radius: 8px; background: #000; }
.auth { max-width: 420px; margin: 8vh auto 0; }
.mt { margin-top: 10px; }
.break { word-break: break-all; }
