:root {
  --pink: #c8175d;
  --pink-600: #a8124d;
  --pink-50: #fdecf3;
  --navy: #1d3557;
  --navy-50: #e9eef5;
  --sun: #f4b81c;
  --bg: #faf7f5;
  --surface: #ffffff;
  --surface-2: #f4f0ed;
  --text: #1f2430;
  --muted: #5d6573;
  --line: #e6e0db;
  --ok: #1f7a4d;
  --ok-50: #e5f4ec;
  --warn: #8a5a00;
  --warn-50: #fff5dc;
  --bad: #b42318;
  --bad-50: #fdecea;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 36, 48, .06), 0 4px 16px rgba(31, 36, 48, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pink: #ff5c97; --pink-600: #ff7aab; --pink-50: #3a1626;
    --navy: #9fbbe0; --navy-50: #1c2636;
    --bg: #121418; --surface: #1b1e24; --surface-2: #23272f;
    --text: #eef0f3; --muted: #a6adba; --line: #2f343d;
    --ok: #5fd39a; --ok-50: #15301f; --warn: #f2c35b; --warn-50: #33280f; --bad: #ff8a80; --bad-50: #3a1916;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow-x: hidden; font-family: var(--font); font-size: 17px; line-height: 1.5;
  background: var(--bg); color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--pink); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }

/* ── Shell ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.brand-name { font-weight: 700; font-size: .98rem; line-height: 1.1; }
.brand-sub { font-size: .75rem; color: var(--muted); }
.topbar .spacer { flex: 1; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
}
.icon-btn svg { width: 22px; height: 22px; }

main { min-width: 0; max-width: 720px; margin: 0 auto; padding: 16px 16px calc(96px + var(--safe-b)); }
main.wide { max-width: 1100px; }

.demo-banner {
  background: var(--warn-50); color: var(--warn); font-size: .85rem; text-align: center;
  padding: 6px 16px; border-bottom: 1px solid var(--line);
}
.offline-banner { background: var(--navy); color: #fff; font-size: .85rem; text-align: center; padding: 6px 16px; }

/* ── Cards / buttons / fields ──────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: center; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 420px) { .grid-2.collapse { grid-template-columns: 1fr; } }

.btn {
  appearance: none; border: 0; border-radius: 14px; min-height: 52px; padding: 12px 20px;
  font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: transform .06s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--pink); color: #fff; }
.btn-primary:hover { background: var(--pink-600); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn-navy { background: var(--navy); color: var(--surface); }
.btn-ghost { background: transparent; color: var(--pink); }
.btn-danger { background: var(--bad-50); color: var(--bad); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; }
.btn-sm { min-height: 40px; padding: 8px 14px; border-radius: 10px; font-size: .9rem; }

.field { display: block; }
.field > span.lbl { display: block; font-weight: 600; margin-bottom: 6px; }
.field .req { color: var(--pink); }
.field .hint { display: block; font-size: .85rem; color: var(--muted); margin-top: 4px; }
.field .err { display: block; font-size: .85rem; color: var(--bad); margin-top: 4px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 12px; font: inherit; font-size: 17px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-50); }
.input[aria-invalid="true"] { border-color: var(--bad); }

/* Choice cards (trip type) */
.choices { display: grid; gap: 10px; }
.choice { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .ico { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--pink-50); color: var(--pink); }
.choice .ico svg { width: 24px; height: 24px; }
.choice .t { font-weight: 700; }
.choice .d { font-size: .9rem; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-50); }
.choice:has(input:focus-visible) { outline: 3px solid var(--sun); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .95rem; }
.chip input:checked + span { background: var(--pink); border-color: var(--pink); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--pink); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--sun); outline-offset: 2px; }

.checkline { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.checkline input { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--pink); flex: none; }

/* ── Stepper ───────────────────────────────────────── */
.stepper { display: flex; gap: 6px; margin: 4px 0 18px; }
.stepper .s { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.stepper .s.on { background: var(--pink); }
.step-label { font-size: .85rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }

.sticky-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.sticky-actions .inner { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; }
.sticky-actions .inner > .btn { flex: 1; }
.sticky-actions .inner > .btn-secondary { flex: 0 0 auto; }

/* ── Hero / home ───────────────────────────────────── */
.hero { border-radius: 22px; padding: 24px 20px; color: #fff; background: radial-gradient(120% 120% at 100% 0%, #e2457f 0%, var(--pink) 45%, #8f0f43 100%); position: relative; overflow: hidden; }
.hero h1 { font-size: 1.75rem; }
.hero p { color: rgba(255,255,255,.92); }
.hero .btn-primary { background: #fff; color: var(--pink); }
.hero .btn-secondary { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.35); color: #fff; }
.hero-actions { display: grid; gap: 10px; margin-top: 16px; }
.hero::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 160px; height: 160px; border-radius: 50%; background: var(--sun); opacity: .22; }

.features { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.feature { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.feature .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--navy-50); color: var(--navy); margin-bottom: 8px; }
.feature .ico svg { width: 20px; height: 20px; }
.feature b { display: block; font-size: .95rem; }
.feature span { font-size: .85rem; color: var(--muted); }

.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: .92rem; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice.info { background: var(--navy-50); color: var(--navy); }
.notice.warn { background: var(--warn-50); color: var(--warn); }
.notice.bad { background: var(--bad-50); color: var(--bad); }
.notice.ok { background: var(--ok-50); color: var(--ok); }

/* Estimate */
.estimate { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px; border-radius: 14px; background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .estimate { background: var(--navy-50); color: var(--text); } }
.estimate .amt { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.estimate .sub { font-size: .8rem; opacity: .85; }

/* Agreement */
.agreement { max-height: 46vh; overflow-y: auto; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: .95rem; }
.agreement h3 { font-size: 1.05rem; }
.agreement h4 { font-size: .98rem; margin-top: 1em; }
.agreement ul { padding-left: 1.2em; }
.read-progress { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.read-progress i { display: block; height: 100%; width: 0; background: var(--pink); transition: width .1s; }

/* Review list */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }

.success-mark { width: 84px; height: 84px; border-radius: 50%; background: var(--ok-50); color: var(--ok); display: grid; place-items: center; margin: 8px auto 12px; }
.success-mark svg { width: 44px; height: 44px; }

/* ── Staff ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: .72rem; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 12px; position: relative; min-height: 52px; }
.bottom-nav a svg { width: 24px; height: 24px; }
.bottom-nav a.on { color: var(--pink); }
.bottom-nav a.on::before { content: ""; position: absolute; top: 2px; width: 44px; height: 30px; border-radius: 99px; background: var(--pink-50); z-index: -1; }
.badge { position: absolute; top: 2px; right: calc(50% - 22px); min-width: 18px; height: 18px; border-radius: 99px; background: var(--pink); color: #fff; font-size: .68rem; display: grid; place-items: center; padding: 0 5px; }

@media (min-width: 900px) {
  .staff-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
  .bottom-nav { position: sticky; top: 64px; height: calc(100vh - 64px); flex-direction: column; justify-content: flex-start; gap: 4px; border-top: 0; border-right: 1px solid var(--line); padding: 16px 12px; }
  .bottom-nav a { flex: none; flex-direction: row; gap: 12px; font-size: .95rem; padding: 10px 14px; min-height: 0; }
  .bottom-nav a.on { background: var(--pink-50); }
  .bottom-nav a.on::before { display: none; }
  .badge { position: static; margin-left: auto; }
  .staff-layout main { padding-bottom: 32px; }
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-decoration: none; color: inherit; }
.stat .n { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .8rem; color: var(--muted); }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-head h2 { margin: 0; }

.list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.item { display: flex; gap: 12px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; align-items: flex-start; }
button.item { font: inherit; text-align: left; width: 100%; cursor: pointer; }
.item .time { flex: none; width: 58px; text-align: center; padding: 6px 0; border-radius: 10px; background: var(--navy-50); color: var(--navy); font-weight: 800; font-size: .9rem; line-height: 1.1; }
.item .time small { display: block; font-weight: 600; font-size: .7rem; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 700; }
.item .meta { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--pink-50); color: var(--pink); }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; text-transform: capitalize; }
.pill.pending { background: var(--warn-50); color: var(--warn); }
.pill.confirmed, .pill.approved { background: var(--ok-50); color: var(--ok); }
.pill.in_progress { background: var(--navy-50); color: var(--navy); }
.pill.completed { background: var(--surface-2); color: var(--muted); }
.pill.cancelled, .pill.declined { background: var(--bad-50); color: var(--bad); }
.pill.unassigned { background: var(--pink-50); color: var(--pink); }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar .input { min-height: 46px; }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.seg button { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 99px; padding: 8px 14px; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; min-height: 40px; }
.seg button.on { background: var(--navy); border-color: var(--navy); color: var(--surface); }

.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; opacity: .5; }

.fab { position: fixed; right: 16px; bottom: calc(84px + var(--safe-b)); z-index: 19; width: 60px; height: 60px; border-radius: 18px; background: var(--pink); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(200, 23, 93, .35); border: 0; cursor: pointer; text-decoration: none; }
.fab svg { width: 28px; height: 28px; }
@media (min-width: 900px) { .fab { bottom: 24px; } }

/* Sheet / dialog */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15, 18, 25, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + var(--safe-b)); animation: up .2s ease; }
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 12px; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; z-index: 60; font-weight: 600; font-size: .95rem; max-width: calc(100% - 32px); animation: up .2s; }

.cal-day { margin-top: 16px; }
.cal-day h3 { font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.cal-day.today h3 { color: var(--pink); }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--pink); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.install-card { display: flex; gap: 12px; align-items: center; }
.install-card img { width: 48px; height: 48px; border-radius: 12px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th, table.tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.table-wrap { overflow-x: auto; }

footer.site { text-align: center; font-size: .82rem; color: var(--muted); padding: 24px 16px 8px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
