/* Tokens: light theme. Palette: green #CBFF00, pink #FF2ECF, blue #00A3FF. */
:root {
  --bg: #f5f5f7; --sidebar: #ededf0; --surface: #ffffff; --surface2: #f8f8fa;
  --fill: rgba(60,60,67,0.08); --field: #ffffff;
  --text: #1d1d1f; --text2: #5e5e65; --text3: #8a8a91;
  --border: rgba(0,0,0,0.08); --border-strong: rgba(0,0,0,0.17);
  --accent: #CBFF00; --on-accent: #141A00; --accent-soft: #F0FFC7; --accent-ink: #3D5C00; --accent-line: #8FB300;
  --link: #0061C2;
  --pink: #FF2ECF; --pink-text: #B3128F; --pink-soft: #FFE6F8;
  --blue: #00A3FF; --blue-soft: #E3F3FF;
  --danger: #b3352b; --danger-btn: #b3352b; --danger-soft: #fbeceb; --success: #3D6B00;
  --shadow: 0 1px 2px rgba(0,0,0,0.04); --sheet-shadow: 0 24px 60px rgba(0,0,0,0.2);
  --backdrop: rgba(20,20,28,0.32); --focus: #0080FF;
  --toast-bg: #1d1d1f; --toast-fg: #ffffff; --toast-icon: #FF2ECF;
  --gray-bg: #ececf0; --gray-fg: #4c4c53; --blue-bg: #E3F3FF; --blue-fg: #00559F;
  --amber-bg: #f7edd9; --amber-fg: #77500e; --green-bg: #EEFBC4; --green-fg: #3D5C00;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1b1b1d; --sidebar: #232326; --surface: #2a2a2d; --surface2: #242427;
  --fill: rgba(235,235,245,0.09); --field: #1f1f22;
  --text: #f2f2f5; --text2: #b0b0b8; --text3: #86868e;
  --border: rgba(255,255,255,0.09); --border-strong: rgba(255,255,255,0.2);
  --accent: #CBFF00; --on-accent: #141A00; --accent-soft: rgba(203,255,0,0.13); --accent-ink: #CBFF00; --accent-line: #CBFF00;
  --link: #4DB8FF;
  --pink: #FF2ECF; --pink-text: #FF7ADF; --pink-soft: rgba(255,46,207,0.16);
  --blue: #00A3FF; --blue-soft: rgba(0,163,255,0.15);
  --danger: #ff8e84; --danger-btn: #c2443a; --danger-soft: rgba(255,120,110,0.14); --success: #CBFF00;
  --shadow: none; --sheet-shadow: 0 24px 60px rgba(0,0,0,0.5);
  --backdrop: rgba(0,0,0,0.55); --focus: #4DB8FF;
  --toast-bg: #f2f2f5; --toast-fg: #1d1d1f; --toast-icon: #B3128F;
  --gray-bg: rgba(255,255,255,0.1); --gray-fg: #d2d2d8; --blue-bg: rgba(0,163,255,0.18); --blue-fg: #7ACBFF;
  --amber-bg: rgba(230,180,90,0.18); --amber-fg: #ebc684; --green-bg: rgba(203,255,0,0.14); --green-fg: #D7FF4D;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { font-family: var(--font); font-size: 15px; line-height: 1.4; color: var(--text); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
a { color: inherit; }
a:hover { opacity: .85; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: var(--text3); }
button { -webkit-tap-highlight-color: transparent; font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

.icon { width: 1em; height: 1em; flex: none; fill: currentColor; display: inline-block; vertical-align: middle; }

/* ---------- shell ---------- */
#app { height: 100%; }
.app { position: relative; width: 100%; height: 100vh; height: 100dvh; display: flex; flex-direction: row; overflow: hidden; background: var(--bg); color: var(--text);
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.app.phone { flex-direction: column; padding-bottom: 0; }
.shell { display: contents; }
main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.boot { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text2); }

.sidebar { width: 228px; flex: none; display: flex; flex-direction: column; padding: 16px 12px; background: var(--sidebar); border-right: 1px solid var(--border); overflow-y: auto; }
.sidebar .nav-list { display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; border: none; border-radius: 9px; background: transparent; color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer; text-align: left; }
.nav-btn .icon { font-size: 22px; }
.nav-btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.rail .sidebar { width: 84px; padding: 12px 6px; }
.rail .nav-btn { flex-direction: column; justify-content: center; gap: 3px; min-height: 60px; padding: 6px 2px; border-radius: 10px; color: var(--text2); font-size: 11.5px; text-align: center; }
.rail .nav-btn[aria-current="page"] { color: var(--accent-ink); }
.tabbar { display: flex; flex: none; border-top: 1px solid var(--border); background: var(--sidebar); padding: 0 4px env(safe-area-inset-bottom); }
.tabbar .nav-btn { flex-direction: column; justify-content: center; gap: 2px; flex: 1; min-height: 50px; padding: 5px 0 3px; background: transparent; color: var(--text2); font-size: 11px; border-radius: 0; text-align: center; }
.tabbar .nav-btn .icon { font-size: 25px; }
.tabbar .nav-btn[aria-current="page"] { background: transparent; color: var(--accent-ink); }

.scroll { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.page { margin: 0 auto; width: 100%; padding: 24px 28px 56px; display: flex; flex-direction: column; gap: 20px; }
.rail .page { padding: 24px 20px 56px; }
.phone .page { padding: 12px 16px 32px; gap: 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head.end { align-items: flex-end; }
.title { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.h2 { font-size: 18px; font-weight: 650; }
.h3 { font-size: 15px; font-weight: 650; }
.muted { color: var(--text2); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; }

/* ---------- controls ---------- */
.btn { min-height: 44px; padding: 0 14px; border-radius: 10px; border: none; background: var(--fill); color: var(--link); font-size: 15px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; text-decoration: none; }
.btn .icon { font-size: 20px; }
.btn.has-icon { padding-left: 10px; }
.btn-primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary .icon { font-size: 22px; }
.btn-danger { color: var(--danger); }
.btn-danger-fill { background: var(--danger-btn); color: #fff; font-weight: 600; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.btn-plain { background: none; }
.btn-sm { min-height: 40px; padding: 0 12px; border-radius: 9px; font-size: 14px; }
.btn-sm .icon { font-size: 18px; }
.btn-dashed { min-height: 36px; padding: 0 10px 0 6px; border-radius: 8px; border: 1px dashed var(--border-strong); background: none; font-size: 14px; gap: 2px; }
.btn-dashed .icon { font-size: 18px; }
.btn-link { min-height: 40px; padding: 0 4px; border: none; background: none; color: var(--link); font-size: 14px; font-weight: 500; cursor: pointer; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 9px; background: transparent; color: var(--text2); cursor: pointer; }
.icon-btn .icon { font-size: 20px; }
.icon-btn.on { background: var(--accent-soft); color: var(--link); }
.icon-btn.has-note { color: var(--link); }
.round-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 22px; background: var(--fill); color: var(--text); cursor: pointer; }
.round-btn .icon { font-size: 22px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; margin: 0 -4px; padding: 2px 4px 4px; }
.chip { flex: none; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: transparent; color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip[aria-checked="true"], .chip[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent); color: var(--on-accent); font-weight: 600; }
.chip .count { opacity: .75; font-weight: 500; }

.seg { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 2px; padding: 2px; border-radius: 10px; background: var(--fill); }
.seg-btn { min-height: 36px; border: none; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; padding: 0 8px; }
.seg-btn[aria-checked="true"], .seg-btn[aria-selected="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,0.14); font-weight: 600; }

.field-label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lbl { font-size: 14px; font-weight: 600; }
.lbl-sub { font-size: 13px; font-weight: 600; color: var(--text2); }
.req { font-weight: 500; color: var(--text2); font-size: 13px; }
.help { font-size: 13px; color: var(--text2); line-height: 1.35; }
.err { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--danger); }
.err .icon { font-size: 16px; }
.input { width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--text); background: var(--field); border: 1px solid var(--border-strong); border-radius: 10px; }
textarea.input { min-height: 84px; line-height: 1.4; resize: vertical; }
.input[aria-invalid="true"], .affix[data-invalid="true"] { border-color: var(--danger); }
.input-search { background: var(--fill); border-color: transparent; padding-left: 38px; }
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--text3); pointer-events: none; }
.affix { display: flex; align-items: center; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--field); }
.affix input { flex: 1; min-width: 0; min-height: 42px; padding: 0 12px 0 8px; border: none; border-radius: 10px; background: transparent; font: inherit; font-size: 16px; color: var(--text); }
.affix input:focus-visible { outline: none; }
.affix:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.affix input:disabled { color: var(--text2); }
.affix .pre { padding: 0 0 0 12px; font-size: 14px; font-weight: 500; color: var(--text2); }
.affix .suf { padding: 0 12px 0 0; font-size: 14px; color: var(--text2); }
.affix.suffixed input { padding: 0 6px 0 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
input[type="checkbox"] { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; cursor: pointer; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.card.pad { padding: 16px; }
.card.list { overflow: hidden; }
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 20px; border: 1px dashed var(--border-strong); border-radius: 14px; font-size: 14px; color: var(--text2); line-height: 1.45; }
.empty h2 { font-size: 17px; font-weight: 600; color: var(--text); }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.45; }
.note .icon { font-size: 20px; }
.note-amber { background: var(--amber-bg); color: var(--amber-fg); }
.note-blue { background: var(--blue-soft); color: var(--text); }
.note-blue .icon { color: var(--link); }
.note-gray { background: var(--fill); color: var(--text2); font-size: 13px; line-height: 1.5; }
.alert { display: flex; gap: 8px; align-items: flex-start; padding: 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 14px; line-height: 1.4; }
.alert .icon { font-size: 20px; }
.success { display: flex; gap: 8px; align-items: center; padding: 12px; border-radius: 10px; background: var(--green-bg); color: var(--green-fg); font-size: 14px; }
.success .icon { font-size: 20px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 6px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; flex: none; }
.badge .icon { font-size: 15px; }
.tone-gray { background: var(--gray-bg); color: var(--gray-fg); }
.tone-blue { background: var(--blue-bg); color: var(--blue-fg); }
.tone-amber { background: var(--amber-bg); color: var(--amber-fg); }
.tone-green { background: var(--green-bg); color: var(--green-fg); }
.tag { display: inline-flex; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--fill); color: var(--text2); }
.tag.tone-green { background: var(--green-bg); color: var(--green-fg); padding: 2px 7px; }
.tag.tone-amber { background: var(--amber-bg); color: var(--amber-fg); padding: 2px 7px; }
.tag.tone-blue { background: var(--blue-bg); color: var(--blue-fg); padding: 2px 7px; }
.tag-pink { background: var(--pink-soft); color: var(--pink-text); padding: 2px 7px; }
.chev { font-size: 22px; color: var(--text2); transition: transform .15s ease; }
.chev.open { transform: rotate(90deg); }

/* ---------- projects ---------- */
.split { flex: 1; min-height: 0; display: flex; }
.list-pane { width: 340px; flex: none; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.rail .list-pane { width: 300px; }
.phone .list-pane { width: auto; flex: 1; min-width: 0; border-right: none; }
.pane-head { padding: 20px 28px 10px; display: flex; flex-direction: column; gap: 12px; flex: none; }
.rail .pane-head { padding: 20px 20px 10px; }
.phone .pane-head { padding: 12px 16px 10px; }
.list-scroll { flex: 1; min-height: 0; overflow: auto; padding: 4px 28px 36px; }
.rail .list-scroll { padding: 4px 20px 28px; }
.phone .list-scroll { padding: 4px 16px 24px; }
.proj-list { display: flex; flex-direction: column; gap: 8px; }
.proj-row { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-align: left; cursor: pointer; }
.proj-row[aria-current="true"] { border-color: var(--accent-line); background: var(--accent-soft); box-shadow: none; }
.proj-row .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; width: 100%; }
.proj-row .name { font-size: 16px; font-weight: 600; line-height: 1.3; }
.proj-row .client { font-size: 14px; color: var(--text2); }
.next { display: flex; gap: 6px; align-items: flex-start; font-size: 14px; line-height: 1.35; margin-top: 2px; }
.next .icon { font-size: 17px; color: var(--pink-text); margin-top: 1px; }
.detail-pane { flex: 1; min-width: 0; min-height: 0; overflow: auto; }
.detail { max-width: 760px; margin: 0 auto; padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 16px; }
.rail .detail { padding: 24px 20px 48px; }
.phone .detail { padding: 16px 16px 48px; }
.phone-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 6px; background: var(--bg); border-bottom: 1px solid var(--border); }
.back-btn { min-height: 44px; display: inline-flex; align-items: center; background: none; border: none; color: var(--link); font-size: 17px; padding: 0 10px 0 0; cursor: pointer; }
.back-btn .icon { font-size: 30px; }
.bar-btn { min-height: 44px; padding: 0 12px; background: none; border: none; color: var(--link); font-size: 17px; font-weight: 500; cursor: pointer; }
.detail-title { font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; overflow-wrap: anywhere; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 6px 16px; }
.group-edit { min-height: 40px; padding: 0 10px; border: none; background: none; color: var(--link); font-size: 14px; font-weight: 500; cursor: pointer; border-radius: 8px; }
.group-rows { display: flex; flex-direction: column; padding: 0 16px; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: baseline; padding: 11px 0; border-top: 1px solid var(--border); }
.rail .kv { grid-template-columns: 130px minmax(0, 1fr); }
.phone .kv { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; }
.kv .k { font-size: 14px; color: var(--text2); }
.kv .v { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; font-size: 15px; }
.kv .v a { color: var(--link); text-decoration: none; overflow-wrap: anywhere; }
.kv .v .plain { white-space: pre-wrap; overflow-wrap: anywhere; }
.group-adds { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 12px; border-top: 1px solid var(--border); }
.group-adds .btn-dashed { color: var(--link); }
.no-sel { height: 100%; min-height: 240px; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--text2); font-size: 15px; }

/* ---------- pricing ---------- */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 16px; align-items: start; }
.result { display: flex; flex-direction: column; gap: 12px; }
.result h3 { font-size: 13px; font-weight: 600; color: var(--text2); }
.rrow { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.rrow .l { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rrow .val, .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.total { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.total .big { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.split-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--fill); font-size: 13px; line-height: 1.4; }
.split-note .icon { font-size: 18px; color: var(--text2); }
.disclosure { border: 1px solid var(--border); border-radius: 12px; background: var(--surface2); }
.disclosure-btn { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: none; border: none; color: var(--text); cursor: pointer; text-align: left; }
.item-row { display: flex; gap: 8px; align-items: flex-start; }
.item-row .grow { flex: 1 1 60%; }
.item-row .amt { flex: 1 1 40%; }
.item-row .icon-btn { margin-top: 22px; width: 44px; height: 44px; }
.est-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 16px; }
.est-row + .est-row, .res-row + .res-row { border-top: 1px solid var(--border); }
.est-row.open { background: var(--accent-soft); }

/* ---------- setup ---------- */
.progress { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 4px; transition: width .2s ease; }
.stage-btn { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 12px; background: none; border: none; color: var(--text); cursor: pointer; text-align: left; }
.stage-count { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--fill); color: var(--text2); }
.stage-count.complete { background: var(--green-bg); color: var(--green-fg); }
.stage-count .icon { font-size: 16px; }
.items { padding: 0 8px 4px; }
.items > li { border-top: 1px solid var(--border); }
.item-line { display: flex; align-items: center; gap: 2px; min-height: 52px; padding: 0 0 0 8px; }
.check-label { flex: 1; display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; min-width: 0; padding: 4px 0; font-size: 15px; line-height: 1.35; }
.check-label.done span { color: var(--text2); text-decoration: line-through; text-decoration-color: var(--text3); }
.inline-edit { flex: 1; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 8px 8px 10px 0; }
.inline-edit .field-label { flex: 1 1 220px; gap: 4px; }
.item-note { display: flex; flex-direction: column; gap: 6px; padding: 0 8px 12px 42px; }
.item-note textarea { min-height: 64px; }
.stage-foot { padding: 6px 16px 14px; border-top: 1px solid var(--border); }

/* ---------- resources ---------- */
.res-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 16px; }
.res-row.top { align-items: flex-start; }
.res-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 240px; }
.res-main .name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.res-main .url { font-size: 14px; color: var(--text2); overflow-wrap: anywhere; }
.prompt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 12px; }
.prompt-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.prompt-card p { font-size: 14px; line-height: 1.45; color: var(--text2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.owner-me { background: var(--blue-bg); color: var(--blue-fg); }
.owner-client { background: var(--amber-bg); color: var(--amber-fg); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; }
.overlay.small { z-index: 55; padding: 16px; }
.overlay.confirm { z-index: 60; }
.backdrop { position: absolute; inset: 0; background: var(--backdrop); }
.sheet { position: relative; width: min(600px, calc(100% - 48px)); max-height: calc(100% - 64px); background: var(--bg); border-radius: 14px; box-shadow: var(--sheet-shadow); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); }
.sheet.narrow { width: min(540px, calc(100% - 48px)); }
.phone .sheet, .sheet.full { position: absolute; inset: 0; width: auto; max-height: none; border-radius: 0; border: none; }
.sheet-head { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 8px; padding: 6px; min-height: 52px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.phone .sheet-head { padding-top: max(6px, env(safe-area-inset-top)); }
.sheet-head h2 { font-size: 17px; font-weight: 600; text-align: center; }
.sheet-head .l { justify-self: start; }
.sheet-head .r { justify-self: end; }
.head-btn { min-height: 44px; padding: 0 10px; border: none; background: none; color: var(--link); font-size: 17px; cursor: pointer; border-radius: 8px; }
.head-btn.strong { font-weight: 600; }
.sheet-body { flex: 1; min-height: 0; overflow: auto; padding: 20px 20px 40px; -webkit-overflow-scrolling: touch; }
.phone .sheet-body { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.form { display: flex; flex-direction: column; gap: 20px; }
.form.tight { gap: 18px; }
.fgroup { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.fgroup-btn { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 14px 0 10px; background: none; border: none; color: var(--text); cursor: pointer; text-align: left; }
.fgroup-body { padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.dialog { position: relative; width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--sheet-shadow); padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialog.wide { width: min(520px, 100%); max-height: calc(100% - 32px); }
.dialog h2 { font-size: 17px; font-weight: 650; line-height: 1.3; }
.dialog .msg { font-size: 15px; color: var(--text2); line-height: 1.45; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.mono { font: 13px/1.5 ui-monospace, Menlo, monospace; }
.overlay.confirm { padding: 16px; }
label.btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

.toast-wrap { position: fixed; left: 0; right: 0; bottom: 28px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 70; padding: 0 16px; }
.phone .toast-wrap { bottom: calc(66px + env(safe-area-inset-bottom)); }
.toast { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px 10px 12px; border-radius: 999px; background: var(--toast-bg); color: var(--toast-fg); font-size: 15px; font-weight: 500; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.toast .icon { font-size: 20px; color: var(--toast-icon); }
.banner { pointer-events: auto; display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; max-width: 560px; padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--sheet-shadow); font-size: 14px; }
.banner .icon { font-size: 20px; color: var(--link); }
.banner .txt { flex: 1 1 200px; }
.banner.danger .icon { color: var(--danger); }
.top-banner { flex: none; display: flex; gap: 8px; align-items: flex-start; padding: 10px 16px; background: var(--danger-soft); color: var(--danger); font-size: 14px; line-height: 1.4; border-bottom: 1px solid var(--border); }
.top-banner .icon { font-size: 20px; }
.remind-banner { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; background: var(--blue-soft); color: var(--text); font-size: 14px; line-height: 1.4; border-bottom: 1px solid var(--border); }
.remind-banner > .icon { font-size: 20px; color: var(--link); }
.remind-banner .txt { flex: 1 1 220px; }

.settings { display: flex; flex-direction: column; gap: 24px; }
.settings section { display: flex; flex-direction: column; gap: 10px; }
.set-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.set-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.set-line .t { display: flex; flex-direction: column; gap: 2px; }
.set-line .t b { font-size: 15px; font-weight: 600; }
.preview { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border); }
.counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px 12px; }
.counts span { font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.err-list { margin: 6px 0 0; padding-left: 18px; list-style: disc; font-size: 13px; }
