:root {
  color-scheme: light;
  --ink: #173b40;
  --ink-soft: #58716f;
  --pine: #123f46;
  --pine-2: #0b2f35;
  --cream: #f5f0e6;
  --page: #f7f4ec;
  --paper: #fffdf8;
  --surface-soft: #f0f3eb;
  --surface-green: #eaf3e8;
  --gold: #efb64b;
  --coral: #d96f55;
  --mint: #dff0df;
  --line: #d9e0d5;
  --red: #a9453d;
  --shadow: 0 14px 34px rgba(18, 63, 70, .10);
  --soft-shadow: 0 7px 20px rgba(18, 63, 70, .055);
  font-family: "Noto Sans SC", "Noto Sans CJK SC", "PingFang SC", ui-rounded, sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--paper) 94%, transparent) 0 18%, transparent 36%), var(--page); font-size: 16px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; transform: none !important; }
input, select, textarea { font-size: 16px; }
textarea { resize: vertical; }
[role="status"] { min-height: 1.2em; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: 10px; top: -44px; padding: 9px 12px; border-radius: 12px; color: #fffdf8; background: var(--pine); z-index: 999; transition: top .2s ease; }
.skip-link:focus { top: 10px; }

.button:focus-visible, .brand-button:focus-visible, .back-button:focus-visible, .trip-card-main:focus-visible,
.icon-button:focus-visible, .edit-button:focus-visible, .delete-button:focus-visible,
.dialog-close:focus-visible, .text-button:focus-visible, .top-nav .button:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible { outline: 3px solid color-mix(in srgb, var(--gold) 78%, transparent); outline-offset: 2px; }
h1:focus-visible { outline: 3px solid color-mix(in srgb, var(--gold) 78%, transparent); outline-offset: 5px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.loading-shell, .login-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.loading-shell { align-content: center; color: var(--ink-soft); }
.loading-mark { width: 38px; height: 38px; border: 3px solid var(--line); border-top-color: var(--pine); border-radius: 50%; animation: loading-spin .8s linear infinite; }
.login-gate { background: radial-gradient(circle at 10% 5%, var(--paper) 0 18%, transparent 38%), var(--page); }
.login-card { width: min(410px, 100%); padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.login-card h1 { margin: 8px 0 6px; color: var(--pine); font-size: 28px; line-height: 1.15; letter-spacing: -.04em; }
.login-card > p:not(.form-error) { margin: 0 0 24px; color: var(--ink-soft); font-size: 15px; }
.login-card label, .modal label, .assistant-form label { display: grid; gap: 7px; margin: 15px 0 0; color: var(--ink-soft); font-size: 13px; font-weight: 750; }
.login-card input, .modal input, .modal select, .modal textarea, .assistant-form textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  outline: none; color: var(--ink); background: color-mix(in srgb, var(--paper) 92%, white);
}
.login-card input:focus, .modal input:focus, .modal select:focus, .modal textarea:focus, .assistant-form textarea:focus { border-color: #5f9585; box-shadow: 0 0 0 3px rgba(95, 149, 133, .13); }
.login-card .button { width: 100%; margin-top: 8px; }

.app-shell { width: min(100% - 24px, 1180px); margin: 12px auto 48px; }
.site-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.top-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.top-nav .button { min-height: 40px; width: 100%; }
.route-status { margin: 0 0 12px; padding: 9px 12px; border-radius: 10px; border: 1px dashed #acc3bb; color: #345a57; font-size: 13px; background: color-mix(in srgb, var(--surface-soft) 72%, transparent); }
.route-status:empty { display: none; }
.route-status-warning { border-color: #d5a08f; color: #7a2a20; background: color-mix(in srgb, #f0c6b8 38%, transparent); }
.brand-button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0; border: 0; color: var(--ink); background: transparent; text-align: left; }
.brand-button > span:last-child { display: grid; gap: 1px; }
.brand-button strong { font-size: 15px; letter-spacing: -.02em; }
.brand-button small { color: var(--ink-soft); font-family: "DM Mono", ui-monospace, monospace; font-size: 12px; letter-spacing: .08em; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: #fffdf8; background: var(--pine); font-weight: 800; box-shadow: 0 5px 14px rgba(18, 63, 70, .16); }

.page-error { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 56px; margin-bottom: 14px; padding: 13px 15px; border: 1px solid color-mix(in srgb, var(--red) 32%, var(--line)); border-radius: 12px; color: var(--red); background: color-mix(in srgb, var(--red) 8%, var(--paper)); box-shadow: var(--soft-shadow); font-size: 14px; }
.page-error .text-button { flex: 0 0 auto; color: var(--red); }
.preview-discard-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink-soft); background: var(--surface-soft); font-size: 13px; }
.preview-discard-notice[hidden] { display: none; }
.route-view { animation: route-settle .22s ease-out both; }

.section-kicker, .eyebrow { display: block; color: #81928a; font-family: "DM Mono", ui-monospace, monospace; font-size: 12px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
.button { min-height: 44px; padding: 0 14px; border: 0; border-radius: 11px; font-size: 13px; font-weight: 750; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fffdf8; background: var(--pine); box-shadow: 0 5px 11px rgba(18, 63, 70, .17); }
.button-primary span { margin-left: 4px; font-size: 17px; }
.button-quiet { color: var(--ink); background: var(--surface-soft); }
.button-light { color: var(--pine); background: #fffdf8; }
.button-danger { color: #fff; background: var(--red); }
.button.is-busy { position: relative; color: var(--ink-soft); background: color-mix(in srgb, var(--surface-soft) 56%, transparent); }
.button.is-busy .button-label { margin-left: 4px; }
.button-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--pine) 24%, transparent); border-top-color: var(--pine); border-right-color: var(--pine); animation: loading-spin .7s linear infinite; display: inline-block; vertical-align: -2px; }
.text-button { min-width: 44px; min-height: 44px; padding: 0 6px; border: 0; color: var(--pine); background: none; font-size: 13px; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.danger-link { color: var(--red); }

.trips-hero { display: grid; gap: 24px; padding: 28px 23px; overflow: hidden; border-radius: 23px; color: #fffdf8; background: linear-gradient(120deg, var(--pine-2), var(--pine)); box-shadow: var(--shadow); }
.trips-hero .section-kicker { color: #b9d3c4; }
.trips-hero h1 { max-width: 680px; margin: 9px 0 8px; font-size: clamp(31px, 9vw, 47px); line-height: 1.06; letter-spacing: -.055em; }
.trips-hero p { max-width: 590px; margin: 0; color: #c8d9d3; font-size: 16px; line-height: 1.7; }
.trips-hero-actions { display: grid; gap: 9px; }
.trips-hero-actions .button { width: 100%; }
.trips-hero .button-quiet { color: #e2ece7; background: rgba(255, 255, 255, .11); }
.trips-hero .button-primary { color: var(--pine); background: var(--gold); }
.list-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 28px 4px 14px; }
.list-heading h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: -.04em; }
.list-heading p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.trip-list { display: grid; gap: 12px; }
.trip-card { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); box-shadow: var(--soft-shadow); }
.trip-card.is-archived { opacity: .82; box-shadow: none; }
.trip-card-main { display: grid; width: 100%; min-height: 190px; padding: 20px; border: 0; color: var(--ink); background: transparent; text-align: left; }
.trip-card-main:hover { background: color-mix(in srgb, var(--surface-green) 55%, transparent); }
.trip-card-main > strong { margin: 13px 0 5px; overflow-wrap: anywhere; font-size: 23px; line-height: 1.2; letter-spacing: -.045em; }
.trip-card-top { display: flex; align-items: center; gap: 7px; }
.phase-badge, .archive-badge, .read-only-pill { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.phase-planning { color: #785615; background: #f9e9be; }
.phase-ongoing { color: #176553; background: #dcefe1; }
.phase-completed { color: #536c6b; background: #e5ece7; }
.archive-badge { color: var(--ink-soft); background: var(--surface-soft); }
.trip-destination { color: var(--ink-soft); font-size: 14px; }
.trip-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: auto; padding-top: 18px; }
.trip-metrics > span { display: grid; gap: 2px; color: var(--ink-soft); font-size: 12px; }
.trip-metrics b { overflow: hidden; color: var(--pine); font-family: "DM Mono", ui-monospace, monospace; font-size: 13px; text-overflow: ellipsis; }
.trip-card-actions { display: flex; justify-content: flex-end; gap: 2px; padding: 4px 10px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-soft) 44%, transparent); }
.archive-heading { grid-column: 1 / -1; margin: 20px 3px 0; color: var(--ink-soft); font-size: 13px; font-weight: 750; letter-spacing: .03em; }
.panel-skeleton { display: grid; gap: 12px; padding: 18px; border: 1px dashed var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface-soft) 58%, transparent); }
.panel-skeleton p { margin: 0 0 12px; color: var(--ink-soft); }
.skeleton-lines { display: grid; gap: 10px; }
.skeleton-line { height: 12px; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--line) 30%, transparent), color-mix(in srgb, white 78%, var(--line)), color-mix(in srgb, var(--line) 30%, transparent)); background-size: 260px 100%; animation: panel-skeleton-shimmer 1.2s linear infinite; }
.skeleton-line:nth-child(1) { width: 82%; }
.skeleton-line:nth-child(2) { width: 68%; }
.skeleton-line:nth-child(3) { width: 74%; }
.skeleton-line:nth-child(4) { width: 58%; }
.skeleton-line:nth-child(5) { width: 60%; }
.list-loading { display: grid; min-height: 128px; padding: 28px; place-items: center; border: 1px dashed var(--line); border-radius: 14px; color: var(--ink-soft); background: color-mix(in srgb, var(--surface-soft) 58%, transparent); text-align: center; }

.detail-nav { position: sticky; z-index: 20; top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; padding: 7px 8px; border: 1px solid color-mix(in srgb, var(--line) 82%, transparent); border-radius: 13px; background: color-mix(in srgb, var(--paper) 90%, transparent); box-shadow: 0 6px 18px rgba(18, 63, 70, .07); backdrop-filter: blur(14px); }
.back-button { min-height: 44px; padding: 0 10px; border: 0; color: var(--pine); background: transparent; font-size: 13px; font-weight: 800; }
.detail-nav > span { max-width: 42%; overflow: hidden; color: var(--ink-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.archived-banner { display: grid; gap: 3px; margin-bottom: 10px; padding: 13px 16px; border: 1px solid #d8cda9; border-radius: 13px; color: #6f5b24; background: #fcf4d9; font-size: 13px; }

.hero { position: relative; isolation: isolate; min-height: 315px; overflow: hidden; padding: 27px 22px; border-radius: 23px; color: #fffdf8; background: linear-gradient(118deg, var(--pine-2), var(--pine)); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; z-index: -1; width: 420px; height: 420px; right: -218px; top: -220px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; box-shadow: 0 0 0 36px rgba(255,255,255,.035), 0 0 0 75px rgba(255,255,255,.025); }
.hero-copy { position: relative; z-index: 2; }
.eyebrow { color: #bcd6c4; }
.eyebrow > span:first-child { display: inline-block; width: 7px; height: 7px; margin: 0 7px 1px 0; border-radius: 50%; background: var(--gold); }
.hero h1 { max-width: 720px; margin: 9px 0 5px; overflow-wrap: anywhere; font-size: clamp(31px, 10vw, 43px); line-height: 1.08; letter-spacing: -.055em; }
.hero p { margin: 0; color: #c5d8d3; font-size: 15px; }
.hero-actions { position: relative; z-index: 3; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 24px; }
.hero .button-quiet { color: #e0ebe6; background: rgba(255,255,255,.10); }
.hero-art { position: absolute; right: -62px; bottom: 0; width: 250px; height: 160px; opacity: .42; }
.sun { position: absolute; width: 54px; height: 54px; right: 50px; top: 18px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 10px rgba(239,182,75,.12); }
.hill { position: absolute; bottom: -44px; transform: rotate(45deg); border-radius: 20px 0 0; }
.hill-back { width: 155px; height: 155px; right: 14px; background: #2b6b67; }
.hill-front { width: 135px; height: 135px; right: 91px; background: #1d5557; }
.tent { position: absolute; bottom: 18px; right: 108px; width: 0; height: 0; border-right: 37px solid transparent; border-left: 37px solid transparent; border-bottom: 56px solid var(--coral); filter: drop-shadow(0 6px 3px rgba(0,0,0,.18)); }

.stats { position: relative; z-index: 4; display: grid; gap: 8px; margin: -18px 10px 18px; }
.stat-card { min-height: 82px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 15px; background: color-mix(in srgb, var(--paper) 95%, transparent); box-shadow: 0 8px 18px rgba(18,63,70,.08); }
.stat-card span, .stat-card small { display: block; color: var(--ink-soft); font-size: 12px; }
.stat-card strong { display: block; margin: 3px 0; color: var(--pine); font-family: "DM Mono", ui-monospace, monospace; font-size: 24px; letter-spacing: -.06em; }
.stat-card small { display: none; }
.ledger-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: -6px 0 12px; }

.workbench { display: grid; gap: 12px; }
.panel { border: 1px solid var(--line); border-radius: 17px; background: var(--paper); box-shadow: var(--soft-shadow); }
.families-panel, .expenses-panel, .settlement-panel { padding: 19px; }
.panel-heading, .settlement-heading, .assistant-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.panel h2, .assistant-panel h2, .detail-danger h2, .modal h2 { margin: 5px 0 0; font-size: 21px; line-height: 1.2; letter-spacing: -.04em; }
.icon-button { width: 44px; height: 44px; border: 1px solid #bfd1c7; border-radius: 11px; color: var(--pine); background: #eff5ed; font-size: 24px; }
.expense-create-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }

.family-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.family-table th { padding: 0 7px 10px; border-bottom: 1px solid var(--line); color: #81908b; text-align: right; font-family: "DM Mono", ui-monospace, monospace; font-size: 12px; font-weight: 500; }
.family-table th:first-child, .family-table td:first-child { text-align: left; }
.family-table td { padding: 10px 6px; border-bottom: 1px solid color-mix(in srgb, var(--line) 52%, transparent); text-align: right; }
.family-table th:nth-child(3), .family-table td:nth-child(3), .family-table th:nth-child(4), .family-table td:nth-child(4) { display: none; }
.family-table tr:last-child td { border-bottom: 0; }
.family-name { font-weight: 750; }
.people-badge { color: var(--pine); font-family: "DM Mono", ui-monospace, monospace; }
.people-badge::before { content: "●"; margin-right: 4px; color: var(--gold); font-size: 7px; }
.row-actions { white-space: nowrap; }
.edit-button, .delete-button { width: 44px; height: 44px; border: 0; border-radius: 9px; color: #6f8982; background: transparent; font-size: 17px; }
.edit-button:hover { color: var(--pine); background: var(--surface-green); }
.delete-button:hover { color: var(--red); background: color-mix(in srgb, var(--red) 9%, var(--paper)); }

.expense-list { display: grid; gap: 9px; }
.expense-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--paper) 92%, white); }
.expense-title { overflow: hidden; font-size: 14px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.expense-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip { padding: 3px 6px; border-radius: 6px; color: var(--ink-soft); background: var(--surface-green); font-size: 12px; }
.expense-paid { text-align: right; }
.expense-paid strong { display: block; color: var(--pine); font-family: "DM Mono", ui-monospace, monospace; font-size: 15px; }
.expense-paid span { color: var(--ink-soft); font-size: 12px; }
.expense-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; border-top: 1px solid var(--line); }
.site-assistant-shortcuts, .site-draft-actions, .site-created-trips { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.site-draft-actions { margin-top: 18px; }
.site-created-trips { margin-top: 12px; }
.site-draft-preview { margin-top: 18px; overflow-wrap: anywhere; }
.site-draft-assumptions { padding: 14px; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px; background: var(--paper); }
.site-draft-assumptions p { margin: 6px 0; }
.site-trip-preview { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.site-trip-preview > h3 { margin-top: 0; }
.planning-intake { padding: 20px; margin-top: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.planning-intake h3 { margin-top: 0; }
.intake-field { display: grid; gap: 9px; margin: 18px 0; }
.intake-field label { font-weight: 650; }
.intake-options { display: flex; flex-wrap: wrap; gap: 8px; }
.intake-option { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--ink); background: var(--surface-green); cursor: pointer; }
.intake-option:hover { border-color: var(--pine); }
.intake-known { padding-left: 20px; line-height: 1.8; }

.settlement-panel { background: linear-gradient(135deg, var(--paper), color-mix(in srgb, var(--surface-green) 66%, var(--paper))); }
.settlement-note { padding: 6px 9px; border-radius: 999px; color: #497065; background: var(--mint); font-size: 12px; }
.balance-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.balance-card { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: color-mix(in srgb, var(--paper) 78%, transparent); }
.balance-card span { display: block; overflow: hidden; color: var(--ink-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.balance-card strong { display: block; margin: 5px 0 2px; font-family: "DM Mono", ui-monospace, monospace; font-size: 16px; }
.balance-card small { color: var(--ink-soft); font-size: 12px; }
.balance-card.receive strong, .assistant-balance.receive strong { color: #167560; }
.balance-card.pay strong, .assistant-balance.pay strong { color: var(--coral); }
.transfer-section { margin-top: 18px; padding-top: 16px; border-top: 1px dashed #c7d3c7; }
.transfer-header { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.transfer-list { display: grid; gap: 8px; }
.transfer-card, .assistant-transfer-list > div { display: flex; align-items: center; gap: 7px; padding: 11px 12px; border-radius: 10px; color: #30554d; background: var(--surface-green); font-size: 13px; }
.transfer-card strong, .assistant-transfer-list strong { margin-left: auto; color: var(--pine); font-family: "DM Mono", ui-monospace, monospace; }
.settled { display: flex; align-items: center; gap: 8px; padding: 13px; border-radius: 10px; color: var(--ink-soft); background: var(--surface-green); font-size: 13px; }
.settled::before { content: "✓"; display: grid; flex: 0 0 20px; width: 20px; height: 20px; place-items: center; border-radius: 50%; color: #fff; background: #6ca577; font-weight: 800; }
.empty-state { display: grid; min-height: 150px; justify-items: start; align-content: center; padding: 24px; border: 1px dashed var(--line); border-radius: 16px; color: var(--ink-soft); background: color-mix(in srgb, var(--paper) 82%, var(--surface-soft)); }
.empty-icon { color: var(--gold); font-size: 22px; }
.empty-state p { margin: 5px 0 8px; font-size: 13px; }

.assistant-panel { margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--soft-shadow); }
.travel-planner-panel { margin-top: 18px; padding: 20px; border: 1px solid color-mix(in srgb, var(--pine) 45%, var(--line)); border-radius: 18px; background: linear-gradient(145deg, var(--paper), color-mix(in srgb, var(--surface-green) 52%, var(--paper))); box-shadow: var(--soft-shadow); }
.travel-planner-panel h2 { margin: 5px 0 0; font-size: 23px; letter-spacing: -.04em; }
.provider-summary { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; color: var(--pine); background: color-mix(in srgb, var(--mint) 58%, transparent); font-size: 13px; font-weight: 700; }
.planner-current, .planner-conversation, .planner-draft { margin-top: 16px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--paper) 90%, transparent); }
.planner-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.planner-section-heading h3 { margin: 0; font-size: 17px; }
.planner-section-heading span { color: var(--ink-soft); font-size: 12px; }
.planner-messages { display: grid; gap: 9px; margin-bottom: 14px; }
.planner-message { max-width: min(92%, 760px); padding: 10px 12px; border-radius: 12px; background: var(--surface-soft); }
.planner-message-user { justify-self: end; background: var(--mint); }
.planner-message p, .planner-empty { margin: 4px 0 0; color: var(--ink-soft); line-height: 1.6; }
.travel-plan-header h3 { margin: 0; font-size: 21px; }
.travel-plan-header p { margin: 7px 0 0; color: var(--ink-soft); line-height: 1.7; }
.travel-plan-budget { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; margin: 14px 0; padding: 13px; border-radius: 12px; background: var(--pine-2); color: white; }
.travel-plan-budget strong { font-family: "DM Mono", ui-monospace, monospace; font-size: 18px; }
.travel-plan-budget small { grid-column: 1 / -1; color: color-mix(in srgb, white 72%, transparent); }
.travel-plan-days { display: grid; gap: 12px; }
.travel-plan-day { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.travel-plan-day-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 9px; }
.travel-plan-day-heading time { color: var(--pine); font-family: "DM Mono", ui-monospace, monospace; font-size: 12px; }
.travel-plan-day-heading h4 { margin: 0; font-size: 16px; }
.travel-plan-item { padding: 10px 0; border-top: 1px solid var(--line); }
.travel-plan-item-title { display: flex; justify-content: space-between; gap: 12px; }
.travel-plan-item-title span { color: var(--pine); font-family: "DM Mono", ui-monospace, monospace; font-size: 12px; }
.travel-plan-item small, .booking-note { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 12px; }
.travel-plan-item p { margin: 6px 0; line-height: 1.6; }
.travel-plan-warnings { margin-top: 12px; padding: 11px 13px; border: 1px solid color-mix(in srgb, var(--gold) 50%, var(--line)); border-radius: 10px; color: #775013; background: color-mix(in srgb, #fef3c7 75%, var(--paper)); }
.travel-plan-warnings p { margin: 5px 0 0; }
.travel-plan-sources { margin-top: 12px; color: var(--ink-soft); font-size: 12px; }
.provider-capability-list { display: grid; gap: 8px; margin-top: 14px; }
.provider-capability { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; }
.provider-capability span { color: var(--ink-soft); font-size: 12px; }
.provider-capability small { grid-column: 1 / -1; color: var(--ink-soft); overflow-wrap: anywhere; }
.provider-capability.is-ready span { color: var(--pine); }
.provider-capability.is-missing span { color: var(--red); }
.planner-actions { border-top: 1px solid var(--line); padding-top: 12px; }
.read-only-pill { flex: 0 0 auto; color: #42685d; background: var(--mint); }
.assistant-intro { margin: -7px 0 16px; color: var(--ink-soft); font-size: 14px; line-height: 1.65; }
.assistant-form { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb, var(--surface-soft) 56%, var(--paper)); }
.assistant-form label { margin-top: 0; }
.assistant-form textarea { margin-top: 7px; line-height: 1.65; }
.assistant-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.assistant-form-foot small { color: var(--ink-soft); font-family: "DM Mono", ui-monospace, monospace; font-size: 12px; }
.assistant-status, .assistant-error { min-height: 21px; margin: 12px 2px 0; font-size: 13px; }
.assistant-status { color: var(--ink-soft); }
.assistant-error { color: var(--red); }
.assistant-results { display: grid; gap: 18px; margin-top: 15px; }
.assistant-results:empty { margin: 0; }
.assistant-results > section { padding-top: 16px; border-top: 1px solid var(--line); }
.assistant-results > section:first-child { padding-top: 18px; border-top: 0; }
.assistant-results h3 { margin: 0 0 10px; font-size: 16px; letter-spacing: -.025em; }
.assistant-summary-card { padding: 18px !important; border: 0 !important; border-radius: 14px; color: #f8f4e9; background: var(--pine); }
.assistant-summary-card .section-kicker { color: #b9d4c7; }
.assistant-summary-card h3 { margin: 7px 0 6px; font-size: 21px; }
.assistant-summary-card p { margin: 0; color: #d4e2dc; line-height: 1.7; }
.assistant-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.assistant-metrics span { display: grid; gap: 2px; padding: 11px; border-radius: 10px; color: var(--ink-soft); background: var(--surface-soft); font-size: 12px; }
.assistant-metrics b { color: var(--pine); font-family: "DM Mono", ui-monospace, monospace; font-size: 15px; }
.assistant-balance-grid, .assistant-card-list, .itinerary-list, .assistant-transfer-list { display: grid; gap: 8px; }
.assistant-balance { display: grid; gap: 3px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; }
.assistant-balance span { color: var(--ink-soft); font-size: 12px; }
.assistant-balance strong { font-family: "DM Mono", ui-monospace, monospace; font-size: 18px; }
.assistant-balance small { color: var(--ink-soft); font-size: 12px; }
.assistant-item { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: color-mix(in srgb, var(--paper) 90%, white); }
.assistant-item.severity-warning { border-left: 4px solid var(--gold); }
.assistant-item.severity-critical { border-left: 4px solid var(--red); }
.assistant-item h4, .itinerary-list h4 { margin: 0 0 5px; font-size: 14px; }
.assistant-item p, .itinerary-list p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.65; }
.item-label { display: block; margin-bottom: 5px; color: var(--ink-soft); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.citation-row, .source-index > div { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.citation-chip { display: inline-flex; min-height: 25px; align-items: center; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: var(--surface-soft); font-size: 12px; }
.itinerary-list article { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; }
.itinerary-day { color: var(--coral); font-family: "DM Mono", ui-monospace, monospace; font-size: 12px; font-weight: 750; }
.itinerary-list article > strong { grid-column: 2; display: flex; align-items: baseline; gap: 7px; color: var(--pine); font-family: "DM Mono", ui-monospace, monospace; }
.itinerary-list article > strong small, .itinerary-list article div > small { color: var(--ink-soft); font-family: inherit; font-size: 12px; }
.muted-copy { color: var(--ink-soft); font-size: 13px; }

.detail-danger { display: grid; gap: 16px; margin-top: 18px; padding: 20px; }
.detail-danger p, .danger-copy { margin: 6px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.route-not-found { max-width: 620px; margin: 13vh auto 0; padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.route-not-found h1 { margin: 8px 0; font-size: 30px; letter-spacing: -.05em; }
.route-not-found p { margin: 0 0 20px; color: var(--ink-soft); }

.modal { width: min(460px, calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 0; overflow: auto; border: 0; border-radius: 17px; color: var(--ink); background: transparent; box-shadow: 0 20px 65px rgba(0,0,0,.28); }
.modal::backdrop { background: rgba(15,42,43,.56); backdrop-filter: blur(3px); }
.modal-wide { width: min(590px, calc(100% - 24px)); }
.modal-card { padding: 22px; background: var(--paper); }
.modal-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dialog-close { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 10px; color: var(--ink-soft); background: var(--surface-soft); font-size: 23px; }
.modal textarea { min-height: 92px; }
.form-grid { display: grid; gap: 0; }
.modal fieldset { margin: 15px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; }
.modal legend { padding: 0 5px; color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.fieldset-help { margin: -1px 0 10px; color: var(--ink-soft); font-size: 12px; }
.participant-options { display: grid; gap: 8px; }
.participant-option { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 50px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-soft); background: color-mix(in srgb, var(--surface-soft) 50%, var(--paper)); font-size: 12px; }
.modal .participant-check { display: flex; align-items: center; gap: 7px; min-width: 0; margin: 0; }
.modal .participant-check label { display: flex; align-items: baseline; gap: 5px; min-width: 0; margin: 0; cursor: pointer; }
.participant-check input, .split-mode-option input { width: 20px; min-width: 20px; min-height: 20px; height: 20px; padding: 0; accent-color: var(--pine); }
.participant-option small { color: var(--ink-soft); }
.split-mode-options { display: grid; gap: 8px; }
.modal .split-mode-option { display: grid; grid-template-columns: 20px 1fr; column-gap: 7px; align-items: center; min-height: 55px; margin: 0; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: color-mix(in srgb, var(--surface-soft) 50%, var(--paper)); cursor: pointer; }
.split-mode-option small { grid-column: 2; color: var(--ink-soft); font-size: 12px; font-weight: 400; }

.toast-host { position: fixed; top: 16px; right: 16px; z-index: 1200; display: grid; gap: 8px; width: min(340px, calc(100vw - 40px)); pointer-events: none; }
.toast-fallback { border-radius: 12px; padding: 10px 12px; color: #fffdf8; background: #1f4a4f; box-shadow: var(--shadow); font-size: 14px; line-height: 1.35; }
.toast-fallback.toast-success { background: #155e63; }
.toast-fallback.toast-error { background: #9d3f38; }
.toast-fallback.toast-warning { background: #8a5c16; }
.toast-fallback.toast-info { background: #1f4a4f; }
.toast-fallback.is-hiding { opacity: 0; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease; }
.mobile-quickbar { display: none; }

.expense-analysis { margin: 22px 0; padding-top: 20px; border-top: 1px solid var(--line); }
.analysis-heading, .analysis-card-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.analysis-heading h3 { margin: 3px 0 0; font-size: clamp(22px, 4vw, 29px); letter-spacing: -.04em; }
.analysis-note, .analysis-card-heading span { color: var(--ink-soft); font-size: 12px; }
.analysis-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 16px; }
.analysis-metrics article { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.analysis-metrics span { display: block; color: var(--ink-soft); font-size: 12px; }
.analysis-metrics strong { display: block; margin-top: 5px; overflow-wrap: anywhere; color: var(--pine); font-family: "DM Mono", ui-monospace, monospace; font-size: clamp(17px, 4vw, 23px); font-variant-numeric: tabular-nums; }
.analysis-grid { display: grid; gap: 12px; margin-top: 12px; }
.analysis-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb, var(--paper) 92%, var(--surface-green)); }
.analysis-card-heading { align-items: baseline; margin-bottom: 11px; }
.analysis-card-heading h4 { margin: 0; font-size: 15px; }
.analysis-chart-frame { position: relative; height: 260px; }
.analysis-chart-frame-wide { height: max(220px, min(360px, 48vw)); }
.analysis-chart-frame canvas { width: 100% !important; height: 100% !important; }
.analysis-empty { display: grid; height: 100%; min-height: 150px; place-items: center; margin: 0; padding: 14px; color: var(--ink-soft); text-align: center; }
.analysis-summary { margin: 12px 2px 0; color: var(--ink-soft); font-size: 13px; line-height: 1.65; }

@keyframes panel-skeleton-shimmer {
  0% { background-position: -180px 0; }
  100% { background-position: 180px 0; }
}

@media (max-width: 900px) {
  .top-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-nav .button { min-height: 42px; }
  .app-shell { margin-bottom: 92px; }
}

@media (min-width: 901px) {
  .mobile-quickbar { display: none; }
}

@media (max-width: 640px) {
  .top-nav .button { font-size: 12px; }
  .trips-hero .button-quiet { min-height: 44px; }
  .route-status { display: none; }
}

@media (max-width: 768px) {
.mobile-quickbar { position: fixed; left: 12px; right: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; background: color-mix(in srgb, var(--paper) 88%, transparent); border: 1px solid var(--line); border-radius: 16px; padding: 8px; box-shadow: var(--shadow); z-index: 1100; }
  .mobile-quickbar .button { min-height: 42px; justify-content: center; text-align: center; }
}
.modal .attendee-entry { display: none; grid-template-columns: auto 58px; align-items: center; gap: 5px; margin: 0; white-space: nowrap; }
.modal .attendee-entry label { margin: 0; font-size: 12px; }
.participant-option.uses-attendance .attendee-entry { display: grid; }
.attendee-entry input { width: 58px; min-height: 40px; padding: 5px; }
.form-error { min-height: 19px; margin: 10px 0 0; color: var(--red); font-size: 12px; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.ai-thumbnails { display: flex; gap: 9px; overflow-x: auto; }
.ai-thumbnails img { width: 88px; height: 88px; object-fit: cover; border-radius: 12px; }
.ai-warning { padding: 10px 12px; border-radius: 8px; color: #775013; background: #fef3c7; }
.import-replace-notice { padding: 12px; border: 1px solid color-mix(in srgb, var(--red) 30%, var(--line)); border-radius: 9px; color: var(--red); background: color-mix(in srgb, var(--red) 7%, var(--paper)); font-size: 13px; font-weight: 750; }
.import-warning { color: var(--red); font-size: 12px; }

@media (min-width: 700px) {
  .app-shell { width: min(100% - 40px, 1180px); margin-top: 24px; }
  .trips-hero { grid-template-columns: minmax(0, 1fr) auto; align-items: end; padding: 36px; }
  .trips-hero-actions { min-width: 220px; }
  .trips-hero-actions .button { width: auto; }
  .trip-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
  .hero { min-height: 235px; padding: 34px 36px; }
  .hero-actions { grid-template-columns: repeat(2, auto); justify-content: start; }
  .hero-art { right: 34px; opacity: .82; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 13px; margin: -27px 21px 23px; }
  .stat-card { min-height: 108px; padding: 17px 19px; }
  .stat-card small { display: block; }
  .family-table th:nth-child(3), .family-table td:nth-child(3), .family-table th:nth-child(4), .family-table td:nth-child(4) { display: table-cell; }
  .expense-item { grid-template-columns: minmax(0, 1fr) auto auto; }
  .expense-actions { grid-column: auto; border-top: 0; }
  .balance-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .transfer-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .analysis-grid { grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); }
  .assistant-panel { padding: 25px; }
  .travel-planner-panel { padding: 25px; }
  .assistant-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .assistant-balance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .itinerary-list article { grid-template-columns: 58px minmax(0, 1fr) auto; }
  .itinerary-list article > strong { grid-column: auto; display: grid; justify-items: end; }
  .detail-danger { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .split-mode-options { grid-template-columns: repeat(3, 1fr); }
  .modal-card { padding: 26px; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4ebe4;
  --ink-soft: #a5b5ae;
  --pine: #81b6aa;
  --pine-2: #102f31;
  --page: #192120;
  --paper: #222b29;
  --surface-soft: #2c3733;
  --surface-green: #273a34;
  --mint: #29473d;
  --line: #3a4641;
  --gold: #efbd5c;
  --coral: #ee8c72;
  --red: #f09b91;
  --shadow: 0 14px 34px rgba(0,0,0,.28);
  --soft-shadow: 0 7px 20px rgba(0,0,0,.18);
}
:root[data-theme="dark"] .button-primary { color: #102d2f; }
:root[data-theme="dark"] .button-light { color: #153638; }
:root[data-theme="dark"] .phase-planning { color: #f1cf86; background: #493c22; }
:root[data-theme="dark"] .phase-ongoing { color: #a7dcc7; background: #24463b; }
:root[data-theme="dark"] .phase-completed { color: #bac8c1; background: #34423d; }
:root[data-theme="dark"] .archived-banner { color: #e5cc84; background: #41391f; border-color: #665a31; }
:root[data-theme="dark"] .assistant-summary-card { color: #eaf3ed; background: #173e40; }
:root[data-theme="dark"] .icon-button { color: var(--ink); background: var(--surface-green); border-color: var(--line); }

@media (min-width: 980px) {
  .workbench { grid-template-columns: .9fr 1.4fr; gap: 18px; align-items: start; }
  .families-panel, .expenses-panel { min-height: 320px; padding: 22px; }
  .settlement-panel { grid-column: 1 / -1; padding: 25px; }
  .hero-actions { position: absolute; top: 34px; right: 34px; justify-content: end; max-width: 500px; margin-top: 0; }
  .hero-copy { max-width: 52%; }
  .hero-art { right: 70px; }
  .assistant-balance-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e4ebe4;
    --ink-soft: #a5b5ae;
    --pine: #81b6aa;
    --pine-2: #102f31;
    --page: #192120;
    --paper: #222b29;
    --surface-soft: #2c3733;
    --surface-green: #273a34;
    --mint: #29473d;
    --line: #3a4641;
    --gold: #efbd5c;
    --coral: #ee8c72;
    --red: #f09b91;
    --shadow: 0 14px 34px rgba(0,0,0,.28);
    --soft-shadow: 0 7px 20px rgba(0,0,0,.18);
  }
  :root:not([data-theme="light"]) .button-primary { color: #102d2f; }
  :root:not([data-theme="light"]) .button-light { color: #153638; }
  :root:not([data-theme="light"]) .phase-planning { color: #f1cf86; background: #493c22; }
  :root:not([data-theme="light"]) .phase-ongoing { color: #a7dcc7; background: #24463b; }
  :root:not([data-theme="light"]) .phase-completed { color: #bac8c1; background: #34423d; }
  :root:not([data-theme="light"]) .archived-banner { color: #e5cc84; background: #41391f; border-color: #665a31; }
  :root:not([data-theme="light"]) .assistant-summary-card { color: #eaf3ed; background: #173e40; }
  :root:not([data-theme="light"]) .icon-button { color: var(--ink); background: var(--surface-green); border-color: var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@keyframes loading-spin { to { transform: rotate(360deg); } }
@keyframes route-settle { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* --- Live Split Preview & Usability Enhancements --- */
.expense-split-preview {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 13px;
}
.expense-split-preview:empty { display: none; }
.split-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--pine);
}
.split-preview-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.split-preview-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--line) 60%, transparent);
}
.split-preview-item:last-child { border-bottom: none; }
.split-preview-family { color: var(--ink); }
.split-preview-share { font-weight: 700; color: var(--pine); }

.category-quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}
.category-quick-tag {
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  transition: all .15s ease;
}
.category-quick-tag:hover {
  border-color: var(--pine);
  color: var(--pine);
  background: var(--surface-green);
}
.category-quick-tag.active {
  background: var(--pine);
  border-color: var(--pine);
  color: #fff;
}

.category-breakdown {
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.category-breakdown-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 750;
  color: var(--pine);
}
.category-bar-list {
  display: grid;
  gap: 8px;
}
.category-bar-item {
  display: grid;
  gap: 4px;
}
.category-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft);
}
.category-bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-soft);
  overflow: hidden;
}
.category-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--pine);
  transition: width .3s ease;
}

.copy-summary-action {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.travel-advisor-checklist {
  margin-top: 14px;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.checklist-group {
  margin-bottom: 12px;
}
.checklist-group:last-child { margin-bottom: 0; }
.checklist-group-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 750;
  color: var(--pine);
}
.checklist-items {
  display: grid;
  gap: 6px;
}
.checklist-item-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.checklist-item-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--pine);
}
