/* Homeroom
   Colors and type live in the variables below; dark mode redefines them.
   Phone first: one centered column, a tab bar at the bottom. */

:root {
  --paper: #f5f3ee;        /* page background */
  --surface: #ffffff;
  --sunk: #eceae3;         /* wells, tracks, inactive segments */
  --ink: #1e2b3a;          /* text and primary buttons */
  --muted: #5e6b78;
  --line: #dcd8ce;
  --accent: #2e6b5a;       /* links, focus, the "now" marker */
  --danger: #a6341f;
  --on-ink: #ffffff;

  /* status colors, used for pills, the day strip and dots */
  --online: #2f8f5b;
  --offline: #4b4fa8;      /* bedtime and other offline times */
  --paused: #b7791f;
  --free: #1f7a8c;         /* extra time */
  --window: #8fc9b0;       /* allowed times for limited apps */

  --display: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --gutter: 16px;
  --column: 720px;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12171e;
    --surface: #1b222b;
    --sunk: #252d38;
    --ink: #e7ecf2;
    --muted: #9aa6b3;
    --line: #2f3945;
    --accent: #6cc3a6;
    --danger: #f08a73;
    --on-ink: #12171e;
    --online: #5cc48b;
    --offline: #8f93f0;
    --paused: #e3a64a;
    --free: #5bbccf;
    --window: #2f6f58;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12171e; --surface: #1b222b; --sunk: #252d38; --ink: #e7ecf2; --muted: #9aa6b3; --line: #2f3945;
  --accent: #6cc3a6; --danger: #f08a73; --on-ink: #12171e; --online: #5cc48b; --offline: #8f93f0; --paused: #e3a64a;
  --free: #5bbccf; --window: #2f6f58; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--body);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, ol, dl, dd, fieldset, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.small, .detail { font-size: 14px; line-height: 1.4; color: var(--muted); }
.label { font-size: 15px; font-weight: 600; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────── Shell ───────── */

#app {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

#view {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 20px var(--gutter) calc(96px + env(safe-area-inset-bottom));
}

#tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px max(var(--gutter), env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}

#tabbar a {
  flex: 1;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
#tabbar a svg { width: 24px; height: 24px; }
#tabbar a[aria-current="page"] { color: var(--ink); background: var(--sunk); }

.masthead { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.masthead h1 { font-size: 32px; }
.masthead .detail { margin-top: 2px; }

.section-title { font-size: 20px; margin: 32px 0 10px; }
.section-title:first-child { margin-top: 0; }
.section-note { margin: -4px 0 12px; }

/* ───────── Cards, lists, banners ───────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 12px; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; }
.list > li + li { border-top: 1px solid var(--line); }
.list .meta { font-size: 14px; color: var(--muted); white-space: nowrap; }
.list .empty { color: var(--muted); }

.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
}
.banner.warn { border-left-color: var(--paused); }
.banner.bad { border-left-color: var(--danger); }
.banner h2 { font-size: 17px; margin-bottom: 2px; }
.banner .btn { margin-top: 10px; }

/* ───────── Children ───────── */

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--kid, var(--accent));
  color: #fff;
  font: 700 20px/1 var(--display);
}
.avatar.big { width: 56px; height: 56px; font-size: 26px; }

.kid-card { display: block; color: inherit; text-decoration: none; }
.kid-head { display: flex; align-items: center; gap: 12px; }
.kid-head h2 { font-size: 22px; }
a.kid-card:hover h2 { text-decoration: underline; }
.kid-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.kid-facts strong { color: var(--ink); font-weight: 600; }
.kid-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  color: var(--tone);
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.pill.online { --tone: var(--online); }
.pill.offline { --tone: var(--offline); }
.pill.paused { --tone: var(--paused); }
.pill.free { --tone: var(--free); }

/* The day strip: 24 hours, offline times in the offline color, allowed times for limited apps underneath,
   a marker at the current time. Homeroom's signature element: a child's day at a glance. */
.daystrip { position: relative; margin-top: 14px; }
.daystrip .track { position: relative; height: 14px; border-radius: 7px; background: color-mix(in srgb, var(--online) 22%, var(--sunk)); overflow: hidden; }
.daystrip .track.windows { height: 6px; margin-top: 4px; border-radius: 3px; background: var(--sunk); }
.daystrip .seg { position: absolute; top: 0; bottom: 0; background: var(--offline); }
.daystrip .windows .seg { background: var(--window); }
.daystrip .now { position: absolute; top: -4px; height: 32px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.daystrip .ticks { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 3px; background: var(--c); vertical-align: -1px; }

.kid-top { display: flex; align-items: center; gap: 14px; }
.kid-top h1 { font-size: 30px; overflow-wrap: anywhere; }

.tabs {
  display: flex;
  gap: 4px;
  margin: 20px 0;
  padding: 4px;
  border-radius: 12px;
  background: var(--sunk);
}
.tabs a {
  flex: 1;
  padding: 8px 6px;
  border-radius: 9px;
  text-align: center;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }

/* ───────── Activity ───────── */

.daynav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.daynav h2 { flex: 1; text-align: center; font-size: 18px; }
.iconbtn {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer;
}
.iconbtn:disabled { opacity: 0.35; cursor: default; }
.iconbtn svg { width: 20px; height: 20px; }

.bigstat { font: 700 40px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stats .card { padding: 14px 16px; margin-top: 0; }
.stats .bigstat { font-size: 30px; }

.bars { display: flex; align-items: flex-end; gap: 2px; height: 80px; margin-top: 14px; }
.bars span { flex: 1; min-height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.bars span.zero { background: var(--sunk); }
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 96px; margin-top: 12px; }
.week button { all: unset; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; cursor: pointer; font-size: 12px; color: var(--muted); }
.week button span.b { width: 100%; max-width: 36px; border-radius: 4px; background: var(--accent); opacity: 0.55; min-height: 3px; }
.week button[aria-pressed="true"] span.b { opacity: 1; }
.week button[aria-pressed="true"] { color: var(--ink); font-weight: 700; }
.week button:focus-visible { outline: 3px solid var(--accent); border-radius: 6px; }

.svc-icon { flex: none; width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--sunk); overflow: hidden; }
.svc-icon img { width: 18px; height: 18px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .svc-icon img { filter: invert(1); } }
:root[data-theme="dark"] .svc-icon img { filter: invert(1); }
.svc-icon.letter { font: 700 14px/1 var(--display); color: var(--muted); }
.meter { height: 6px; border-radius: 3px; background: var(--sunk); margin-top: 4px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ───────── Rules editor ───────── */

.toggle-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px; cursor: pointer; }
.toggle-row + .toggle-row { border-top: 1px solid var(--line); }
.switch { flex: none; position: relative; width: 48px; height: 28px; margin-top: 2px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: var(--line); transition: background 120ms; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: transform 120ms; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.window { padding: 14px; }
.window + .window { border-top: 1px solid var(--line); }
.window-top { display: flex; gap: 8px; align-items: center; }
.window-times { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.window-times .input { width: auto; min-width: 120px; flex: 1; }
.days { display: flex; gap: 4px; margin-top: 10px; }
.days label { flex: 1; position: relative; }
.days input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.days span { display: grid; place-items: center; height: 38px; border-radius: 10px; background: var(--sunk); font-weight: 600; font-size: 14px; color: var(--muted); pointer-events: none; }
.days input:checked + span { background: var(--ink); color: var(--on-ink); }
.days input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.svc-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.svc-tools .input { flex: 1 1 200px; }
.svc-group h3 { font-size: 15px; color: var(--muted); font-family: var(--body); font-weight: 600; margin: 16px 0 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.svc-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 52px; }
.svc-row + .svc-row { border-top: 1px solid var(--line); }
.svc-row .name { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }

.tri { flex: none; display: flex; padding: 3px; border-radius: 10px; background: var(--sunk); }
.tri label { position: relative; }
.tri input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.tri span { display: block; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); pointer-events: none; }
.tri input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.tri input[value="limited"]:checked + span { color: var(--free); }
.tri input[value="blocked"]:checked + span { color: var(--danger); }
.tri input:focus-visible + span { outline: 3px solid var(--accent); }

.savebar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(64px + env(safe-area-inset-bottom));
  z-index: 6;
  display: flex;
  justify-content: center;
  padding: 0 var(--gutter);
  pointer-events: none;
}
.savebar > div {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  width: 100%; max-width: calc(var(--column) - 2 * var(--gutter));
  padding: 10px 12px 10px 16px;
  border-radius: var(--radius);
  background: var(--ink); color: var(--on-ink);
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.25);
}
.savebar .btn { border-color: var(--on-ink); color: var(--on-ink); }
.savebar .btn.primary { background: var(--on-ink); color: var(--ink); }

/* ───────── Forms and buttons ───────── */

.input {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 16px; /* 16px stops iPhone zooming in on focus */
  appearance: none;
  -webkit-appearance: none;
}
select.input {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235e6b78' stroke-width='1.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea.input { resize: vertical; line-height: 1.45; min-height: 110px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.field:first-child { margin-top: 0; }
.problem { margin-top: 14px; color: var(--danger); font-weight: 600; }
.ok-note { margin-top: 14px; color: var(--online); font-weight: 600; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 0 20px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn.compact { min-height: 40px; padding: 0 14px; font-size: 15px; }
.btn.primary { background: var(--ink); color: var(--on-ink); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.quiet { border-color: var(--line); }
.btn:active { opacity: 0.7; }
.btn:disabled { opacity: 0.45; cursor: default; }
.linkbtn { all: unset; color: var(--accent); font-weight: 600; cursor: pointer; }
.linkbtn:focus-visible { outline: 3px solid var(--accent); border-radius: 4px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.button-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 8px; }
.choice-grid label { position: relative; }
.choice-grid input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.choice-grid span { display: block; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; text-align: center; font-weight: 600; pointer-events: none; }
.choice-grid input:checked + span { border-color: var(--ink); background: var(--sunk); }
.choice-grid input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice-grid span small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }

.sheet-options { display: grid; gap: 8px; margin-top: 14px; }
.sheet-options .btn { width: 100%; justify-content: flex-start; }

.steps { counter-reset: step; }
.list.steps > li { display: block; position: relative; padding: 16px 16px 16px 60px; }
.steps > li + li { border-top: 1px solid var(--line); }
.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 16px; top: 16px;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--sunk); font: 700 15px/1 var(--display);
}
.steps > li.done::before { content: "✓"; background: var(--online); color: #fff; }
.steps h3 { font-size: 17px; margin-bottom: 4px; }
.steps p + p, .steps p + ul, .steps ul + p { margin-top: 8px; }
.steps ul { list-style: disc; padding-left: 20px; color: var(--muted); font-size: 15px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; background: var(--sunk); padding: 1px 6px; border-radius: 5px; overflow-wrap: anywhere; }

details.help { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.help summary { padding: 12px 14px; cursor: pointer; font-weight: 600; }
details.help > div { padding: 0 14px 14px; font-size: 15px; }
details.help ul { list-style: disc; padding-left: 20px; }
details.help li + li { margin-top: 4px; }

/* ───────── Sign in, invites, passwords (account.js) ───────── */

#gate {
  position: fixed; inset: 0; z-index: 10;
  background: var(--paper);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.gate-body {
  min-height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) var(--gutter) calc(32px + env(safe-area-inset-bottom));
}
.gate-card { position: relative; width: 100%; max-width: 420px; margin: 0 auto; }
.gate-card h1 { font-size: 34px; margin-bottom: 8px; }
.gate-card .field { margin-top: 18px; }
.gate-brand { display: flex; align-items: center; gap: 8px; font: 700 18px/1 var(--display); color: var(--muted); margin-bottom: 24px; }
.gate-brand::before { content: ""; width: 28px; height: 28px; background: url("../icons/favicon.svg") center / contain no-repeat; }
.gate-note { margin-top: 12px; color: var(--paused); font-weight: 600; }
.gate-foot { margin-top: 24px; }

/* ───────── Accounts page (admin.js) ───────── */

.page-root { min-height: 100dvh; }
.topbar {
  display: flex; align-items: center; gap: 8px;
  min-height: 56px;
  --edge: max(var(--gutter), calc((100% - var(--column)) / 2 + var(--gutter)));
  padding: env(safe-area-inset-top) var(--edge) 0;
  border-bottom: 1px solid var(--line);
}
.back {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; margin-left: -6px; padding: 0 8px 0 2px;
  border: 0; border-radius: 8px; background: none;
  font-size: 16px; font-weight: 600; color: var(--ink); text-decoration: none; cursor: pointer;
}
.back::before {
  content: ""; width: 22px; height: 22px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M14 4l-7 7 7 7' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M14 4l-7 7 7 7' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.page-body { width: 100%; max-width: var(--column); margin: 0 auto; padding: 20px var(--gutter) calc(64px + env(safe-area-inset-bottom)); }
.page-body h2 { font-size: 22px; margin-top: 28px; margin-bottom: 8px; }
.hero { display: flex; align-items: flex-end; gap: 16px; }
.hero h1 { font-size: 34px; overflow-wrap: anywhere; }
.blurb { margin-top: 14px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; margin-bottom: 8px; }
.page-body .admin-head h2 { margin: 0; }
.admin-list { margin-top: 12px; }
.admin-item { padding: 14px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-wrap: anywhere; }
.admin-item + .admin-item { margin-top: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { display: inline-block; padding: 2px 10px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; color: var(--muted); }
.tag.warn { border-color: var(--paused); color: var(--paused); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.box { display: none; }

.dialog {
  width: min(460px, calc(100% - 2 * var(--gutter)));
  max-height: calc(100% - 32px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
}
.dialog::backdrop { background: rgb(18 23 30 / 0.5); }
.dialog h2 { font-size: 24px; margin-bottom: 10px; }
.dialog p { margin-top: 8px; }
.dialog .check.admin-check { padding: 16px 0 0; min-height: 0; }

@media (min-width: 640px) {
  .button-stack { flex-direction: row; }
  .masthead h1 { font-size: 38px; }
}

@media (hover: hover) {
  .btn:hover, .back:hover, .iconbtn:hover:not(:disabled) { opacity: 0.8; }
  #tabbar a:hover { color: var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

#toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 2 * var(--gutter));
  padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--on-ink); font-weight: 600;
  transition: opacity 150ms, transform 150ms;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* wind-down: an offline time with a few apps let through */
.daystrip .seg.wind { background: color-mix(in srgb, var(--offline) 45%, var(--sunk)); }
.window-allow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--sunk); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer;
}
.chip span { color: var(--muted); }
.compact-select { width: auto; min-height: 36px; padding: 4px 32px 4px 10px; font-size: 16px; }

/* grounded: a red card and tag, so it is obvious at a glance */
.pill.grounded { --tone: var(--danger); }
.card.grounded { border-color: var(--danger); border-width: 2px; background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.card.grounded .daystrip, .card.grounded .legend { opacity: 0.35; }
.head-grounded { padding: 12px; margin: -12px; border-radius: var(--radius); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn.ground-btn { color: var(--danger); }
