
/* Tokens and theme */
:root {
  --bg:#F7F7F5; --surface:#FFFEFB; --surface-2:#F1F3F2; --line:#D8E1E0;
  --ink:#102A2B; --ink-2:#4B5D5E; --accent:#006B73; --on-accent:#FFFFFF;
  --accent-soft:#E2F4F3; --ok:#1F7A55; --warn:#9A5B00; --accent-2:#D96B50; --danger:#B42323;
  --elev:0 1px 2px rgba(16,24,40,.06);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",sans-serif;
  font-size:100%;
  line-height:1.4;
  --kb:0px; --vvh:100vh; --nav-h:65px;
  color:var(--ink); background:var(--bg);
}
.auth-screen { min-height:100vh; min-height:100dvh; display:grid; place-items:center; padding:24px; background:var(--bg); }
.auth-card { width:min(100%, 420px); text-align:center; }
.auth-card h1 { margin:12px 0 8px; }
.auth-icon { width:64px; height:64px; }
@media (prefers-color-scheme:dark) {
  :root { --bg:#0E1116; --surface:#171B22; --surface-2:#212631; --line:#303842; --ink:#F2F4F7; --ink-2:#A9B2C0; --accent:#59D6D5; --on-accent:#081B1C; --accent-soft:#123C3E; --ok:#4FC08D; --warn:#F0B35A; --accent-2:#FF9A7D; --danger:#FF8A80; --elev:none; }
}
[data-theme="light"] { --bg:#F7F7F5; --surface:#FFFEFB; --surface-2:#F1F3F2; --line:#D8E1E0; --ink:#102A2B; --ink-2:#4B5D5E; --accent:#006B73; --on-accent:#FFFFFF; --accent-soft:#E2F4F3; --ok:#1F7A55; --warn:#9A5B00; --accent-2:#D96B50; --danger:#B42323; --elev:0 1px 2px rgba(16,24,40,.06); }
[data-theme="dark"] { --bg:#0E1116; --surface:#171B22; --surface-2:#212631; --line:#303842; --ink:#F2F4F7; --ink-2:#A9B2C0; --accent:#59D6D5; --on-accent:#081B1C; --accent-soft:#123C3E; --ok:#4FC08D; --warn:#F0B35A; --accent-2:#FF9A7D; --danger:#FF8A80; --elev:none; }

/* Base layout and navigation */
* { box-sizing:border-box; }
html { background:var(--bg); }
@supports (font: -apple-system-body) { html { font:-apple-system-body; } }
body { margin:0; min-width:320px; background:var(--bg); }
body.modal-open { overflow:hidden; }
button,input,select,textarea { font:inherit; }
button { border:0; cursor:pointer; color:inherit; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
@media (prefers-reduced-motion: no-preference) { button:active { transform:scale(.98); } }
a { color:var(--accent); font-weight:600; }
.shell { max-width:760px; min-height:100vh; min-height:100dvh; margin:auto; padding:calc(max(env(safe-area-inset-top), 12px) + 8px) max(16px, env(safe-area-inset-right)) calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px) max(16px, env(safe-area-inset-left)); }
.topbar { display:flex; align-items:center; gap:12px; padding:0 16px 12px; }
.topbar h1 { font-size:1.75rem; line-height:1.21; margin:0; font-weight:700; letter-spacing:-.03em; }
.topbar h1.brand { display:flex; align-items:center; gap:8px; }
.tara-icon { width:28px; height:28px; border-radius:7px; object-fit:cover; }
.topbar.pushed { padding-bottom:4px; }
.trip-heading { padding:0 16px 12px; }
.trip-heading h1 { margin:0; font-size:1.375rem; line-height:1.27; font-weight:700; }
.shell.pushed { padding-top:calc(max(env(safe-area-inset-top), 12px) + 8px); }
.topbar .back { display:flex; align-items:center; gap:4px; min-height:44px; padding:0; background:none; color:var(--accent); font-size:0.9375rem; font-weight:600; }
.back-icon { display:grid; place-items:center; transform:rotate(180deg); }
.topbar .add-btn { margin-left:auto; background:var(--accent); color:var(--on-accent); border-radius:12px; width:44px; height:44px; display:grid; place-items:center; }
.topbar .add-btn svg { width:22px; height:22px; }
.topbar .avatar { background:var(--accent-soft); color:var(--accent); border-radius:12px; width:44px; height:44px; display:grid; place-items:center; font-weight:700; }
.content { padding:0; }
.bottom-nav { position:fixed; z-index:5; left:0; right:0; bottom:0; display:flex; justify-content:space-around; background:color-mix(in srgb,var(--surface) 94%,transparent); backdrop-filter:blur(18px); border-top:1px solid var(--line); padding:4px max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left)); }
.nav-btn { min-width:56px; min-height:49px; display:flex; flex-direction:column; align-items:center; gap:2px; background:none; color:var(--ink-2); font-size:0.8125rem; padding:4px 8px; }
.nav-btn.active { color:var(--accent); font-weight:600; }
.nav-btn { position:relative; }
.nav-btn sup { position:absolute; top:1px; margin-left:24px; min-width:18px; padding:1px 4px; border-radius:999px; background:var(--danger); color:var(--on-accent); font-size:0.75rem; line-height:1.33; font-weight:700; }
.icon { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.75; stroke-linecap:round; stroke-linejoin:round; }

/* Cards, type, and shared rows */
.offline { margin:0 16px 12px; padding:10px 12px; border:1px solid var(--warn); background:color-mix(in srgb,var(--warn) 12%,var(--surface)); color:var(--warn); border-radius:12px; font-size:0.8125rem; }
.card,.panel { background:var(--surface); border:1px solid var(--line); border-radius:16px; box-shadow:var(--elev); padding:16px; }
.card { margin-bottom:12px; }
.duplicate-columns { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin:12px 0; }
.duplicate-columns > div { min-width:0; padding:10px; background:var(--surface-2); border-radius:12px; }
.section-head { display:flex; align-items:center; justify-content:space-between; margin:24px 0 10px; }
.section-head h2 { font-size:1.375rem; line-height:1.27; margin:0; }
.eyebrow { font-size:0.8125rem; line-height:1.38; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-2); }
.quiet,.caption { font-size:0.8125rem; line-height:1.38; color:var(--ink-2); }
.headline { font-size:1.0625rem; line-height:1.29; font-weight:600; }
.subhead { font-size:0.9375rem; line-height:1.33; color:var(--ink-2); }
.field-tip { margin:6px 0 0; }
.tabular,.money,time { font-variant-numeric:tabular-nums; }
.row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.event-main { min-width:0; flex:1; }
.event-title,.doc-title { display:block; font-size:1.0625rem; line-height:1.29; font-weight:600; }
.event-meta { display:block; min-width:0; font-size:0.9375rem; line-height:1.33; color:var(--ink-2); overflow-wrap:anywhere; }
.warning { display:flex; gap:8px; align-items:flex-start; color:var(--warn); font-size:0.8125rem; margin-top:12px; }
.badge,.status { display:inline-flex; align-items:center; gap:5px; border-radius:999px; padding:4px 8px; font-size:0.8125rem; font-weight:600; white-space:nowrap; }
.badge.warn,.status.changed { color:var(--warn); background:color-mix(in srgb,var(--warn) 14%,transparent); }
.status.cancelled { color:var(--danger); background:color-mix(in srgb,var(--danger) 14%,transparent); }
.status.unverified { color:var(--ink-2); background:var(--surface-2); }
.status.confirmed { color:var(--ok); background:color-mix(in srgb,var(--ok) 12%,transparent); }
.chevron { color:var(--ink-2); flex:0 0 auto; }

/* Trips and timeline */
.next-card { display:block; width:100%; border-left:4px solid var(--accent-2); text-align:left; }
.next-card .next-time { font-size:1.375rem; font-weight:650; }
.next-card .next-ref { font-family:ui-monospace,monospace; font-weight:700; }
.glance-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,5.5em),1fr)); gap:8px; margin-top:16px; }
.glance-grid span { padding:10px; background:var(--surface-2); border-radius:12px; color:var(--ink-2); font-size:0.8125rem; }
.glance-grid strong { display:block; color:var(--ink); font-size:0.9375rem; margin-top:3px; }
.widget-help { margin:0 4px 12px; }
.trip-card { display:block; width:100%; position:relative; text-align:left; }
.trip-card h3 { font-size:1.0625rem; margin:0 0 4px; }
.trip-card .trip-meta { color:var(--ink-2); font-size:0.9375rem; }
.trip-card .trip-foot { display:flex; justify-content:space-between; border-top:1px solid var(--line); margin-top:14px; padding-top:12px; color:var(--ink-2); font-size:0.8125rem; }
.hero-summary { padding:16px; border-bottom:1px solid var(--line); margin-bottom:12px; }
.hero-summary .big-total { font-size:1.75rem; font-weight:700; margin-top:16px; }
.segment,.theme-segment { display:flex; background:var(--surface-2); border-radius:12px; padding:3px; margin:12px 0; }
.segment button,.theme-segment button { flex:1; min-height:44px; border-radius:10px; background:none; font-size:0.9375rem; }
.segment button.active,.theme-segment button.active { background:var(--surface); color:var(--accent); font-weight:600; box-shadow:var(--elev); }
.theme-segment { align-items:center; gap:2px; margin-bottom:0; }
.theme-label { padding:0 8px; font-size:0.8125rem; color:var(--ink-2); }
.timeline { padding:0; }
.day-label { margin:20px 0 6px; font-size:0.8125rem; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-2); }
.event { display:flex; align-items:center; gap:10px; width:100%; min-height:64px; padding:10px 0; border-bottom:1px solid var(--line); background:none; text-align:left; }
.event .event-icon { color:var(--accent); flex:0 0 auto; }
.event-time { flex:0 0 auto; min-width:46px; text-align:right; font-size:0.9375rem; color:var(--ink-2); }
.event.cancelled .event-title { text-decoration:line-through; color:var(--ink-2); }
.connection-row { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:8px 0; padding:8px 12px; border-left:3px solid var(--accent); color:var(--ink-2); background:var(--surface-2); border-radius:8px; font-size:0.8125rem; }
.connection-pill { border-radius:999px; padding:3px 8px; font-size:0.8125rem; text-transform:capitalize; }
.connection-pill.ok { color:var(--ok); background:color-mix(in srgb,var(--ok) 14%,transparent); }
.connection-pill.tight { color:var(--warn); background:color-mix(in srgb,var(--warn) 14%,transparent); }
.connection-pill.short { color:var(--danger); background:color-mix(in srgb,var(--danger) 14%,transparent); }
.weather-chip { display:inline-flex; align-items:center; gap:4px; margin-left:8px; padding:4px 8px; border-radius:999px; background:var(--surface-2); color:var(--ink-2); font-size:0.8125rem; font-weight:500; letter-spacing:0; text-transform:none; }
.day-label { display:flex; align-items:center; justify-content:space-between; gap:8px; }

/* Forms, spend, review, and documents */
.facts { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,9em),1fr)); gap:12px 16px; margin:16px 0; }
.facts dt { font-size:0.8125rem; color:var(--ink-2); }
.facts dd { margin:0; font-size:1.0625rem; overflow-wrap:anywhere; }
.form-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,9em),1fr)); gap:0 12px; }
.field { margin-bottom:13px; min-width:0; }
.field.wide { grid-column:1/-1; }
.field label { display:block; margin-bottom:5px; font-size:0.8125rem; font-weight:600; color:var(--ink-2); }
.field input,.field select,.field textarea { width:100%; min-width:0; min-height:48px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--ink); font-size:1rem; }
.field input[type=date],.field input[type=datetime-local],.field input[type=time] { -webkit-appearance:none; appearance:none; display:block; max-width:100%; }
input[type=date]::-webkit-date-and-time-value,input[type=datetime-local]::-webkit-date-and-time-value,input[type=time]::-webkit-date-and-time-value { text-align:left; }
.field input:focus-visible,.field select:focus-visible,.field textarea:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.field.low input,.field.low select { border:2px solid var(--warn); }
.check-note { margin-top:3px; font-size:0.8125rem; color:var(--warn); }
.primary,.secondary,.text-button { width:100%; min-height:52px; border-radius:12px; font-weight:600; padding:12px 16px; text-decoration:none; }
.primary { background:var(--accent); color:var(--on-accent); }
.secondary { background:var(--accent-soft); color:var(--accent); }
.text-button { background:none; color:var(--danger); }
.stack { display:grid; gap:8px; }
.review-card { margin-bottom:12px; }
.review-thumb { display:block; width:100%; height:150px; object-fit:cover; border-radius:12px; background:var(--surface-2); margin-bottom:14px; }
.review-thumb img { width:100%; height:150px; object-fit:contain; background:#fff; }
.review-thumb .receipt-row-pdf { width:100%; height:150px; }
.actions-sticky { position:sticky; bottom:0; z-index:2; padding:12px 0 calc(4px + env(safe-area-inset-bottom)); border-top:1px solid var(--line); background:color-mix(in srgb,var(--surface) 96%,transparent); }
.toggle { display:flex; align-items:center; justify-content:space-between; padding:10px 0; }
.switch { position:relative; width:48px; min-height:44px; height:44px; display:inline-flex; align-items:center; padding:0; background:transparent; }
.switch::before { content:""; position:absolute; inset:8px 0; border-radius:999px; background:var(--line); }
.switch.on { background:transparent; }
.switch.on::before { background:var(--ok); }
.switch i { position:relative; z-index:1; display:block; width:22px; height:22px; margin-left:3px; border-radius:50%; background:var(--surface); transition:transform .2s; }
.switch.on i { transform:translateX(20px); }
.sheet .sheet-top button,.sheet a,.viewer-drive,.hero-summary a { min-height:44px; display:inline-flex; align-items:center; }
.receipt-row { display:flex; align-items:center; gap:12px; width:100%; min-height:64px; border-bottom:1px solid var(--line); background:none; text-align:left; }
.receipt-row img { width:52px; height:42px; object-fit:cover; border-radius:8px; background:var(--surface-2); }
.receipt-row-pdf { width:52px; height:42px; border:0; border-radius:8px; background:#fff; pointer-events:none; }
.receipt-pdf-thumb { width:52px; height:42px; display:grid; place-items:center; border-radius:8px; background:var(--surface-2); color:var(--accent); font-size:0.8125rem; font-weight:700; }
.breakdowns { display:grid; gap:16px; margin-top:16px; }
.breakdown-row { padding:7px 0; border-bottom:1px solid var(--line); }
.compact { width:auto; min-height:44px; padding:8px 12px; font-size:0.8125rem; }
.stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,9em),1fr)); gap:8px; margin:16px 0; }
.stats-grid div { padding:10px; background:var(--surface-2); border-radius:12px; }
.stats-grid b,.stats-grid span { display:block; }
.stats-grid b { font-size:1.375rem; font-variant-numeric:tabular-nums; }
.stats-grid span { color:var(--ink-2); font-size:0.8125rem; }
.year-select { min-height:44px; padding:8px 10px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--ink); font-size:1rem; }
.country-list { display:flex; flex-wrap:wrap; gap:8px; }
.country-chip { display:inline-flex; flex-direction:column; gap:2px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface-2); }
.country-chip small,.plan-row small,.place-row small,.loyalty-row small { display:block; color:var(--ink-2); font-size:0.8125rem; }
.plan-row,.place-row,.loyalty-row { display:flex; align-items:center; gap:10px; min-height:56px; padding:8px 0; border-bottom:1px solid var(--line); }
.gap-row { display:grid; grid-template-columns:auto minmax(0,1fr); gap:8px 10px; min-height:64px; padding:12px 0; border-bottom:1px solid var(--line); }
.gap-row { color:var(--ink-2); }
.gap-row .event-main { grid-column:2; display:flex; flex-direction:column; gap:2px; }
.gap-row .event-icon { grid-row:1 / span 2; }
.gap-actions { grid-column:2; display:flex; gap:8px; flex-wrap:wrap; }
.gap-actions button { flex:0 0 auto; }
.placeholder-actions { display:flex; gap:8px; flex-wrap:wrap; padding:0 0 10px 32px; border-bottom:1px dashed var(--line); }
.event[data-detail] { position:relative; }
.event.planned { border:1px dashed var(--accent); padding-left:10px; padding-right:10px; }
.confirm-inline { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:10px; padding-top:10px; border-top:1px solid var(--line); }
.plan-chips { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.plan-chips .chip { min-height:44px; border:1px solid var(--line); background:var(--surface); }
.add-tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,9em),1fr)); gap:8px; margin:16px 0; }
.add-sheet .add-trip-panel, .add-sheet .inline-form { border:0; box-shadow:none; padding:4px 0 0; margin:0; background:transparent; }
.add-sheet { height:auto; max-height:92%; }
.add-tile { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; min-height:76px; }
.add-tile .icon { width:22px; height:22px; }
.event:has(.status:not(.cancelled)) { }
.event .status { flex:0 0 auto; }
.status:not(.cancelled) { color:var(--ink-2); background:var(--surface-2); }
.offline-before-you-go { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.gap-row .primary { width:auto; min-height:44px; padding:8px 12px; }
.doc > .doc-thumb { flex:0 0 52px; width:52px; height:44px; object-fit:cover; border:1px solid var(--line); border-radius:8px; background:var(--surface-2); }
.plan-row:last-child,.place-row:last-child,.loyalty-row:last-child { border-bottom:0; }
.check-box { flex:0 0 44px; width:44px; height:44px; display:grid; place-items:center; border:2px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ok); }
.check-field { display:flex; align-items:center; gap:8px; min-height:44px; font-size:0.9375rem; }
.check-box.done { border-color:var(--ok); background:color-mix(in srgb,var(--ok) 14%,var(--surface)); }
.check-box .icon { width:18px; height:18px; }
.shared-tag { color:var(--ink-2); font-size:0.8125rem; }
.chip { display:inline-block; padding:3px 7px; border-radius:999px; background:var(--accent-soft); color:var(--accent); font-size:0.8125rem; }
.inline-edit-field { display:grid; gap:8px; margin-top:12px; }
.inline-edit-field input { min-height:44px; width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--ink); font-size:1rem; }
.inline-edit-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.inline-form { margin-top:12px; padding-top:12px; border-top:1px solid var(--line); }
.inline-form-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.expiry { color:var(--warn); font-weight:600; }

/* Sheets and full-screen viewer */
.sheet-backdrop { position:fixed; z-index:10; inset:0; background:rgba(0,0,0,.45); }
.sheet { position:absolute; left:0; right:0; bottom:var(--kb); height:92%; max-height:calc(var(--vvh) - 8px); display:flex; flex-direction:column; overflow:auto; overscroll-behavior:contain; padding:10px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); border-radius:24px 24px 0 0; background:var(--surface); animation:up .2s ease; }
.grabber { width:40px; height:44px; margin:0 auto 8px; padding-top:20px; border-radius:9px; background:linear-gradient(var(--line),var(--line)) center 20px / 40px 4px no-repeat; touch-action:none; }
.sheet-top { position:sticky; top:-10px; z-index:2; display:flex; align-items:center; justify-content:space-between; min-height:44px; background:var(--surface); }
.sheet-top button { background:none; color:var(--accent); font-weight:600; }
.sheet h2 { margin:14px 0 4px; font-size:1.375rem; }
.sheet .route { font-size:2.125rem; line-height:1.18; font-weight:700; letter-spacing:-.04em; }
.sheet .route-times { font-size:1.375rem; font-weight:600; }
.sticky-sheet-actions { position:sticky; left:0; right:0; bottom:0; display:flex; gap:8px; margin:16px calc(-1 * max(16px, env(safe-area-inset-right))) 0 calc(-1 * max(16px, env(safe-area-inset-left))); padding:10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); border-top:1px solid var(--line); background:var(--surface); }
.sticky-sheet-actions > * { flex:1; }
/* Bottom padding lives on the body, not the scrolling sheet, so sticky action bars sit flush with the sheet's bottom edge and nothing scrolls underneath them. */
.sheet-body { flex:1 1 auto; padding-bottom:calc(24px + env(safe-area-inset-bottom)); }
.sheet-body:has(> .inline-form .actions-sticky:last-child), .sheet-body:has(.add-trip-panel .inline-form-actions) { padding-bottom:0; }
.sheet-danger { margin-top:24px; padding-top:16px; border-top:1px solid var(--line); }
.sheet-danger .text-button { background:color-mix(in srgb,var(--danger) 10%,transparent); }
.sticky-sheet-actions [data-cancel-booking] { display:none; }
.icon-button-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,5.5em),1fr)); gap:8px; margin:16px 0; }
.icon-button-row > * { display:flex; align-items:center; justify-content:center; gap:5px; min-height:52px; padding:8px; text-align:center; }
.icon-button-row .icon { width:19px; height:19px; }
.viewer { position:fixed; inset:0; z-index:30; display:flex; flex-direction:column; background:#050608; color:#fff; }
.viewer-top { display:flex; justify-content:space-between; padding:calc(12px + env(safe-area-inset-top)) 16px 12px; }
.viewer-done { min-width:44px; min-height:44px; padding:8px 12px; border-radius:8px; background:#fff; color:#111; font-weight:700; }
.viewer-body { flex:1; display:grid; place-items:center; overflow:auto; min-height:0; }
.viewer-body img { max-width:100%; max-height:100%; touch-action:pinch-zoom; object-fit:contain; }
.viewer-body iframe { width:100%; height:100%; border:0; background:#fff; }
.viewer-drive { display:block; width:100%; margin:0; padding:14px 16px calc(14px + env(safe-area-inset-bottom)); background:#171B22; color:#fff; border-top:1px solid #303842; text-align:center; font-weight:700; }
.receipt-preview-button { display:block; width:100%; padding:0; background:var(--surface-2); border-radius:12px; overflow:hidden; }
.receipt-preview { display:block; width:100%; height:150px; border:0; background:#fff; object-fit:contain; }
.receipt-pdf-static { display:grid; place-items:center; gap:6px; color:var(--accent); font-weight:600; }
.copy-ref { padding:16px; border-radius:12px; background:var(--surface-2); font:700 1.75rem ui-monospace,monospace; letter-spacing:.08em; overflow-wrap:anywhere; }
.source-note { display:flex; justify-content:space-between; gap:12px; padding:14px 0; margin-top:16px; border-top:1px solid var(--line); color:var(--ink-2); font-size:0.8125rem; }
.ai-marker { display:inline-flex; align-items:center; gap:4px; color:var(--warn); font-size:0.8125rem; font-weight:600; }
.ai-marker button { display:inline-grid; place-items:center; width:44px; height:44px; border-radius:12px; color:var(--ok); background:color-mix(in srgb,var(--ok) 14%,transparent); }
.ai-marker button .icon { width:22px; height:22px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.live-status { display:grid; gap:5px; padding:12px; margin:12px 0; border-left:3px solid var(--accent); background:var(--accent-soft); border-radius:10px; font-size:0.8125rem; }
.full { display:flex; align-items:center; justify-content:center; }
.trip-actions { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,9em),1fr)); gap:8px; margin:16px 0 8px; }
.budget-input { width:110px; min-height:44px; padding:8px 10px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--ink); font-size:1rem; text-align:right; }
.bar-chart { display:flex; align-items:end; gap:10px; height:150px; padding:20px 4px 0; border-bottom:1px solid var(--line); }
.bar-col { display:flex; align-items:center; flex:1; flex-direction:column; justify-content:end; height:100%; gap:4px; }
.bar { width:100%; max-width:34px; min-height:8px; border-radius:8px 8px 0 0; background:var(--accent); }
.bar-value,.bar-col small { font-size:0.8125rem; color:var(--ink-2); }
.legend { display:flex; gap:12px; margin-top:12px; font-size:0.8125rem; color:var(--ink-2); }
.legend span:before { content:''; display:inline-block; width:9px; height:9px; margin-right:4px; border-radius:50%; background:var(--accent); }
.cat-food:before { background:var(--ok)!important; }.cat-other:before { background:var(--warn)!important; }
.rate-row { display:flex; justify-content:space-between; gap:10px; padding:10px 0; border-bottom:1px solid var(--line); font-size:0.9375rem; }
.warn-text { color:var(--warn); }.ok-text { color:var(--ok); }

/* Utility states */
.toast { position:fixed; z-index:20; bottom:calc(var(--kb) + var(--nav-h) + env(safe-area-inset-bottom) + 12px); left:50%; transform:translateX(-50%); padding:10px 14px; border-radius:999px; background:var(--ink); color:var(--bg); }
.empty { padding:44px 12px; color:var(--ink-2); text-align:center; }
.error-banner { padding:12px; border:1px solid var(--danger); border-radius:12px; color:var(--danger); background:color-mix(in srgb,var(--danger) 10%,transparent); }
.busy { margin:0 16px 12px; padding:8px 12px; color:var(--accent); font-size:0.8125rem; }
.boot { height:100vh; height:100dvh; display:grid; place-items:center; align-content:center; gap:9px; color:var(--ink-2); }
.boot-mark { display:grid; place-items:center; width:64px; height:64px; border-radius:16px; background:var(--accent); color:var(--on-accent); }
.past { margin-top:24px; }
.past summary { font-size:1.0625rem; font-weight:600; cursor:pointer; }
.kit { padding:0 16px; }
.kit summary { padding:16px 0; font-weight:600; cursor:pointer; }
.kit-item { display:flex; align-items:flex-start; gap:10px; padding:12px 0; border-top:1px solid var(--line); }
.kit-item small { display:block; color:var(--ink-2); font-size:.9375rem; margin-top:3px; overflow-wrap:anywhere; }
.kit-actions { display:flex; gap:2px; margin-left:auto; }
.kit-phone { display:inline-flex; align-items:center; gap:4px; margin-top:5px; font-size:.9375rem; }
.kit-warning { display:flex; gap:6px; color:var(--warn); font-size:.9375rem; margin:8px 0 12px; }
.kit-warning .icon { flex:0 0 auto; width:18px; height:18px; }
.danger-link { color:var(--danger) !important; }
@keyframes up { from { transform:translateY(20px); } to { transform:none; } }
@media (prefers-reduced-motion:reduce) { *,*:before,*:after { animation:none!important; transition:none!important; } }
@media (max-width:430px) { .field:has(> input[type=date]),.field:has(> input[type=datetime-local]),.field:has(> input[type=time]) { grid-column:1/-1; } }
@media (min-width:560px) { .content { padding:0; } .topbar { padding-left:0; padding-right:0; } .trip-heading { padding-left:0; padding-right:0; } .offline { margin-left:0; margin-right:0; } }

/* Mobile sheets keep one clear exit and one clear primary action. */
.sheet .inline-form > .headline,
.sheet .add-trip-panel > .row .headline { display:none; }
.sheet .inline-form-actions.actions-sticky,
.sheet .add-trip-panel .inline-form-actions { grid-template-columns:1fr; position:sticky; bottom:0; z-index:3; margin-left:calc(-1 * max(16px, env(safe-area-inset-left))); margin-right:calc(-1 * max(16px, env(safe-area-inset-right))); padding:12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); border-top:1px solid var(--line); background:var(--surface); }
.sheet .inline-form-actions [data-cancel-inline],
.sheet .inline-form-actions [data-cancel-hotel],
.sheet .inline-form-actions [data-cancel-document],
.sheet .inline-form-actions [data-cancel-expense-edit] { display:none; }
.sheet .inline-form { padding-bottom:8px; }

/* Text that carries dates, statuses, and labels remains legible with larger text settings. */
.caption,.quiet,.eyebrow,.day-label,.warning,.field label,.stats-grid span,
.country-chip small,.plan-row small,.place-row small,.loyalty-row small,
.source-note,.ai-marker,.live-status,.bar-value,.bar-col small,.legend,.busy { font-size:0.9375rem; }
.section-head { align-items:start; }
.section-head > div:first-child { min-width:0; }
.section-head .quiet { display:block; margin-top:2px; }
.review-card .actions-sticky { background:var(--surface); }
.doc-thumb { filter:brightness(.9); }
@media (prefers-color-scheme:dark) { .doc-thumb { filter:brightness(.85); } }
[data-theme="dark"] .doc-thumb { filter:brightness(.85); }
/* Text-style buttons (e.g. place Edit / Delete): transparent, accent text, 44pt target. */
button.link {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 12px;
}
button.link:active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
button.link[data-delete-place] { color: var(--danger, #E5484D); }
  .upload-success-preview {
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
    margin: 12px 0;
  }
  .upload-success-preview img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    flex: none;
  }
  .upload-success-preview .quiet {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .event-main .planned-pill { align-self:flex-start; margin-top:4px; }
  [hidden] { display:none !important; }
.form-error {
  margin: 8px 0 0;
  color: #b42318;
  font-size: 14px;
  font-weight: 600;
}
/* Round 8: in-app discard dialog, large-text viewer, New trip bottom Cancel, trip delete. */
.discard-dialog { position:fixed; inset:0; z-index:40; display:grid; place-items:center; padding:24px; background:rgba(0,0,0,.5); }
.discard-card { width:min(360px,100%); padding:20px; border-radius:16px; background:var(--surface); color:var(--ink); box-shadow:0 12px 40px rgba(0,0,0,.3); }
.discard-card p { margin:0 0 16px; font-size:1.0625rem; font-weight:600; }
.discard-card .muted { font-weight:400; color:var(--ink-2); font-size:0.9375rem; margin-top:-8px; }
.discard-actions { display:grid; gap:10px; }
.danger-fill { background:var(--danger) !important; color:var(--on-accent) !important; }
.viewer-text { padding:24px; }
.viewer-ref { max-width:100%; font:700 clamp(2.2rem,11vw,4.5rem)/1.15 ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing:.06em; text-align:center; word-break:break-word; user-select:all; }
.sheet .inline-form-actions [data-cancel-new-trip] { display:block; background:var(--surface-2); color:var(--ink); }
.sheet .inline-form-actions:has([data-cancel-new-trip]) { grid-template-columns:1fr 1fr; }
.trip-title-edit { display:inline-flex; align-items:center; gap:6px; min-height:44px; padding:0; background:none; color:inherit; font:inherit; text-align:left; }
.trip-title-edit .pencil { font-size:0.8em; color:var(--ink-2); }
.trip-menu .danger-link { margin-top:4px; }
.delete-trip-row { margin-top:16px; padding-top:12px; border-top:1px solid var(--line); }
/* Row ⋯ menus (HIG fix list, section A) */
.row-with-more { display:flex; align-items:center; gap:4px; border-bottom:1px solid var(--line); }
.row-with-more > :first-child { flex:1; min-width:0; }
.row-with-more > .event, .row-with-more > .receipt-row { border-bottom:0; }
.row-with-more.over { position:relative; display:block; border-bottom:0; }
.row-with-more.over > :first-child { padding-right:52px; }
.row-with-more.over > .row-more { position:absolute; top:6px; right:6px; }
.row-more { flex:0 0 44px; width:44px; height:44px; display:grid; place-items:center; padding:0; border:0; border-radius:50%; background:transparent; color:var(--ink-2); }
.row-more:hover, .row-more[aria-expanded="true"] { background:var(--surface-2); color:var(--ink); }
.row-more svg { width:22px; height:22px; }
.row-chosen > :first-child { outline:2px solid var(--accent); outline-offset:-2px; border-radius:12px; }
.row-menu { position:fixed; z-index:60; padding:6px; background:var(--surface); border:1px solid var(--line); border-radius:14px; box-shadow:0 10px 30px rgba(0,0,0,.22); animation:menu-in .12s ease-out; transform-origin:top right; }
.row-menu.upward { transform-origin:bottom right; }
.row-menu-item { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; min-height:48px; padding:0 12px; border:0; border-radius:10px; background:none; color:var(--ink); font-size:1rem; text-align:left; }
.row-menu-item > span { flex:1; }
.row-menu-item svg { width:20px; height:20px; color:var(--ink-2); }
.row-menu-item:hover, .row-menu-item:focus-visible { background:var(--surface-2); }
.row-menu-item.danger, .row-menu-item.danger svg { color:var(--danger); }
.row-menu-divider { height:1px; margin:4px 6px; background:var(--line); }
.archived-row { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.archived-row .row-actions { display:flex; align-items:center; gap:4px; }
@keyframes menu-in { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:none; } }
@media (prefers-reduced-motion: reduce) { .row-menu { animation:none; } }
/* Loading and failed states (one pattern for every screen). */
.skeleton { display:grid; gap:12px; padding:16px 0; }
.skeleton span { display:block; height:72px; border-radius:16px; background:var(--line); opacity:.6; }
.skeleton span:first-child { height:120px; }
@media (prefers-reduced-motion: no-preference) { .skeleton span { animation:skeleton-pulse 1.4s ease-in-out infinite; } }
@keyframes skeleton-pulse { 50% { opacity:.3; } }
.load-failed { display:grid; justify-items:center; gap:8px; padding:44px 16px; text-align:center; }
.load-failed .subhead { margin:0 0 8px; }
.empty .headline { color:var(--ink); }
.empty .subhead { margin:6px 0 14px; }

/* Trip hero: spend line and compact action chips */
.hero-summary .hero-spend { margin-top:12px; display:flex; align-items:baseline; gap:6px; flex-wrap:wrap; }
.hero-summary .hero-spend .big-total { margin-top:0; }
.hero-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.chip-btn { display:inline-flex; align-items:center; gap:6px; min-height:44px; padding:0 14px; border-radius:22px; border:1px solid var(--line); background:var(--surface); color:var(--ink); font:inherit; font-size:.9375rem; text-decoration:none; cursor:pointer; }
.chip-btn svg { width:18px; height:18px; flex:none; }
.chip-btn.done { color:var(--accent); border-color:var(--accent); }
.field-error { color:var(--danger, #B42318); font-size:.875rem; margin:4px 0 0; }
[aria-invalid="true"] { border-color:var(--danger, #B42318) !important; }
.viewer-body { position:relative; }
.viewer-status { position:absolute; inset:auto 16px; text-align:center; color:#A9B2C0; margin:0; }
.viewer-status.failed { color:#fff; }
