/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--label);
  font-size: 17px; line-height: 1.4; -webkit-font-smoothing: antialiased; min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
.ic { flex-shrink: 0; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.center { text-align: center; justify-content: center; }

/* ---------- Splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg);
  transition: opacity .5s var(--ease), visibility .5s;
}
#splash.hide { opacity: 0; visibility: hidden; }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.logo {
  width: 88px; height: 88px; border-radius: 24px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #3A86FF, #0A4FC0); box-shadow: 0 12px 30px rgba(10, 91, 211, .35);
}
#splash .logo { animation: logoIn .9s var(--ease-spring) both; }
.splash-name { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; animation: fadeUp .6s .3s var(--ease) both; }
.splash-sub { color: var(--muted); font-size: 14px; animation: fadeUp .6s .45s var(--ease) both; }
.loader { width: 120px; height: 3px; border-radius: 3px; background: var(--bg-2); overflow: hidden; margin-top: 14px; animation: fadeUp .4s .55s both; }
.loader i { display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 3px; animation: loader 1s .6s var(--ease) infinite; }

@keyframes logoIn { 0% { transform: scale(.4) rotate(-14deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes loader { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px) scale(.95); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- Shell ---------- */
.sidebar { display: none; }
.main { min-height: 100vh; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 28px); }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; padding-top: env(safe-area-inset-top); transition: background .25s, box-shadow .25s;
}
.topbar.scrolled {
  background: var(--bar); box-shadow: 0 .5px 0 var(--sep);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.topbar-title { font-weight: 600; font-size: 17px; opacity: 0; transform: translateY(6px); transition: .3s var(--ease); }
.topbar.scrolled .topbar-title { opacity: 1; transform: none; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; transition: transform .15s var(--ease);
}
.pill-btn:active, .icon-btn:active, .avatar-btn:active { transform: scale(.94); }
.avatar-btn { border-radius: 50%; transition: transform .15s var(--ease); }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-2); color: var(--muted); transition: transform .15s var(--ease);
}
@media (max-width: 380px) { .pill-btn span { display: none; } .pill-btn { padding: 0 9px; } }

.view { padding: 0 16px; max-width: 1080px; margin: 0 auto; }
.view-enter { animation: viewIn .45s var(--ease-spring) both; }
.page-head { padding: 2px 4px 18px; }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.subtitle { color: var(--muted); font-size: 15px; margin-top: 4px; }

/* Tab bar (mobile) */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--bar); border-top: .5px solid var(--sep);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.tab {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 46px;
  font-size: 10.5px; font-weight: 500; color: var(--muted);
}
.tab.active { color: var(--accent); }
.tab-ic { position: relative; transition: transform .35s var(--ease-spring); }
.tab.active .tab-ic { transform: translateY(-1px) scale(1.08); }
.tab-badge, .nav-count {
  background: var(--red); color: #fff; font-size: 11px; font-weight: 600; border-radius: 999px; min-width: 18px; height: 18px;
  padding: 0 5px; display: grid; place-items: center;
}
.tab-badge { position: absolute; top: -4px; right: -10px; }

/* Sidebar (desktop) */
@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 20px 12px; z-index: 25;
    background: var(--bar); border-right: .5px solid var(--sep);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .main { margin-left: var(--sidebar); padding-bottom: 48px; }
  .tabbar { display: none; }
  .view, .topbar { padding-left: 32px; padding-right: 32px; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 24px; }
.brand .logo { width: 38px; height: 38px; border-radius: 11px; box-shadow: none; }
.brand b { font-size: 16px; letter-spacing: -.01em; display: block; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; min-height: 40px;
  color: var(--label); font-size: 15px; font-weight: 500; transition: background .2s;
}
.nav a:hover { background: var(--bg-2); }
.nav a.active { background: var(--accent); color: #fff; }
.nav a .ic { color: inherit; opacity: .85; }
.nav a.active .ic { opacity: 1; }
.nav-count { margin-left: auto; }
.sidebar-foot {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px;
  background: var(--bg-elev); text-align: left; box-shadow: var(--shadow); transition: transform .15s var(--ease);
}
.sidebar-foot:active { transform: scale(.98); }
.sidebar-foot .row-title, .sidebar-foot .row-sub { display: block; }
.sidebar-foot .row-title { font-size: 14px; }
.sidebar-foot .row-sub { font-size: 12px; }

/* ---------- Sections, stats ---------- */
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 10px; }
.section-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.section-head a { font-size: 15px; }
.card { background: var(--bg-elev); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--bg-elev); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); }
.stat-ic {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: var(--tone, var(--accent)); margin-bottom: 12px;
}
.stat-val { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; }
.t-blue { --tone: var(--accent); } .t-green { --tone: var(--green); } .t-orange { --tone: var(--orange); }
.t-red { --tone: var(--red); } .t-purple { --tone: var(--purple); } .t-teal { --tone: var(--teal); }

/* ---------- Lists ---------- */
.list { background: var(--bg-elev); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.list.is-empty { display: none; }
.no-results { display: none; }
.list.is-empty + .no-results { display: block; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 62px; position: relative;
  width: 100%; text-align: left; transition: background .15s;
}
.row:not([hidden]) ~ .row::before { content: ""; position: absolute; top: 0; left: 68px; right: 0; border-top: .5px solid var(--sep); }
.row.tap { cursor: pointer; }
.row.tap:hover { background: color-mix(in srgb, var(--bg-2) 45%, transparent); }
.row.tap:active { background: var(--bg-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; font-size: 14px; }
.row-meta { font-size: 12.5px; color: var(--muted); }
.row-meta .late { color: var(--red); font-weight: 600; }
.row .chev { color: var(--muted); opacity: .5; margin-right: -4px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.row.reminder { align-items: flex-start; }
.row.reminder .avatar { margin-top: 2px; }
.rank { width: 26px; text-align: center; font-weight: 700; color: var(--muted); font-size: 18px; }
.amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.sent { color: var(--green); font-size: 12.5px; font-weight: 600; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-weight: 600; font-size: 15px; color: #fff; letter-spacing: .01em;
  background: linear-gradient(145deg, hsl(var(--h) 72% 62%), hsl(var(--h) 62% 45%));
}
.avatar.sm { width: 32px; height: 32px; font-size: 12.5px; }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.green { background: var(--green-soft); color: #1F9D45; }
.badge.orange { background: var(--orange-soft); color: #C76A00; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.muted { background: var(--bg-2); color: var(--muted); }
@media (prefers-color-scheme: dark) { .badge.green { color: var(--green); } .badge.orange { color: var(--orange); } }

.stagger > * { animation: fadeUp .5s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 35ms); }

.empty { text-align: center; color: var(--muted); padding: 36px 16px; font-size: 15px; }
.empty .ic { margin: 0 auto 10px; opacity: .45; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px;
  border-radius: 12px; font-weight: 600; font-size: 16px; background: var(--accent); color: #fff;
  transition: transform .15s var(--ease), opacity .2s, filter .2s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.green { background: var(--green); }
.btn.green-soft { background: var(--green-soft); color: #1F9D45; }
.btn.danger-soft { background: var(--red-soft); color: var(--red); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; gap: 6px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.linkbtn { color: var(--accent); font-size: inherit; }
@media (prefers-color-scheme: dark) { .btn.green-soft { color: var(--green); } }

/* ---------- Toolbar: search, segmented, chips ---------- */
.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--bg-2); border-radius: 12px;
  padding: 0 12px; height: 40px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--label); font-size: 16px; }
.segmented { display: flex; background: var(--bg-2); border-radius: 10px; padding: 2px; overflow-x: auto; scrollbar-width: none; }
.segmented button {
  flex: 1; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--label-2);
  white-space: nowrap; transition: background .25s var(--ease), box-shadow .25s;
}
.segmented button.active { background: var(--seg-active); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); color: var(--label); }
.seg-count { color: var(--muted); font-weight: 500; margin-left: 2px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar, .segmented::-webkit-scrollbar, .offers-scroll::-webkit-scrollbar { display: none; }
.chip {
  padding: 6px 14px; border-radius: 999px; background: var(--bg-elev); font-size: 14px; font-weight: 500;
  white-space: nowrap; box-shadow: var(--shadow); transition: background .2s, color .2s, transform .15s var(--ease);
}
.chip:active { transform: scale(.95); }
.chip.active { background: var(--label); color: var(--bg-elev); }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 8px; background: var(--bg-2); overflow: hidden; }
.progress i {
  display: block; height: 100%; border-radius: inherit; background: var(--accent);
  transform-origin: left; transform: scaleX(0); transition: transform 1.1s var(--ease-spring) .15s;
}
.go .progress i { transform: scaleX(var(--p)); }
.progress.light { background: rgba(255, 255, 255, .28); }
.progress.light i { background: #fff; }
.progress.green i { background: var(--green); }

/* ---------- Offers ---------- */
.offers-scroll {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(282px, 340px); gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 14px; margin: 0 -4px; scrollbar-width: none;
}
.offers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.offer {
  scroll-snap-align: start; border-radius: 22px; padding: 18px; color: #fff; position: relative; overflow: hidden;
  min-height: 210px; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
  transition: transform .2s var(--ease);
}
.offer.tap { cursor: pointer; }
.offer.tap:active { transform: scale(.98); }
.offer::after {
  content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255, 255, 255, .13); right: -60px; top: -80px; pointer-events: none;
}
.offer > * { position: relative; z-index: 1; }
.theme-sunset { background: linear-gradient(135deg, #FF8A5B, #FF3D7F 55%, #8E44FF); }
.theme-ocean { background: linear-gradient(135deg, #00C6FB, #005BEA); }
.theme-gold { background: linear-gradient(135deg, #F7B733, #FC4A1A); }
.theme-forest { background: linear-gradient(135deg, #3DD06A, #0F8B8D); }
.theme-night { background: linear-gradient(135deg, #4A4A55, #1C1C1E); }
.offer-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.offer-emoji { font-size: 36px; line-height: 1; }
.offer-pills { display: flex; gap: 6px; align-items: center; }
.offer-pill {
  background: rgba(255, 255, 255, .24); padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.offer-del { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .18); color: #fff; }
.offer h3 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; margin-top: 14px; }
.offer p { font-size: 14px; opacity: .92; margin-top: 2px; }
.offer-foot { margin-top: auto; padding-top: 16px; }
.offer-nums { display: flex; justify-content: space-between; font-size: 13.5px; margin-top: 8px; opacity: .95; }
.offer-msg { font-weight: 700; font-size: 15.5px; margin-top: 6px; }
.mini-board { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.mini-row { display: grid; grid-template-columns: 24px 64px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.mini-row b { text-align: right; white-space: nowrap; min-width: 28px; }
.mini-row .avatar { background: rgba(255, 255, 255, .3); }
.mini-row .progress { height: 6px; }
.offer-preview { margin-bottom: 20px; }
.offer-preview .offer { min-height: 190px; }

/* ---------- Sheets ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .38); opacity: 0; transition: opacity .35s var(--ease); }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-height: 92vh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(100%); transition: transform .5s var(--ease-spring);
}
.sheet.open { transform: none; }
@media (min-width: 720px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; max-height: 88vh; border-radius: 22px;
    transform: translate(-50%, -46%) scale(.96); opacity: 0; transition: transform .45s var(--ease-spring), opacity .25s var(--ease);
  }
  .sheet.open { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-grabber { display: none; }
}
.sheet-grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--sep); margin: 8px auto 0; flex-shrink: 0; }
.sheet-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; padding: 10px 14px 8px; flex-shrink: 0; }
.sheet-head h3 { grid-column: 2; text-align: center; font-size: 17px; font-weight: 600; }
.sheet-head .icon-btn { grid-column: 3; justify-self: end; }
.sheet-body { overflow-y: auto; padding: 8px 16px calc(28px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.sheet-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 4px 0 18px; }
.sheet-hero h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; }
.sheet-hero .badge { margin-top: 6px; }
.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.mini-stats .stat { padding: 12px 14px; }
.mini-stats .stat-val { font-size: 22px; }

/* ---------- Forms (iOS grouped) ---------- */
.group-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 0 16px 6px; }
.form-group { background: var(--bg-elev); border-radius: 14px; overflow: hidden; margin-bottom: 20px; }
.field { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 48px; position: relative; }
.field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.field label, .field .field-label { width: 128px; flex-shrink: 0; font-size: 16px; }
.field input, .field select, .field textarea {
  flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; padding: 12px 0;
  text-align: right; color: var(--label);
}
.field select { appearance: none; -webkit-appearance: none; text-align-last: right; color: var(--accent); cursor: pointer; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .8; }
.field input[type="date"] { color: var(--accent); }
.field textarea { text-align: left; resize: vertical; min-height: 76px; }
.field.stack { flex-direction: column; align-items: stretch; gap: 6px; padding-top: 12px; padding-bottom: 12px; }
.field.stack label, .field.stack .field-label { width: auto; font-size: 13px; color: var(--muted); }
.field.stack textarea { padding: 0; }
.field .val { flex: 1; text-align: right; color: var(--muted); display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.field.stack .val { text-align: left; justify-content: flex-start; color: var(--label); }
.field.invalid label { color: var(--red); }
.field.invalid { background: var(--red-soft); }
.form-error { color: var(--red); font-size: 14px; font-weight: 500; text-align: center; margin: -6px 0 12px; animation: shake .4s var(--ease); }
.hint { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; color: var(--muted); padding: 0 16px; margin: -10px 0 20px; }
.hint .ic { margin-top: 2px; }
.pay-head { display: flex; justify-content: space-between; font-size: 14px; }

/* Switch */
.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--bg-2); transition: background .25s; pointer-events: none; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .22); transition: transform .35s var(--ease-spring);
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.auto-card { display: flex; align-items: center; gap: 14px; padding: 16px; margin-top: 20px; margin-bottom: 18px; }
.auto-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--green); color: #fff; flex-shrink: 0; }
.auto-card .row-sub { white-space: normal; }

/* ---------- Toast ---------- */
#toast-root {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 80;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 500;
  background: var(--bar); box-shadow: var(--shadow-lg); border: .5px solid var(--sep);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  animation: toastIn .55s var(--ease-spring) both;
}
.toast .ic { color: var(--accent); }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.confetti { position: fixed; top: -16px; width: 8px; height: 14px; border-radius: 2px; z-index: 90; pointer-events: none; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; justify-content: center; padding: calc(56px + env(safe-area-inset-top)) 16px 40px; }
.login-inner { width: 100%; max-width: 480px; }
.login-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; margin-bottom: 30px; }
.login-hero .logo { margin-bottom: 10px; animation: logoIn .8s var(--ease-spring) both; }
.login .group-label { margin-top: 22px; }
.login .hint { justify-content: center; margin-top: 22px; }

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; animation-delay: 0ms !important; }
}

/* ---------- LIC Plans + Calculator ---------- */
.segmented button .ic { display: inline-block; vertical-align: -3px; margin-right: 4px; }
.plan-no {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #fff; letter-spacing: -.01em; font-variant-numeric: tabular-nums;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c));
}
.plan-no.lg { width: 72px; height: 72px; border-radius: 20px; font-size: 22px; }
.calc-grid { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1000px) { .calc-grid { grid-template-columns: 1fr 1fr; } .calc-out { position: sticky; top: 64px; } }
.calc-form .field label { width: 132px; }
.result-card { padding: 18px; }
.result-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.result-head > div { flex: 1; min-width: 0; }
.result-head b { display: block; font-size: 16px; }
.result-head small { color: var(--muted); font-size: 13px; }
.checks { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); }
.check.ok { background: var(--green-soft); }
.check.ok .ic { color: var(--green); }
.check.bad { background: var(--red-soft); color: var(--red); }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.rs { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.rs span { display: block; font-size: 12.5px; color: var(--muted); }
.rs b { font-size: 18px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.rs.wide { grid-column: 1 / -1; }
.rs.accent b { color: var(--accent); }
.rs.green b { color: #1F9D45; }
.rs.red b { color: var(--red); }
.result-card .hint { padding: 0; margin: 0 0 14px; }
.result-card .btn-row { margin-bottom: 0; }
@media (max-width: 420px) { .tab { font-size: 9.5px; } }
.row-main > .row-meta { margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Proposal wizard ---------- */
@media (min-width: 720px) { .sheet.wide { width: 760px; } }
.wiz { position: relative; }
.wiz-steps { display: flex; gap: 6px; margin: 0 0 16px; position: sticky; top: -8px; z-index: 3; background: var(--bg); padding: 6px 0 10px; }
.wiz-step { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 4px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--bg-2); }
.wiz-step:disabled { opacity: .5; cursor: default; }
.wiz-step.active { background: var(--accent); color: #fff; }
.wiz-step.done { background: var(--green-soft); color: #1F9D45; }
.wiz-dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: rgba(255,255,255,.35); }
.wiz-foot { position: sticky; bottom: -28px; display: flex; gap: 10px; justify-content: space-between; padding: 12px 0 4px; background: linear-gradient(transparent, var(--bg) 30%); margin-top: 10px; }
.wiz-foot .btn { flex: 1; }
.wiz-intro { color: var(--muted); font-size: 15px; margin-bottom: 12px; }
.row-main > span { display: block; }
.row.picked { background: var(--accent-soft); }
.plan-pick { max-height: 52vh; overflow-y: auto; }
.plan-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--bg-elev); box-shadow: var(--shadow); margin-bottom: 14px; }
.plan-banner > div { flex: 1; min-width: 0; }
.plan-banner b { display: block; }
.plan-banner small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calc-card { padding: 14px; margin-bottom: 18px; }
.calc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 15px; }
.calc-head .badge { margin-left: auto; }
.kchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.kchip { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.kchip span { display: block; font-size: 12px; color: var(--muted); }
.kchip b { font-size: 15px; font-variant-numeric: tabular-nums; }
.kchip.accent b { color: var(--accent); }
.calc-card .checks { margin-bottom: 0; }
.field select.left { text-align: left; text-align-last: left; color: var(--label); }
.child-card { background: var(--bg-2); border-radius: 16px; padding: 10px; margin-bottom: 10px; }
.child-head { display: flex; justify-content: space-between; align-items: center; padding: 0 6px 8px; }
.add-child { margin-bottom: 4px; }
.error-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--red-soft); color: var(--red); margin-bottom: 16px; font-size: 14px; }
.error-box ul { margin: 4px 0 0 16px; }
.tracker { padding: 14px; margin-bottom: 10px; }
.tracker-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.tracker-top b { display: block; font-size: 18px; }
.tracker-top small { color: var(--muted); font-size: 13px; }
.tracker-people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tp { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--bg-2); }
.tp.ok { background: var(--green-soft); color: #1F9D45; }
.person-docs { padding: 14px; margin-bottom: 14px; }
.person-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.person-head > div { flex: 1; }
.person-head b { display: block; }
.person-head small { color: var(--muted); font-size: 13px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.doc-cell { position: relative; }
.doc-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; min-height: 132px; padding: 10px; border-radius: 14px; border: 1.5px dashed var(--sep); background: var(--bg); cursor: pointer; transition: transform .15s var(--ease), border-color .2s; }
.doc-tile:active { transform: scale(.97); }
.doc-tile:hover { border-color: var(--accent); }
.doc-tile.done { border-style: solid; border-color: var(--green); background: var(--green-soft); }
.doc-tile img { width: 100%; height: 72px; object-fit: contain; border-radius: 8px; background: #fff; }
.doc-tile.is-photo img { height: 84px; }
.doc-tile b { font-size: 13px; }
.doc-tile small { font-size: 11.5px; color: var(--muted); }
.doc-plus { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.doc-x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: #fff; box-shadow: var(--shadow); }
.busy { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(0,0,0,.45); color: #fff; }
.busy-inline { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; color: var(--muted); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; }
.busy-inline .spinner { width: 22px; height: 22px; border-color: var(--bg-2); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.done-hero { text-align: center; padding: 20px 0 18px; }
.done-hero h2 { font-size: 24px; margin-top: 14px; }
.done-check { width: 84px; height: 84px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; animation: logoIn .7s var(--ease-spring) both; }
.hint.center { justify-content: center; text-align: center; }

/* Corner editor (full screen) */
.editor-overlay { position: fixed; inset: 0; z-index: 90; background: #111; color: #fff; display: flex; flex-direction: column; opacity: 0; transition: opacity .25s var(--ease); }
.editor-overlay.open { opacity: 1; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 16px 8px; }
.editor-bar .linkbtn { color: #8ab4ff; }
.editor-help { font-size: 13px; color: #bbb; text-align: center; padding: 0 16px 8px; }
.editor-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px; }
.editor-stage canvas { touch-action: none; border-radius: 6px; cursor: crosshair; }
.editor-tools { display: flex; justify-content: center; gap: 8px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); }
.editor-tools .btn.secondary { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- Notifications ---------- */
.bell-btn { position: relative; background: var(--accent-soft); color: var(--accent); }
.bell-badge { position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; animation: logoIn .4s var(--ease-spring); }
.notif-perm { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--bg-elev); box-shadow: var(--shadow); margin-bottom: 14px; }
.notif-perm > div { flex: 1; }
.notif-perm b { display: block; font-size: 15px; }
.notif-perm small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; line-height: 1.45; }
.notif-perm code { font-size: 12px; background: var(--bg-2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.notif-perm.ok { background: var(--green-soft); }
.notif-perm.ok > .ic { color: var(--green); }
.notif-perm.warn > .ic { color: var(--orange); }
.notif-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--tone, var(--accent)); flex-shrink: 0; }
.notif.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.notif.unread .row-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 2px; }
.notif .row-sub { white-space: normal; }

/* ---------- Login + account ---------- */
.login-card { margin-top: 4px; }
.login-card .field label { width: 120px; }
.login-card .field input { text-align: left; }
.pw-toggle { color: var(--muted); padding: 6px; margin-right: -6px; }
.remember { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--label-2); padding: 0 16px 16px; cursor: pointer; }
.remember input { width: 18px; height: 18px; accent-color: var(--accent); }
.login-error { margin: 0 0 14px; }
.login .hint.center { margin-top: 18px; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; display: inline-block; vertical-align: -3px; }
.cred-box { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-radius: 14px; background: var(--bg-elev); box-shadow: var(--shadow); margin-bottom: 14px; }
.cred-box span { color: var(--muted); }
.cred-box b { font-size: 24px; letter-spacing: .08em; font-family: ui-monospace, Menlo, monospace; user-select: all; }
