/* TourTally — mobile-first styles */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #efece5;
  --surface-3: #e6e2d9;
  --text: #1a1f1d;
  --muted: #66706c;
  --faint: #8d9692;
  --border: #e3dfd5;
  --primary: #0b6b58;
  --primary-strong: #08594a;
  --primary-ink: #ffffff;
  --primary-soft: #dcefe8;
  --primary-soft-ink: #0a5546;
  --hero-1: #0a5a4b;
  --hero-2: #0f7c66;
  --pos: #12805c;
  --pos-soft: #ddf2e8;
  --neg: #c2412d;
  --neg-soft: #fbe6e1;
  --warn: #9a6200;
  --warn-soft: #fbefd6;
  --shadow: 0 1px 2px rgba(20, 30, 25, 0.05), 0 6px 20px rgba(20, 30, 25, 0.06);
  --shadow-lg: 0 10px 40px rgba(10, 30, 25, 0.18);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1413;
    --surface: #161e1c;
    --surface-2: #1d2725;
    --surface-3: #26322f;
    --text: #e9eeec;
    --muted: #9aa6a2;
    --faint: #75817d;
    --border: #273230;
    --primary: #34c39f;
    --primary-strong: #4fd3b0;
    --primary-ink: #04261e;
    --primary-soft: #143a31;
    --primary-soft-ink: #8fe5cd;
    --hero-1: #0d3f35;
    --hero-2: #12594a;
    --pos: #4cd39f;
    --pos-soft: #133528;
    --neg: #ff8a73;
    --neg-soft: #3b1d17;
    --warn: #f0b955;
    --warn-soft: #3a2c10;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0e1413;
  --surface: #161e1c;
  --surface-2: #1d2725;
  --surface-3: #26322f;
  --text: #e9eeec;
  --muted: #9aa6a2;
  --faint: #75817d;
  --border: #273230;
  --primary: #34c39f;
  --primary-strong: #4fd3b0;
  --primary-ink: #04261e;
  --primary-soft: #143a31;
  --primary-soft-ink: #8fe5cd;
  --hero-1: #0d3f35;
  --hero-2: #12594a;
  --pos: #4cd39f;
  --pos-soft: #133528;
  --neg: #ff8a73;
  --neg-soft: #3b1d17;
  --warn: #f0b955;
  --warn-soft: #3a2c10;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--primary); }
a.tab, a.tab-t, a.btn, a.link-btn { text-decoration: none; }
svg { flex-shrink: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; border-radius: 8px; }

/* ---------- boot / spinner ---------- */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--surface-3); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 8px; padding-bottom: calc(110px + var(--safe-b)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in { display: flex; align-items: center; gap: 8px; min-height: 60px; }
.topbar h1 {
  font-size: 18px; font-weight: 750; margin: 0; letter-spacing: -0.01em;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar .sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  color: var(--text); transition: background 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { background: var(--surface-3); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--hero-2), var(--hero-1)); color: #fff;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px;
  font-weight: 650; font-size: 15px; letter-spacing: -0.005em;
  background: var(--surface-2); color: var(--text);
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
  user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-soft { background: var(--primary-soft); color: var(--primary-soft-ink); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { background: var(--neg-soft); color: var(--neg); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 14px; border-radius: 11px; font-size: 14px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span, .label {
  display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 7px;
}
.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1.5px solid var(--border);
  font-size: 16px; outline: none; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sheet .input, .card .input { background: var(--surface-2); border-color: transparent; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.input::placeholder { color: var(--faint); }
.input-pin { letter-spacing: 0.5em; font-size: 22px; font-weight: 700; text-align: center; }
.input-pin::placeholder { letter-spacing: 0.3em; font-size: 18px; }
.money-input { position: relative; }
.money-input .cur {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-weight: 700; font-size: 22px; color: var(--muted); pointer-events: none;
}
.money-input .input { padding-left: 42px; font-size: 26px; font-weight: 750; min-height: 62px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.form-error {
  background: var(--neg-soft); color: var(--neg); padding: 10px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 550; margin-bottom: 14px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 14px; border: 1.5px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.chip:active { transform: scale(0.97); }
.chip[aria-pressed='true'] { background: var(--primary); color: var(--primary-ink); }
.chip.off { background: transparent; border-color: var(--border); color: var(--faint); text-decoration: line-through; }
.chip[disabled] { opacity: 0.45; pointer-events: none; }
.chip .x { opacity: 0.7; display: inline-grid; place-items: center; }
.chip-cat[aria-pressed='true'] { background: var(--text); color: var(--bg); }
.chips-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.chips-head .label { margin: 0; }
.link-btn { font-size: 13px; font-weight: 650; color: var(--primary); padding: 4px 2px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 15px; font-weight: 750; margin: 0 0 12px; letter-spacing: -0.01em;
}
.card-title small { font-weight: 550; color: var(--muted); font-size: 13px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 22px 4px 10px; }

/* hero */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, var(--hero-2) 0%, var(--hero-1) 100%);
  color: #fff; border-radius: 22px; padding: 18px 18px 16px; margin-bottom: 14px;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--hero-1) 35%, transparent);
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -70px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 70%);
  pointer-events: none;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-label { font-size: 13px; font-weight: 600; opacity: 0.82; }
.hero-amount { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; margin: 2px 0 12px; line-height: 1.15; }
.hero-amount small { font-size: 14px; font-weight: 600; opacity: 0.8; letter-spacing: 0; }
.bar { position: relative; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: #fff; transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.bar > span.over { background: #ffb4a3; }
.hero-sub { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-top: 8px; opacity: 0.92; font-weight: 550; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.hero-stats > div { background: rgba(255, 255, 255, 0.11); border-radius: 14px; padding: 10px 10px 9px; min-width: 0; }
.hero-stats span { display: block; font-size: 11.5px; font-weight: 600; opacity: 0.8; white-space: nowrap; }
.hero-stats b { display: block; font-size: 16px; font-weight: 750; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 99px;
  font-size: 12px; font-weight: 700; background: var(--primary-soft); color: var(--primary-soft-ink); white-space: nowrap;
}
.hero .pill { background: rgba(255, 255, 255, 0.16); color: #fff; }
.pill-ended { background: var(--surface-3); color: var(--muted); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.quick .btn { min-height: 52px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.quick .btn svg { color: var(--primary); }

/* list rows */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 4px; border-bottom: 1px solid var(--border); min-height: 62px;
}
.row:last-child { border-bottom: 0; }
button.row { border-radius: 12px; transition: background 0.15s ease; }
button.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-amt { font-weight: 750; font-size: 15px; white-space: nowrap; text-align: right; }
.row-amt small { display: block; font-size: 12px; font-weight: 550; color: var(--muted); }
.date-head { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 16px 4px 2px; }

.cat {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text);
}
.cat-food { background: #fdebd8; color: #b45a12; }
.cat-transport { background: #dfeafc; color: #2a5bb8; }
.cat-stay { background: #ece3fb; color: #6b3fb5; }
.cat-activity { background: #dcf3e8; color: #157a50; }
.cat-shopping { background: #fbe1ea; color: #b2325f; }
.cat-other { background: var(--surface-2); color: var(--muted); }
.cat-deposit { background: var(--pos-soft); color: var(--pos); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .cat-food { background: #3a2716; color: #f5b277; }
  :root:not([data-theme='light']) .cat-transport { background: #182a45; color: #8db4f5; }
  :root:not([data-theme='light']) .cat-stay { background: #2a1f40; color: #c2a3f3; }
  :root:not([data-theme='light']) .cat-activity { background: #133328; color: #7fd8ae; }
  :root:not([data-theme='light']) .cat-shopping { background: #3c1a27; color: #f29bba; }
}

.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 750; font-size: 15px; color: #fff; flex-shrink: 0;
}
.avatar-sm { width: 30px; height: 30px; font-size: 12.5px; }
.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px;
  font-size: 11px; font-weight: 700; background: var(--primary-soft); color: var(--primary-soft-ink);
  vertical-align: 2px; margin-left: 6px; letter-spacing: 0.01em;
}
.tag-grey { background: var(--surface-2); color: var(--muted); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }

/* person rows */
.person { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 4px; border-bottom: 1px solid var(--border); border-radius: 12px; }
.person:last-child { border-bottom: 0; }
.person:hover { background: var(--surface-2); }
.p-main { flex: 1; min-width: 0; }
.p-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-bar { height: 6px; border-radius: 99px; background: var(--surface-2); margin: 7px 0 5px; overflow: hidden; }
.p-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.p-bar > span.done { background: var(--pos); }
.p-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-right { text-align: right; white-space: nowrap; }
.p-right b { display: block; font-size: 15px; font-weight: 750; }
.p-right small { display: block; font-size: 12px; color: var(--muted); font-weight: 550; }

/* settlement */
.settle-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.settle-row:last-child { border-bottom: 0; }
.settle-row .grow { flex: 1; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 10px;
  font-weight: 750; font-size: 13.5px; white-space: nowrap;
}
.badge-pos { background: var(--pos-soft); color: var(--pos); }
.badge-neg { background: var(--neg-soft); color: var(--neg); }
.badge-zero { background: var(--surface-2); color: var(--muted); }
.note {
  display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border-radius: 14px;
  padding: 12px 14px; font-size: 13.5px; color: var(--muted); margin-top: 12px;
}
.note svg { color: var(--primary); margin-top: 1px; }
.note-warn { background: var(--warn-soft); color: var(--warn); }
.note-warn svg { color: var(--warn); }

/* stat grid (person sheet) */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 12px; }
.stat span { display: block; font-size: 12px; font-weight: 650; color: var(--muted); }
.stat b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }

/* tour cards (home) */
.tour-grid { display: grid; gap: 12px; }
.tour-card {
  display: block; width: 100%; text-align: left; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tour-card:active { transform: scale(0.99); }
.tour-card:hover { box-shadow: var(--shadow-lg); }
.tc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tc-name { font-weight: 750; font-size: 17px; letter-spacing: -0.01em; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tc-bar { height: 6px; border-radius: 99px; background: var(--surface-2); margin: 14px 0 8px; overflow: hidden; }
.tc-bar > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.tc-bar > span.over { background: var(--neg); }
.tc-nums { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); gap: 8px; }
.tc-nums b { color: var(--text); font-weight: 700; }

.hello { margin: 10px 2px 18px; }
.hello h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
.hello p { margin: 4px 0 0; color: var(--muted); }
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.home-actions .btn { min-height: 54px; }

.empty { text-align: center; padding: 34px 18px; }
.empty-art {
  width: 74px; height: 74px; border-radius: 22px; margin: 0 auto 14px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.empty h3 { margin: 0 0 6px; font-size: 18px; font-weight: 750; }
.empty p { margin: 0 auto 18px; color: var(--muted); max-width: 300px; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; }
.auth-hero {
  background: linear-gradient(160deg, var(--hero-2), var(--hero-1)); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 34px) 22px 64px; position: relative; overflow: hidden;
}
.auth-hero::before, .auth-hero::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.13), transparent 70%);
}
.auth-hero::before { width: 260px; height: 260px; right: -80px; top: -90px; }
.auth-hero::after { width: 180px; height: 180px; left: -60px; bottom: -80px; }
.auth-hero .brand { color: #fff; }
.auth-hero .brand-mark { background: rgba(255, 255, 255, 0.16); }
.auth-hero h1 { font-size: 30px; line-height: 1.12; letter-spacing: -0.03em; margin: 26px 0 8px; font-weight: 800; max-width: 380px; }
.auth-hero p { margin: 0; opacity: 0.85; max-width: 360px; }
.auth-card {
  background: var(--surface); border-radius: 24px 24px 0 0; margin-top: -28px; position: relative;
  padding: 26px 20px calc(30px + var(--safe-b)); flex: 1;
}
.auth-card h2 { margin: 0 0 4px; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.auth-card .lead { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--muted); font-size: 14px; }
.auth-switch button { color: var(--primary); font-weight: 700; padding: 6px; }

/* ---------- tabs ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
}
.tabbar-in { display: grid; grid-template-columns: repeat(4, 1fr); height: var(--tabbar-h); max-width: 560px; margin: 0 auto; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11.5px; font-weight: 650; color: var(--faint); position: relative;
}
.tab[aria-current='page'] { color: var(--primary); }
.tab[aria-current='page']::before {
  content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--primary);
}
.tabs-top { display: none; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 31;
  height: 56px; padding: 0 20px 0 16px; border-radius: 18px; display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary); color: var(--primary-ink); font-weight: 750; font-size: 15px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 45%, transparent);
  transition: transform 0.15s ease;
}
.fab:active { transform: scale(0.96); }
.fab.solo { bottom: calc(var(--safe-b) + 20px); }

.view-banner {
  display: flex; align-items: center; gap: 8px; background: var(--warn-soft); color: var(--warn);
  font-size: 13px; font-weight: 650; padding: 9px 14px; border-radius: 12px; margin-bottom: 12px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 0 var(--pos); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pos) 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* code box */
.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-2); border-radius: 14px; padding: 12px 14px;
}
.code-box .code { font-size: 24px; font-weight: 800; letter-spacing: 0.18em; font-variant-numeric: tabular-nums; }
.code-box .url { font-size: 13px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

/* ---------- sheet ---------- */
#sheet-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
#sheet-root.open { pointer-events: auto; }
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(8, 15, 13, 0.45); opacity: 0; transition: opacity 0.22s ease;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  padding: 8px 18px calc(22px + var(--safe-b));
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.25, 1);
}
#sheet-root.show .sheet-backdrop { opacity: 1; }
#sheet-root.show .sheet { transform: translateY(0); }
.sheet-grip { width: 40px; height: 5px; border-radius: 99px; background: var(--surface-3); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.sheet-head h3 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; position: sticky; bottom: calc(-22px - var(--safe-b)); background: var(--surface); padding: 12px 0 calc(4px + var(--safe-b)); margin-bottom: calc(-22px - var(--safe-b)); }
.sheet-actions .btn-primary { flex: 1; }
.split-preview {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--primary-soft); color: var(--primary-soft-ink); border-radius: 12px;
  padding: 10px 14px; font-size: 14px; font-weight: 650; margin-top: 10px;
}
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.menu-list { display: flex; flex-direction: column; gap: 2px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 10px; border-radius: 12px;
  font-weight: 650;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--neg); }
.menu-item small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }

/* toast */
#toast-root {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px); z-index: 200;
  display: flex; justify-content: center; pointer-events: none; padding: 0 16px;
}
.toast {
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 14px; font-weight: 650; font-size: 14px;
  box-shadow: var(--shadow-lg); max-width: 420px; animation: toast-in 0.25s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.toast.err { background: var(--neg); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

.confirm-msg { color: var(--muted); margin: 0 0 6px; }

/* ---------- desktop ---------- */
@media (min-width: 760px) {
  body { font-size: 15.5px; }
  .tabbar { display: none; }
  .tabs-top { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; margin: 4px 0 14px; width: fit-content; }
  .tabs-top .tab-t {
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 11px;
    font-weight: 650; font-size: 14px; color: var(--muted);
  }
  .tabs-top .tab-t:hover { color: var(--text); }
  .tabs-top .tab-t[aria-current='page'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
  .fab { bottom: 28px; right: max(28px, calc((100vw - 1080px) / 2 + 16px)); }
  .fab.solo { bottom: 28px; }
  #toast-root { bottom: 100px; }
  .page { padding-bottom: 110px; }
  .tour-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
  .home-actions { max-width: 460px; }
  .split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .card { padding: 20px; }
  .hero { padding: 24px; }
  .hero-amount { font-size: 40px; }
  #sheet-root { display: grid; place-items: center; }
  .sheet {
    position: relative; left: auto; right: auto; bottom: auto; width: min(540px, calc(100vw - 32px)); max-height: 88dvh;
    border-radius: 24px; padding: 18px 24px 24px; transform: translateY(24px) scale(0.98); opacity: 0;
    transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.2s ease;
  }
  #sheet-root.show .sheet { transform: none; opacity: 1; }
  .sheet-grip { display: none; }
  .sheet-actions { bottom: -24px; margin-bottom: -24px; padding-bottom: 6px; }
  .auth { flex-direction: row; }
  .auth-hero { flex: 1; padding: 56px; display: flex; flex-direction: column; justify-content: center; }
  .auth-hero h1 { font-size: 44px; max-width: 480px; }
  .auth-hero p { font-size: 17px; max-width: 440px; }
  .auth-card { flex: 0 0 480px; margin: 0; border-radius: 0; display: flex; flex-direction: column; justify-content: center; padding: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- motion ---------- */
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.page.enter > *, .page.enter .split > div > * { animation: enter 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.page.enter .split > div > *:nth-child(2) { animation-delay: 0.04s; }
.page.enter .split > div > *:nth-child(3) { animation-delay: 0.08s; }
.page.enter .split > div > *:nth-child(n + 4) { animation-delay: 0.12s; }
.page.enter .split > div:nth-child(2) > * { animation-delay: 0.06s; }
.auth-card, .auth-hero h1, .auth-hero p { animation: enter 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.auth-hero p { animation-delay: 0.05s; }
.auth-card { animation-delay: 0.08s; }
button.row, .person, .tour-card, .menu-item, .tab, .tab-t, .icon-btn, .link-btn { transition: transform 0.14s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.18s ease; }
button.row:active, .person:active, .menu-item:active { transform: scale(0.985); }
.icon-btn:active { transform: scale(0.92); }
.tab:active svg { transform: scale(0.88); }
.tab svg { transition: transform 0.15s ease; }
.tab[aria-current='page'] svg { transform: translateY(-1px); }
.chip[aria-pressed='true'] { box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 28%, transparent); }
.chip-cat[aria-pressed='true'] { box-shadow: none; }
.btn-primary { box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 26%, transparent); }
.fab { animation: fab-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes fab-in { from { opacity: 0; transform: translateY(14px) scale(0.9); } }
.page:not(.enter) ~ .fab { animation: none; }
.tour-card:hover { transform: translateY(-2px); }
.tour-card:active { transform: scale(0.99); }

/* inset separators (clean rounded hover without curved borders) */
.row, .person { position: relative; border-bottom: 0; }
.row::after, .person::after {
  content: ''; position: absolute; left: 58px; right: 4px; bottom: 0; height: 1px; background: var(--border);
}
.row:has(> .row-main:first-child)::after { left: 4px; }
.row:last-child::after, .person:last-child::after { display: none; }
