/* Same roles and values as replica/design/tokens.json (copied: the phone app is a separate build). */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f4f5f7;
  --border: #e1e4e8;
  --border-input: #838b96;
  --text: #15181d;
  --text-muted: #59626d;
  --accent: #6237c8;
  --on-accent: #ffffff;
  --focus: #6237c8;
  --danger: #c22d2d;
  --warning: #8a5a00;
  --success: #1c7646;
  --r-sm: 4px;
  --r-md: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #16181c;
    --surface: #1c1f24;
    --border: #30353c;
    --border-input: #6f7884;
    --text: #e8eaed;
    --text-muted: #a0a8b3;
    --accent: #a88bf6;
    --on-accent: #150b2e;
    --focus: #a88bf6;
    --danger: #f27a7a;
    --warning: #e8b04f;
    --success: #56c993;
  }
}
* { box-sizing: border-box; }
/* `hidden` always wins over the display rules below. */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/24px "Segoe UI Variable", "Segoe UI", -apple-system, system-ui, Roboto, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 0 16px 96px; }
h1 { font-size: 22px; line-height: 28px; margin: 24px 0 8px; }
h2 { font-size: 18px; line-height: 24px; margin: 0; }
p { margin: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; line-height: 18px; }
.error { color: var(--danger); font-size: 14px; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; }
.conn { font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.conn.ok::before { background: var(--success); }
.conn.bad::before { background: var(--warning); }
.screen.center { text-align: center; padding-top: 48px; display: grid; gap: 12px; justify-items: center; }
.stack { display: grid; gap: 16px; margin-top: 16px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
input, textarea, select {
  font: inherit; font-weight: 400; color: var(--text); background: var(--bg);
  border: 1px solid var(--border-input); border-radius: var(--r-sm); padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; min-height: 120px; }
button {
  font: inherit; font-weight: 600; min-height: 44px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid var(--border-input); background: var(--bg); color: var(--text); cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
button:disabled { opacity: 0.5; cursor: default; }
button.wide { width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.row { display: flex; gap: 8px; }
.row.end { justify-content: flex-end; }
.banner { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--warning); border-radius: var(--r-md); background: var(--surface); font-size: 14px; line-height: 20px; }
.summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; font-size: 14px; }
.summary .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.limit { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.limit select { width: auto; padding: 6px 8px; font-size: 14px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 13px; line-height: 18px; color: var(--text-muted); grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta .st-downloading, .item .meta .st-probing { color: var(--accent); }
.item .meta .st-complete { color: var(--success); }
.item .meta .st-error { color: var(--danger); }
.item .meta .st-paused, .item .meta .st-needs_refresh { color: var(--warning); }
.item .act { grid-column: 2; grid-row: 1 / span 2; }
.bar-track { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); width: 0; transition: width 0.4s; }
.empty { text-align: center; padding: 48px 0; display: grid; gap: 4px; }
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
  background: var(--bg); border-top: 1px solid var(--border);
}
.bar > * { max-width: 608px; margin: 0 auto; display: block; }
.sheet {
  border: none; border-radius: 12px 12px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px);
  width: 100%; max-width: 640px; margin: auto auto 0; background: var(--bg); color: var(--text);
}
.sheet::backdrop { background: rgb(0 0 0 / 0.45); }
.sheet .stack { margin-top: 0; }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 84px); max-width: 608px; margin: 0 auto;
  padding: 10px 14px; border-radius: var(--r-md); background: var(--text); color: var(--bg); font-size: 14px;
}
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }
