:root {
  --bg: #fafafa; --surface: #ffffff; --surface-muted: #f5f5f5; --surface-soft: #fafaf9; --chip: #e7e5e4; --chip-text: #44403c;
  --chrome: #171717; --chrome-hover: #262626; --chrome-text: #a1a1a1;
  --border: #e5e5e5; --border-strong: #d4d4d4;
  --text: #171717; --text-muted: #737373; --text-subtle: #a1a1a1; --text-on-dark: #fafafa;
  --primary: #22b478; --primary-hover: #149261; --primary-active: #107550; --accent: #52d09b; --focus: #00d492;
  --primary-soft: #eefbf4; --primary-text: #107550; --link: #149261;
  --success: #00c950; --warning: #f0b100; --error: #fb2c36; --info: #2b7fff;
  --danger-surface: #fef2f2; --danger-border: #ffc9c9; --danger-text: #9f0712;
  --warning-surface: #fffbeb; --warning-border: #fee685; --warning-text: #973c00;
  --paper: #f1efea; --paper-border: #e4e1d9; --gold: #9f9061; --warm-gray: #5e5e5b;
  --radius-sm: .25rem; --radius: .375rem; --radius-lg: .5rem; --radius-pill: 9999px;
  --font: "neuzeit-grotesk", "Helvetica Neue", Helvetica, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: 16px; --topbar: 52px; --tabbar: 56px;
  --shadow: 0 10px 30px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.08);
  color-scheme: light;
}
@media (min-width: 900px) { :root { --gutter: 48px; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e1e1e; --surface: #262626; --surface-muted: #2e2e2e; --surface-soft: #2a2a2a; --chip: #3a3836; --chip-text: #d6d3d1;
    --border: #404040; --border-strong: #525252; --text: #fafafa; --text-muted: #a1a1a1; --text-subtle: #737373; --paper: #262420; --paper-border: #3a3731; --chrome: #121212;
    --primary-soft: #0e2e22; --primary-text: #52d09b; --link: #52d09b;
    --danger-surface: #3b1214; --danger-border: #7f1d1d; --danger-text: #fecaca;
    --warning-surface: #3a2a08; --warning-border: #854d0e; --warning-text: #fde68a;
    --shadow: 0 10px 30px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1e1e1e; --surface: #262626; --surface-muted: #2e2e2e; --surface-soft: #2a2a2a; --chip: #3a3836; --chip-text: #d6d3d1;
  --border: #404040; --border-strong: #525252; --text: #fafafa; --text-muted: #a1a1a1; --text-subtle: #737373; --paper: #262420; --paper-border: #3a3731; --chrome: #121212;
  --primary-soft: #0e2e22; --primary-text: #52d09b; --link: #52d09b;
  --danger-surface: #3b1214; --danger-border: #7f1d1d; --danger-text: #fecaca;
  --warning-surface: #3a2a08; --warning-border: #854d0e; --warning-text: #fde68a;
  --shadow: 0 10px 30px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
@media (min-width: 640px) { html { font-size: 15px; } }
@media (min-width: 1280px) { html { font-size: 16px; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.35 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3, p { margin: 0; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-muted); }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin: 0; }
.ic { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.title { font-size: 1.875rem; line-height: 2.25rem; font-weight: 600; letter-spacing: -.01em; }
@media (max-width: 639px) { .title { font-size: 1.5rem; line-height: 2rem; } }

/* ---------- buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 14px; font: 500 .875rem/1 var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--surface-muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.primary:active { background: var(--primary-active); }
.btn.danger { color: var(--danger-text); background: var(--danger-surface); border-color: var(--danger-border); }
.btn.danger:hover { border-color: var(--error); }
.btn.dark { background: var(--chrome-hover); border-color: #3a3a3a; color: var(--text-on-dark); }
.btn.dark:hover { background: #333; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: .8125rem; }
.btn.lg { min-height: 44px; padding: 0 22px; font-size: 1rem; }
.btn.pill { border-radius: var(--radius-pill); }
.btn.block { width: 100%; }
.btn.stop { background: var(--surface); color: var(--error); border: 2px solid var(--error); font-weight: 600; }
.btn.stop:hover { background: var(--danger-surface); }
.btn.busy .ic { animation: spin 1s linear infinite; }
.ibtn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; color: var(--text-muted); background: transparent; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; }
.ibtn:hover { background: var(--surface-muted); color: var(--text); }
.ibtn.bordered { border-color: var(--border-strong); background: var(--surface); }
.ibtn.danger:hover { color: var(--danger-text); background: var(--danger-surface); }
.ibtn.mini { width: 24px; height: 24px; }
.ibtn.light { color: #d4d4d4; } .ibtn.light:hover { background: #333; color: #fff; }
.ibtn:disabled { opacity: .4; cursor: default; }
input[type=text], input[type=search], input[type=date], input[type=password], select { width: 100%; min-height: 38px; padding: 0 12px; font: 400 .9375rem/1 var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
input::placeholder { color: var(--text-subtle); }
input:focus, select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 35%, transparent); }
input.mono { font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; position: relative; }
.field > label, .field > .label { font-size: .8125rem; font-weight: 500; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.hint { font-size: .8125rem; color: var(--text-muted); }
.alert { padding: 10px 12px; margin: 0 0 12px; font-size: .875rem; color: var(--danger-text); background: var(--danger-surface); border: 1px solid var(--danger-border); border-radius: var(--radius); }
.alert.warn { color: var(--warning-text); background: var(--warning-surface); border-color: var(--warning-border); }
.link { background: none; border: 0; padding: 0; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.empty { color: var(--text-muted); text-align: center; padding: 32px 16px; }
.card-empty { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.empty.inlist { padding: 20px 16px; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.light { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.busyline { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- top bar, nav, tab bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: var(--topbar); padding: 0 var(--gutter); background: var(--chrome); color: var(--text-on-dark); border-bottom: 1px solid #000; }
.brand { display: flex; align-items: baseline; gap: 10px; color: inherit; text-decoration: none; margin-right: 12px; }
.wordmark { font-size: 1.375rem; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.wordmark .dot { color: var(--gold); }
.byline { font-size: .6875rem; color: var(--gold); letter-spacing: .02em; }
.topbar .byline { display: none; }
@media (min-width: 1100px) { .topbar .byline { display: inline; } }
.nav { display: none; gap: 2px; }
.nav a { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; color: var(--chrome-text); font-size: .875rem; font-weight: 500; text-decoration: none; border-radius: var(--radius-lg); }
.nav a:hover { background: var(--chrome-hover); color: var(--text-on-dark); }
.nav a[aria-current="page"] { background: var(--chrome-hover); color: #fff; }
.nav a[aria-current="page"] .ic { color: var(--accent); }
.nav .ic { width: 16px; height: 16px; }
@media (min-width: 720px) { .nav { display: flex; } }
.syncbtn { min-height: 34px; padding: 0 12px; }
.menu { position: relative; }
.menubtn { display: none; min-height: 34px; padding: 0 6px 0 4px; gap: 4px; background: transparent; border-color: transparent; color: #d4d4d4; }
.menubtn:hover { background: var(--chrome-hover); }
@media (min-width: 720px) { .menubtn { display: inline-flex; } }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .75rem; font-weight: 600; flex: none; }
.avatar.big { width: 44px; height: 44px; font-size: 1.125rem; }
.avatar.off { background: var(--surface-muted); color: var(--text-muted); border: 1px solid var(--border); }
@media (max-width: 719px) {
  .syncbtn { width: 36px; padding: 0; }
  .syncbtn .bt { display: none; }
  .syncbtn .ic { width: 18px; height: 18px; }
}
.pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 260px; padding: 14px; display: flex; flex-direction: column; gap: 10px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.pop .email { font-size: .875rem; font-weight: 600; overflow-wrap: anywhere; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.seg { display: flex; gap: 2px; padding: 3px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; }
.seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; padding: 0 8px; font: 500 .8125rem var(--font); color: var(--text-muted); background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.seg button .ic { width: 14px; height: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong); }
.seg button[aria-pressed="true"] .ic { color: var(--primary); }
.tabbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); background: var(--chrome); border-top: 1px solid #000; }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--tabbar); color: var(--chrome-text); font-size: .6875rem; font-weight: 500; text-decoration: none; }
.tabbar a .ic { width: 20px; height: 20px; }
.tabbar a[aria-current="page"] { color: #fff; box-shadow: inset 0 2px 0 var(--primary); }
.tabbar a[aria-current="page"] .ic { color: var(--accent); }
@media (min-width: 720px) { .tabbar { display: none; } }

/* ---------- page */
.page { max-width: 1120px; margin: 0 auto; padding: 24px var(--gutter) calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); }
@media (min-width: 720px) { .page { padding: 32px var(--gutter) 64px; } }
.narrow { max-width: 640px; }
.pagehead { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.sechead { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 8px; }
.sechead .total { font-size: .9375rem; color: var(--text); }
.sechead .count { font-size: .75rem; }
.toolbar + .sechead, .toolbar + .day .sechead { margin-top: 16px; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-flat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.weeknav { display: flex; align-items: center; gap: 8px; }
.range { font-size: .875rem; font-weight: 500; min-width: 0; padding: 0 4px; }
.sumline { display: flex; align-items: baseline; gap: 8px; }
.searchbox { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.searchbox .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); width: 16px; height: 16px; pointer-events: none; }
.searchbox input { padding-left: 34px; }

/* ---------- timer hero */
.hero { padding: 20px 24px 24px; background: var(--paper); border: 1px solid var(--paper-border); border-radius: var(--radius-lg); }
.hero-top { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.hstat { display: inline-flex; align-items: baseline; gap: 8px; }
.hstat .mono { font-size: .9375rem; }
.hero-idle { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto auto; gap: 12px 16px; align-items: center; }
.hero input[type=text] { min-height: 46px; font-size: 1rem; }
.hero .pk-btn { min-height: 46px; }
.elapsed { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; font-size: 2rem; line-height: 1; letter-spacing: -.03em; color: var(--text); text-align: right; min-width: 7.5ch; }
.elapsed.idle { color: var(--text-subtle); }
.hero-run { display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap; }
.hr-info { min-width: 0; flex: 1 1 260px; }
.run-label { display: flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--primary-text); }
.run-desc { margin-top: 6px; font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.run-budget { margin-top: 2px; font-size: .875rem; color: var(--text-muted); }
.hr-clock { display: flex; align-items: center; gap: 20px; }
.elapsed.running { font-size: 2.75rem; }
.unsynced { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 12px; font-size: .8125rem; color: var(--warning-text); background: var(--warning-surface); border: 1px solid var(--warning-border); border-radius: var(--radius); }
.unsynced .ic { width: 14px; height: 14px; }
.unsynced .link { margin-left: auto; color: inherit; }
@media (max-width: 719px) {
  .hero { padding: 16px; }
  .hero-top { margin-bottom: 12px; gap: 14px; }
  .hero-top .hstat:last-child { display: none; }
  .hero-idle { grid-template-columns: 1fr; }
  .hero-idle .elapsed { text-align: center; font-size: 2.5rem; padding: 4px 0; }
  .hero-idle .btn { width: 100%; }
  .hero-run { flex-direction: column; align-items: stretch; }
  .hr-info { flex: none; }
  .hr-clock { flex-direction: column; align-items: stretch; gap: 14px; }
  .hr-clock .elapsed { text-align: center; font-size: 3rem; }
  .hr-clock .btn { width: 100%; }
}

/* ---------- quick add and entry rows */
.qa { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr) 96px 104px auto; gap: 8px; padding: 10px 12px; background: var(--surface-soft); border-bottom: 1px solid var(--border); align-items: center; }
.qa > * { min-width: 0; }
.qa input, .qa .pk-btn { min-height: 34px; font-size: .875rem; }
.qa .btn { min-height: 34px; }
@media (max-width: 719px) {
  .qa { grid-template-columns: minmax(0, 1fr) 88px 104px auto; }
  .qa-d { grid-column: 1 / -1; }
  .qa-b { grid-column: 1 / 2; }
}
.row { position: relative; display: grid; grid-template-areas: "main dur act" "err err err"; grid-template-columns: minmax(0, 1fr) 7ch 96px; gap: 4px 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); font-size: .875rem; }
.row.has-chk { grid-template-areas: "chk main dur act" "err err err err"; grid-template-columns: 16px minmax(0, 1fr) 7ch 96px; }
.rmain { grid-area: main; } .dur { grid-area: dur; } .actions { grid-area: act; } .rowerr { grid-area: err; } .chk { grid-area: chk; }
.list > .row:first-child, .list > .qa + .row { border-top: 0; }
.row:hover { background: var(--surface-soft); }
.row.sel { background: var(--primary-soft); }
.row.live { background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface)); }
.chk { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.row .chk:not(:checked) { opacity: .5; } .row:hover .chk { opacity: 1; }
.chk.gap { visibility: hidden; }
.desc { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 500; overflow-wrap: anywhere; }
.meta { margin-top: 2px; font-size: .8125rem; color: var(--text-muted); overflow-wrap: anywhere; }
.dur { font-size: .9375rem; text-align: right; }
.actions { display: flex; justify-content: flex-end; }
.rowerr { margin: 6px 0 0; }
.chips { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; font: 500 .6875rem/1.5 var(--font); letter-spacing: .01em; color: var(--chip-text); background: var(--chip); border: 1px solid transparent; border-radius: var(--radius-sm); }
.chip .ic { width: 11px; height: 11px; }
.chip.outline { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
.chip.locked { color: var(--warning-text); background: var(--warning-surface); border-color: var(--warning-border); }
.chip.error { color: var(--danger-text); background: var(--danger-surface); border-color: var(--danger-border); cursor: pointer; }
.chip.run { color: var(--primary-text); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.chip.run .pulse { width: 6px; height: 6px; }
.synced, .dotok { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; }
.dotoff { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: none; }
@media (hover: hover) and (min-width: 720px) {
  .row .actions { opacity: 0; transition: opacity .12s; }
  .row:hover .actions, .row:focus-within .actions { opacity: 1; }
}
@media (max-width: 719px) {
  .row { grid-template-areas: "main dur" "main act" "err err"; grid-template-columns: minmax(0, 1fr) auto; padding: 10px 14px; }
  .row.has-chk { grid-template-areas: "chk main dur" "chk main act" "err err err"; grid-template-columns: 16px minmax(0, 1fr) auto; }
  .chk { align-self: start; margin-top: 3px; }
  .dur { align-self: end; }
  .actions { align-self: start; margin-right: -8px; }
  .ibtn { width: 34px; height: 30px; }
}
.day:first-of-type .sechead { margin-top: 12px; }

/* selection bar */
.selbar { position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); bottom: 20px; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; color: var(--text-on-dark); background: var(--chrome); border: 1px solid #3a3a3a; border-radius: var(--radius-lg); box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.selbar .selcount { font-size: .875rem; font-weight: 500; white-space: nowrap; }
@media (max-width: 719px) { .selbar { bottom: calc(var(--tabbar) + 12px + env(safe-area-inset-bottom)); width: calc(100vw - 32px); justify-content: space-between; } }

/* ---------- budgets */
.brow { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--border); font-size: .875rem; }
.list > .brow:first-child { border-top: 0; }
.brow:hover { background: var(--surface-soft); }
.bname { font-weight: 500; }
.star { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--text-subtle); background: transparent; border: 0; border-radius: var(--radius); cursor: pointer; }
.star:hover { color: var(--warning); background: var(--surface-muted); }
.star[aria-pressed="true"] { color: var(--warning); }
.star[aria-pressed="true"] .ic { fill: currentColor; }

/* ---------- budget picker */
.pk { position: relative; min-width: 0; }
.pk-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 38px; padding: 0 10px 0 12px; font: 400 .9375rem/1 var(--font); color: var(--text); text-align: left; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; }
.pk-btn:focus-visible, .pk-btn[aria-expanded="true"] { outline: none; border-color: var(--focus); box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 35%, transparent); }
.pk-btn .ic { width: 16px; height: 16px; color: var(--text-subtle); }
.pk-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-label.muted { color: var(--text-subtle); }
.pk-pop { position: absolute; z-index: 40; left: 0; top: calc(100% + 4px); width: max(100%, 320px); max-width: min(480px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.qa-t + .qa-s, .qa-b .pk-pop { }
.pk-search { position: relative; padding: 8px; border-bottom: 1px solid var(--border); }
.pk-search .ic { position: absolute; left: 19px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-subtle); }
.pk-q { padding-left: 32px !important; min-height: 34px !important; }
.pk-list { list-style: none; margin: 0; padding: 4px; max-height: 280px; overflow: auto; }
.pk-opt { display: flex; align-items: baseline; gap: 8px; padding: 7px 10px; font-size: .875rem; border-radius: var(--radius-sm); cursor: pointer; }
.pk-opt.on { background: var(--surface-muted); }
.pk-opt[aria-selected="true"] { color: var(--primary-text); }
.pk-opt[aria-selected="true"] .pk-main { font-weight: 600; }
.pk-opt.none { color: var(--text-muted); }
.pk-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-sub { flex: 1; min-width: 0; color: var(--text-muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-opt .fav { width: 13px; height: 13px; color: var(--warning); fill: currentColor; align-self: center; }
.pk-sec { padding: 10px 10px 4px; font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text-subtle); }
.pk-empty { padding: 14px 10px; font-size: .8125rem; color: var(--text-muted); text-align: center; }
.qa-b .pk-pop { width: 360px; }
@media (max-width: 719px) { .pk-pop { width: 100%; max-width: none; } .qa-b .pk-pop { width: 100%; } }

/* ---------- inbudget / account */
.conn { display: flex; align-items: center; gap: 14px; }
.conn.ok { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface)); }
.cstate { display: flex; align-items: center; gap: 8px; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.conn.ok .cstate { color: var(--primary-text); }
.cname { font-size: 1.0625rem; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.steps ol { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; gap: 12px; font-size: .9375rem; }
.steps li p { margin: 2px 0 10px; font-size: .8125rem; }
.n { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; font-size: .75rem; font-weight: 600; color: var(--primary-text); background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent); border-radius: 50%; }
.steps form { padding-top: 16px; border-top: 1px solid var(--border); }
.formrow { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.dangerzone { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; padding: 14px 16px; border: 1px solid var(--danger-border); border-radius: var(--radius-lg); font-size: .875rem; }
.dangerzone p { font-size: .8125rem; margin-top: 2px; }
.mrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; color: var(--text); text-align: left; text-decoration: none; background: transparent; border: 0; border-top: 1px solid var(--border); font: inherit; cursor: pointer; }
.list > .mrow:first-child { border-top: 0; }
.mrow:hover { background: var(--surface-soft); }
.mrow b { display: block; font-weight: 500; font-size: .9375rem; }
.mrow small { display: block; margin-top: 2px; color: var(--text-muted); font-size: .8125rem; }
.mrow .chev { color: var(--text-subtle); }
.fi { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; color: var(--primary-text); background: var(--primary-soft); border-radius: var(--radius); }
.signout { margin-top: 24px; }

/* ---------- dialogs */
dialog { width: min(480px, calc(100vw - 32px)); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: visible; }
dialog::backdrop { background: rgba(10, 10, 10, .5); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { font-size: 1.0625rem; font-weight: 600; }
.dlg-body { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.dlg-body form { display: flex; flex-direction: column; gap: 16px; }
.dlg-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; background: var(--surface-soft); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 599px) {
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0; }
  .dlg-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-radius: 0; }
  .grid2 { grid-template-columns: 1fr; }
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius); }
.stat b { font-size: 1.5rem; line-height: 1.2; font-weight: 600; color: var(--text-subtle); }
.stat .label { font-size: .6875rem; letter-spacing: .06em; }
.stat.good b { color: var(--primary-text); } .stat.bad b { color: var(--danger-text); } .stat.warn b { color: var(--warning-text); }
.stat.good { background: var(--primary-soft); }
.stat.bad { background: var(--danger-surface); border-color: var(--danger-border); }
.stat.warn { background: var(--warning-surface); border-color: var(--warning-border); }
.note { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 12px; font-size: .875rem; color: var(--text-muted); background: var(--surface-muted); border-radius: var(--radius); }
.note.ok { color: var(--primary-text); background: var(--primary-soft); font-weight: 500; }
.note.warn { color: var(--warning-text); background: var(--warning-surface); }
.dlg-body > div > .stats { margin-top: 12px; }
.errs { margin: 6px 0 0; padding-left: 18px; font-size: .8125rem; color: var(--danger-text); }
.stepper { display: flex; gap: 16px; list-style: none; margin: 0 0 12px; padding: 0; font-size: .8125rem; color: var(--text-muted); }
.stepper li { display: flex; align-items: center; gap: 6px; }
.stepper li[aria-current="step"] { color: var(--text); font-weight: 600; }
.stepper .n .ic { width: 12px; height: 12px; }
.stepper li.done .n { background: var(--primary); color: #fff; }
.stepper li:not([aria-current]):not(.done) .n { color: var(--text-subtle); background: var(--surface-muted); border-color: var(--border); }

/* ---------- toasts */
#toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100vw - 32px)); padding: 10px 8px 10px 14px; font-size: .875rem; color: var(--text-on-dark); background: var(--chrome); border: 1px solid #3a3a3a; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.toast .ic { color: var(--accent); }
.toast.error { background: var(--danger-surface); color: var(--danger-text); border-color: var(--danger-border); }
.toast.error .ic { color: var(--error); }
.toast .ibtn { color: inherit; opacity: .7; }
@media (max-width: 719px) { #toasts { left: 16px; right: 16px; bottom: calc(var(--tabbar) + 12px + env(safe-area-inset-bottom)); align-items: stretch; } }

/* ---------- login */
body.login-page { background: var(--paper); display: flex; flex-direction: column; min-height: 100vh; }
.login-page #app { display: flex; flex-direction: column; flex: 1; }
.login-top { display: flex; justify-content: flex-end; padding: 16px var(--gutter) 0; }
.login-page .card { width: min(440px, calc(100vw - 32px)); margin: auto; padding: 32px; background: var(--surface); border: 1px solid var(--paper-border); border-radius: var(--radius-lg); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px rgba(0,0,0,.06); }
.login-page #app > .card { margin: 4vh auto 8vh; }
.login-page .wordmark { font-size: 2.25rem; }
.login-page .wordmark .dot { color: var(--gold); }
.login-page .byline { margin-top: 4px; font-size: .75rem; }
.login-page .lead { margin: 22px 0 18px; font-size: 1.0625rem; line-height: 1.45; font-weight: 500; }
.features { list-style: none; margin: 0 0 24px; padding: 16px 0; display: flex; flex-direction: column; gap: 14px; border-block: 1px solid var(--border); }
.features li { display: flex; gap: 12px; align-items: flex-start; font-size: .875rem; color: var(--text-muted); line-height: 1.4; }
.features b { color: var(--text); font-weight: 600; }
.features .fi { width: 28px; height: 28px; }
.features .fi .ic { width: 15px; height: 15px; }
.fine { margin-top: 16px; font-size: .75rem; color: var(--text-muted); text-align: center; }
.login-page .btn.block { text-decoration: none; }
.themebtn { min-height: 34px; font-size: .8125rem; background: var(--surface); }
.login-page .card .alert { margin-bottom: 16px; }
.login-page .card > p:not([class]) { margin: 12px 0; }
