@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+TC:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #173f35;
  --ink-2: #27584b;
  --mint: #65aa91;
  --mint-soft: #dcebe3;
  --paper: #f5f2ea;
  --card: #fffefa;
  --line: #e2ded3;
  --muted: #6e766f;
  --orange: #f2a35c;
  --orange-soft: #fbe7d1;
  --red: #d86c5c;
  --blue: #6b98a5;
  --shadow: 0 18px 45px rgba(28, 55, 46, .08);
  --shadow-sm: 0 8px 24px rgba(28, 55, 46, .08);
  --radius-lg: 26px;
  --radius: 18px;
  --sidebar: 228px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", "Noto Sans TC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

button { color: inherit; }

button, select { cursor: pointer; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden { display: none !important; }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar);
  padding: 30px 20px 26px;
  color: #f8f5ed;
  background:
    radial-gradient(circle at 20% 75%, rgba(101, 170, 145, .18), transparent 34%),
    linear-gradient(160deg, #143b31 0%, #0f3028 100%);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 7px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.brand-mark {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  color: var(--orange);
}

.brand-mark svg { width: 100%; stroke: none; fill: currentColor; }
.brand-mark .brand-mark-cut { fill: #f8f5ed; }
.brand strong { display: block; font-size: 20px; letter-spacing: .15em; }
.brand small { display: block; margin-top: 1px; color: #aabdb5; font-size: 9px; letter-spacing: .3em; }

.side-nav { display: grid; gap: 8px; margin-top: 52px; }

.nav-item {
  position: relative;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  color: #adbbb6;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  transition: .2s ease;
}

.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #173f35; background: #f8f5ed; font-weight: 700; box-shadow: 0 10px 24px rgba(0,0,0,.12); }
.nav-item.active::before { content: ""; position: absolute; left: -20px; width: 4px; height: 24px; border-radius: 0 8px 8px 0; background: var(--orange); }

.sidebar-foot { margin-top: auto; padding: 0 7px; color: #8eaaa0; font-size: 12px; line-height: 1.8; }
.offline-pill { width: max-content; margin-bottom: 18px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.12); border-radius: 99px; color: #bdd0c8; font-size: 10px; }
.offline-pill span { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #86d39b; box-shadow: 0 0 0 3px rgba(134,211,155,.12); }
.offline-pill.is-offline span { background: var(--orange); }

.main-column { min-width: 0; min-height: 100vh; margin-left: var(--sidebar); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 92px;
  padding: 0 clamp(24px, 4vw, 58px);
  border-bottom: 1px solid rgba(209, 203, 191, .7);
  background: rgba(245, 242, 234, .88);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-brand { display: none; }
.trip-switcher-wrap { display: flex; align-items: center; gap: 14px; }
.trip-switcher-wrap > .eyebrow { margin: 0; }
.trip-switch-row { display: flex; align-items: center; gap: 8px; }
.trip-switch-row select {
  max-width: 270px;
  padding: 9px 30px 9px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--card);
  font-weight: 700;
  outline: none;
}

.eyebrow { display: block; margin-bottom: 8px; color: var(--mint); font-size: 10px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn, .install-btn, .cloud-status-btn {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .2s ease;
}

.icon-btn:hover, .install-btn:hover, .cloud-status-btn:hover { transform: translateY(-1px); border-color: #b9c8c1; box-shadow: var(--shadow-sm); }
.icon-btn svg, .install-btn svg, .cloud-status-btn svg { width: 18px; height: 18px; }
.icon-btn.compact { width: 34px; min-width: 34px; height: 34px; padding: 0; }
.install-btn { padding: 0 16px; color: #fff; border-color: var(--ink); background: var(--ink); font-size: 13px; font-weight: 700; }
.cloud-status-btn { position: relative; min-width: 42px; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--card); display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; font-weight: 700; transition: .2s ease; }
.cloud-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #9da6a1; box-shadow: 0 0 0 3px rgba(157,166,161,.13); }
.cloud-status-btn[data-status="synced"] .cloud-status-dot { background: #65aa91; box-shadow: 0 0 0 3px rgba(101,170,145,.15); }
.cloud-status-btn[data-status="syncing"] .cloud-status-dot { background: var(--orange); animation: cloud-pulse 1s infinite alternate; }
.cloud-status-btn[data-status="queued"] .cloud-status-dot, .cloud-status-btn[data-status="setup"] .cloud-status-dot { background: #d89955; }
.cloud-status-btn[data-status="error"] .cloud-status-dot { background: var(--red); }
@keyframes cloud-pulse { to { opacity: .35; transform: scale(.75); } }

main { min-width: 0; padding: clamp(28px, 4vw, 54px) clamp(20px, 4vw, 58px) 70px; }
.view { min-width: 0; display: none; animation: view-in .35s ease both; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

.page-heading { margin-bottom: 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-heading h1 { margin: 0; font-family: "Noto Sans TC", sans-serif; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.04em; }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.primary-btn, .secondary-btn, .text-btn, .danger-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  transition: .2s ease;
}

.primary-btn { border: 1px solid var(--ink); color: white; background: var(--ink); box-shadow: 0 10px 20px rgba(23,63,53,.13); }
.primary-btn:hover { transform: translateY(-2px); background: var(--ink-2); }
.primary-btn svg, .secondary-btn svg, .text-btn svg { width: 17px; height: 17px; }
.secondary-btn { border: 1px solid var(--line); color: var(--ink); background: var(--card); }
.secondary-btn:hover { border-color: #b9c8c1; background: #fff; }
.text-btn { min-height: 36px; padding: 0 10px; border: 0; color: var(--ink-2); background: transparent; }
.danger-btn { border: 1px solid #efd3ce; color: #ae4539; background: #fff5f3; }

/* Home */
.hero-card {
  position: relative;
  min-height: 280px;
  padding: clamp(28px, 5vw, 60px);
  border-radius: 30px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(100deg, rgba(15,48,40,.96) 2%, rgba(19,61,50,.88) 52%, rgba(19,61,50,.18) 100%),
    var(--hero-image, url('https://images.unsplash.com/photo-1493976040374-85c8e12f0c0e?auto=format&fit=crop&w=1600&q=80')) center/cover;
  box-shadow: var(--shadow);
}

.hero-card::after { content: ""; position: absolute; inset: auto -4% -55% auto; width: 360px; height: 360px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 50px rgba(255,255,255,.04), 0 0 0 100px rgba(255,255,255,.03); }
.hero-content { position: relative; z-index: 2; max-width: 590px; }
.hero-kicker { margin: 0 0 12px; color: #9fd0bd; font-size: 11px; font-weight: 800; letter-spacing: .22em; }
.hero-card h1 { margin: 0; font-family: "Noto Sans TC", sans-serif; font-size: clamp(31px, 4.6vw, 54px); letter-spacing: -.05em; line-height: 1.2; }
.hero-card h1 span { color: #f6bd84; }
.hero-card p { max-width: 500px; margin: 16px 0 23px; color: #ccddd6; font-size: 14px; line-height: 1.8; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 12px 22px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; color: #eff7f3; font-size: 12px; }
.hero-meta svg { width: 16px; height: 16px; color: #f6bd84; }
.hero-actions { margin-top: 24px; display: flex; gap: 10px; }
.hero-actions .primary-btn { color: var(--ink); border-color: #fff; background: #fff; box-shadow: none; }
.hero-actions .hero-ghost { min-height: 44px; padding: 0 16px; border: 1px solid rgba(255,255,255,.27); border-radius: 13px; color: #fff; background: rgba(255,255,255,.08); font-size: 13px; font-weight: 700; }
.countdown-badge { position: absolute; z-index: 2; top: 26px; right: 28px; min-width: 86px; padding: 13px; border: 1px solid rgba(255,255,255,.2); border-radius: 16px; background: rgba(12,43,35,.52); backdrop-filter: blur(12px); text-align: center; }
.countdown-badge strong { display: block; font-size: 24px; }
.countdown-badge small { color: #bcd3ca; font-size: 10px; letter-spacing: .1em; }

.stats-row { margin-top: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { min-height: 112px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px; color: var(--ink-2); background: var(--mint-soft); display: grid; place-items: center; }
.stat-icon.orange { color: #b86f31; background: var(--orange-soft); }
.stat-icon.blue { color: #417887; background: #deebef; }
.stat-icon.red { color: #a85046; background: #f5e0dc; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-copy strong { display: block; font-size: 22px; letter-spacing: -.03em; }
.stat-copy span { color: var(--muted); font-size: 11px; }

.dashboard-grid { min-width: 0; margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 18px; }
.stack { min-width: 0; display: grid; gap: 18px; align-content: start; }
.content-card { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: 0 8px 28px rgba(39,63,54,.035); }
.card-head { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { margin: 0; font-size: 17px; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.card-head .text-btn { font-size: 11px; }

.mini-timeline { position: relative; display: grid; gap: 4px; }
.mini-event { display: grid; grid-template-columns: 58px 1px 1fr auto; gap: 14px; align-items: center; min-height: 62px; }
.mini-event time { color: var(--muted); font-size: 11px; }
.mini-event-line { align-self: stretch; width: 1px; background: var(--line); position: relative; }
.mini-event-line::before { content: ""; position: absolute; top: 26px; left: -4px; width: 9px; height: 9px; border: 2px solid var(--card); border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 1px var(--mint); }
.mini-event-copy strong { display: block; font-size: 13px; }
.mini-event-copy span { color: var(--muted); font-size: 11px; }
.type-chip { padding: 5px 8px; border-radius: 99px; color: var(--ink-2); background: var(--mint-soft); font-size: 9px; font-weight: 700; }

.place-strip { min-width: 0; max-width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.place-thumb { position: relative; aspect-ratio: 1 / .78; min-width: 0; overflow: hidden; border-radius: 16px; background: #d9e5df; cursor: pointer; }
.place-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.place-thumb:hover img { transform: scale(1.04); }
.place-thumb::after { content: ""; position: absolute; inset: 38% 0 0; background: linear-gradient(transparent, rgba(8,32,26,.78)); }
.place-thumb figcaption { position: absolute; z-index: 2; inset: auto 12px 11px; color: white; }
.place-thumb strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.place-thumb span { color: #d8e5e0; font-size: 9px; }

.check-list { display: grid; gap: 6px; }
.check-row { min-height: 40px; padding: 6px 4px; border-bottom: 1px dashed #e5e1d8; display: flex; align-items: center; gap: 10px; }
.check-row:last-child { border: 0; }
.check-row input { width: 17px; height: 17px; accent-color: var(--mint); }
.check-row label { flex: 1; font-size: 12px; }
.check-row.done label { color: #a2a49f; text-decoration: line-through; }
.progress-track { height: 7px; margin-top: 16px; border-radius: 99px; overflow: hidden; background: #e9e6dd; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), #83c4aa); }
.progress-label { margin-top: 7px; color: var(--muted); display: flex; justify-content: space-between; font-size: 10px; }

.recent-expense-list { display: grid; gap: 12px; }
.recent-expense { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; }
.expense-dot { width: 36px; height: 36px; border-radius: 11px; background: var(--orange-soft); display: grid; place-items: center; font-size: 16px; }
.recent-expense strong { display: block; font-size: 12px; }
.recent-expense small { color: var(--muted); font-size: 10px; }
.recent-expense b { font-size: 12px; }

/* Map */
.map-workspace { height: calc(100vh - 234px); min-height: 540px; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; }
.map-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #dce7e2; box-shadow: var(--shadow-sm); }
#travelMap { width: 100%; height: 100%; z-index: 1; }
.map-overlay-tip { position: absolute; z-index: 4; left: 16px; bottom: 16px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.6); border-radius: 10px; color: #fff; background: rgba(18,54,45,.76); backdrop-filter: blur(8px); font-size: 10px; pointer-events: none; }
.map-overlay-tip span { margin-right: 4px; }
.places-panel { padding: 22px 16px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--card); display: flex; flex-direction: column; }
.panel-title-row { padding: 0 7px 14px; display: flex; align-items: center; justify-content: space-between; }
.panel-title-row .eyebrow { margin-bottom: 4px; }
.panel-title-row h2 { margin: 0; font-size: 17px; }
.count-badge { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px; color: var(--ink-2); background: var(--mint-soft); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.place-list { flex: 1; min-height: 0; padding: 0 6px; overflow-y: auto; display: grid; gap: 10px; align-content: start; scrollbar-width: thin; }
.place-item { width: 100%; padding: 9px; border: 1px solid transparent; border-radius: 15px; background: transparent; display: grid; grid-template-columns: 66px 1fr auto; gap: 11px; align-items: center; text-align: left; transition: .2s; }
.place-item:hover, .place-item.active { border-color: #d9e3de; background: #f4f7f4; }
.place-item img { width: 66px; height: 58px; border-radius: 11px; object-fit: cover; background: var(--mint-soft); }
.place-item strong { display: block; margin-bottom: 3px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.place-item small { color: var(--muted); font-size: 9px; }
.place-item .pin-icon { width: 23px; height: 23px; color: var(--mint); }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow-sm) !important; }
.leaflet-control-zoom a { width: 36px !important; height: 36px !important; line-height: 36px !important; color: var(--ink) !important; border-color: var(--line) !important; }
.travel-marker { width: 36px; height: 36px; border: 4px solid white; border-radius: 50% 50% 50% 8px; color: white; background: var(--ink); box-shadow: 0 5px 12px rgba(19,61,50,.28); display: grid; place-items: center; transform: rotate(-45deg); }
.travel-marker span { transform: rotate(45deg); font-size: 13px; }
.leaflet-popup-content-wrapper { border-radius: 17px !important; box-shadow: var(--shadow) !important; }
.leaflet-popup-content { width: 210px !important; margin: 11px !important; }
.map-popup img { width: 100%; height: 118px; border-radius: 11px; object-fit: cover; background: var(--mint-soft); }
.popup-photo { width: 100%; padding: 0; border: 0; background: transparent; }
.map-popup h3 { margin: 9px 0 3px; font-size: 14px; }
.map-popup p { margin: 0 0 7px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.map-popup small { color: var(--mint); font-size: 9px; }
.popup-actions { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); display: flex; gap: 6px; }
.popup-actions button { min-height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: #faf9f5; font-size: 9px; }
.popup-actions button:last-child { color: var(--red); }

/* Expenses */
.money-hero { padding: 28px 30px; border-radius: var(--radius-lg); color: #fff; background: linear-gradient(135deg, #173f35, #296251); display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center; box-shadow: var(--shadow); }
.total-label { color: #b8d2c8; font-size: 11px; letter-spacing: .08em; }
.money-total { margin: 7px 0 11px; font-size: clamp(32px, 4vw, 48px); font-weight: 700; letter-spacing: -.04em; }
.money-sub { color: #b8d2c8; font-size: 11px; }
.payer-bars { display: grid; gap: 12px; }
.payer-row { display: grid; grid-template-columns: 62px 1fr auto; gap: 10px; align-items: center; font-size: 10px; }
.payer-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payer-track { height: 6px; border-radius: 99px; background: rgba(255,255,255,.12); }
.payer-track span { display: block; height: 100%; border-radius: inherit; background: #f5bd83; }
.payer-row b { font-size: 10px; }
.expense-grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .7fr); gap: 18px; }
.category-bars { display: grid; gap: 15px; }
.category-row { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; }
.category-name { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.category-name span { width: 27px; height: 27px; border-radius: 9px; background: var(--orange-soft); display: grid; place-items: center; }
.category-track { height: 8px; border-radius: 99px; background: #eeebe3; overflow: hidden; }
.category-track span { display: block; height: 100%; border-radius: inherit; background: var(--mint); }
.category-row:nth-child(2n) .category-track span { background: var(--orange); }
.category-row b { min-width: 68px; text-align: right; font-size: 10px; }
.settlement-list { display: grid; gap: 9px; }
.settlement-item { padding: 13px; border-radius: 13px; background: #f4f6f2; font-size: 11px; line-height: 1.55; }
.settlement-item strong { color: #bc673e; }
.settlement-clear { padding: 18px; border: 1px dashed #bcd7cc; border-radius: 14px; color: var(--ink-2); background: #eff8f3; text-align: center; font-size: 11px; }

.expense-ledger { margin-top: 18px; }
.ledger-table { width: 100%; border-collapse: collapse; }
.ledger-table th { padding: 0 12px 12px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-align: left; }
.ledger-table td { padding: 14px 12px; border-top: 1px solid #ebe7df; font-size: 11px; }
.ledger-title { display: flex; align-items: center; gap: 10px; }
.ledger-title span { width: 34px; height: 34px; border-radius: 10px; background: var(--orange-soft); display: grid; place-items: center; font-size: 15px; }
.ledger-title strong { display: block; font-size: 12px; }
.ledger-title small { color: var(--muted); font-size: 9px; }
.money-cell { font-weight: 700; }
.row-actions { display: flex; justify-content: flex-end; gap: 3px; opacity: .55; }
.row-actions button { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 9px; color: var(--muted); background: transparent; display: grid; place-items: center; }
.row-actions button:hover { color: var(--red); background: #fff0ed; }
.row-actions svg { width: 15px; height: 15px; }

/* Planner */
.date-scroller { margin-bottom: 14px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; background: var(--card); display: flex; gap: 3px; scrollbar-width: none; }
.date-chip { min-width: 53px; padding: 5px 7px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; text-align: center; line-height: 1.05; }
.date-chip strong { display: block; margin: 2px 0; color: var(--ink); font-size: 14px; line-height: 1; }
.date-chip span { font-size: 7px; line-height: 1; }
.date-chip.active { color: #c6dbd3; background: var(--ink); }
.date-chip.active strong { color: white; }
.planner-layout { display: grid; grid-template-columns: minmax(0, 1fr) 295px; gap: 18px; }
.day-panel { min-height: 480px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
.day-heading { padding-bottom: 16px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; }
.day-heading h2 { margin: 0 0 5px; font-size: 18px; }
.day-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.timeline { margin-top: 16px; }
.timeline-event { position: relative; display: grid; grid-template-columns: 55px 20px minmax(0, 1fr) auto; gap: 9px; min-height: 72px; }
.event-time { padding-top: 11px; color: var(--ink-2); font-size: 10px; font-weight: 700; }
.timeline-rail { position: relative; display: flex; justify-content: center; }
.timeline-rail::before { content: ""; position: absolute; inset: 23px auto 0; width: 1px; background: #d9e1dd; }
.timeline-event.is-last .timeline-rail::before { display: none; }
.timeline-dot { position: relative; z-index: 2; width: 10px; height: 10px; margin-top: 14px; border: 3px solid var(--card); border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 1px var(--mint); }
.event-card { margin-bottom: 8px; padding: 10px 12px; border: 1px solid #e7e4db; border-radius: 12px; background: #fdfcf8; }
.event-card strong { display: block; font-size: 12px; }
.event-card .event-location { margin-top: 4px; color: var(--muted); display: flex; align-items: center; gap: 4px; font-size: 10px; }
.event-card .event-location svg { width: 12px; min-width: 12px; height: 12px; }
.event-card .event-note { margin: 8px 0 0; color: #5d6761; font-size: 10px; line-height: 1.6; }
.event-actions { padding-top: 5px; }
.event-actions button { width: 27px; height: 27px; padding: 0; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.event-actions button:hover { color: var(--red); background: #fff0ed; }
.event-actions svg { width: 14px; }
.transport-link-row { min-height: 48px; display: grid; grid-template-columns: 55px 20px minmax(0, 1fr); gap: 9px; }
.transport-rail { position: relative; display: flex; justify-content: center; }
.transport-rail::before { content: ""; position: absolute; inset: 0 auto; width: 1px; background: #d9e1dd; }
.transport-rail > span { position: relative; z-index: 2; width: 22px; height: 22px; margin-top: 8px; border: 2px solid var(--card); border-radius: 50%; color: var(--ink-2); background: var(--mint-soft); display: grid; place-items: center; font-size: 10px; }
.transport-rail svg { width: 12px; height: 12px; }
.transport-add { width: max-content; height: 30px; margin: 4px 0 8px; padding: 0 10px; border: 1px dashed #afc9be; border-radius: 9px; color: var(--ink-2); background: #f5faf7; display: flex; align-items: center; gap: 5px; font-size: 9px; font-weight: 700; }
.transport-add:hover { border-style: solid; background: var(--mint-soft); }
.transport-add svg { width: 12px; height: 12px; }
.transport-stack { min-width: 0; }
.transport-add.next-segment { width: 100%; margin-top: 0; justify-content: center; }
.transport-card { min-width: 0; margin: 1px 0 9px; padding: 7px 7px 7px 10px; border: 1px solid #d8e5df; border-radius: 11px; background: #f3f8f5; display: flex; align-items: center; gap: 7px; }
.transport-main { min-width: 0; flex: 1; padding: 0; border: 0; color: var(--ink); background: transparent; text-align: left; }
.transport-main strong, .transport-main small { display: block; overflow-wrap: anywhere; }
.transport-main strong { margin-top: 3px; font-size: 10px; }
.transport-main small { margin-top: 2px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.transport-card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.transport-segment { width: max-content; padding: 2px 6px; border-radius: 99px; color: #8b5b30; background: var(--orange-soft); font-size: 8px; font-weight: 800; }
.transport-label { width: max-content; padding: 2px 6px; border-radius: 99px; color: var(--ink-2); background: #dceee6; font-size: 8px; font-weight: 800; }
.transport-actions { flex: 0 0 auto; display: flex; }
.transport-actions button { width: 25px; height: 25px; padding: 0; border: 0; border-radius: 7px; color: var(--muted); background: transparent; display: grid; place-items: center; }
.transport-actions button:hover { color: var(--red); background: #fff0ed; }
.transport-actions svg { width: 12px; height: 12px; }
.day-summary { padding: 22px; border-radius: var(--radius-lg); color: white; background: var(--ink); }
.day-summary h3 { margin: 0 0 17px; font-size: 15px; }
.summary-map { height: 145px; margin-bottom: 17px; border-radius: 14px; overflow: hidden; background: linear-gradient(135deg, #82ab9d, #d7c7a8); position: relative; }
.summary-map::before, .summary-map::after { content: ""; position: absolute; width: 180%; height: 20px; border: 2px solid rgba(255,255,255,.65); border-width: 2px 0; transform: rotate(-28deg); top: 45px; left: -50%; }
.summary-map::after { transform: rotate(24deg); top: 86px; }
.route-pin { position: absolute; z-index: 2; width: 26px; height: 26px; border: 3px solid white; border-radius: 50% 50% 50% 5px; background: var(--orange); transform: rotate(-45deg); }
.route-pin.one { left: 28%; top: 25%; }
.route-pin.two { right: 23%; bottom: 20%; background: var(--ink); }
.day-facts { display: grid; gap: 12px; }
.day-fact { display: flex; align-items: center; justify-content: space-between; color: #bcd3ca; font-size: 10px; }
.day-fact b { color: white; }
.planner-tip { margin-top: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; color: var(--muted); background: var(--card); font-size: 10px; line-height: 1.65; }

/* More */
.tools-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tool-card { padding: 25px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
.tool-card.wide { grid-column: 1 / -1; }
.tool-title { margin-bottom: 18px; display: flex; align-items: center; gap: 12px; }
.tool-title-icon { width: 41px; height: 41px; border-radius: 13px; color: var(--ink-2); background: var(--mint-soft); display: grid; place-items: center; }
.tool-title-icon.orange { color: #b36d34; background: var(--orange-soft); }
.tool-title-icon svg { width: 20px; height: 20px; }
.tool-title h2 { margin: 0; font-size: 16px; }
.tool-title p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.member-add { margin-bottom: 16px; display: flex; gap: 9px; }
.member-add input { flex: 1; min-width: 0; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; outline: none; }
.member-add input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(101,170,145,.12); }
.member-add .primary-btn svg { width: 17px; height: 17px; }
.member-list { display: flex; flex-wrap: wrap; gap: 9px; }
.member-chip { min-height: 48px; padding: 6px 7px 6px 8px; border: 1px solid #dce4df; border-radius: 14px; background: #f7faf7; display: flex; align-items: center; gap: 8px; }
.member-avatar { width: 32px; height: 32px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--mint), var(--ink)); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.member-chip strong { min-width: 45px; font-size: 11px; }
.member-chip button { width: 29px; height: 29px; padding: 0; border: 0; border-radius: 8px; color: var(--muted); background: transparent; display: grid; place-items: center; }
.member-chip button:hover { color: var(--ink); background: #e7f0eb; }
.member-chip button:last-child:hover { color: var(--red); background: #fff0ed; }
.member-chip svg { width: 14px; height: 14px; }
.member-empty { width: 100%; padding: 17px; border: 1px dashed #c7d8d0; border-radius: 13px; color: var(--muted); background: #fafbf8; font-size: 10px; line-height: 1.6; text-align: center; }
.packing-add { margin-bottom: 12px; display: flex; gap: 8px; }
.packing-add input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; outline: none; }
.packing-add button { width: 40px; border: 0; border-radius: 11px; color: white; background: var(--ink); }
.note-pad { width: 100%; min-height: 165px; padding: 16px; border: 1px solid #e6dfcf; border-radius: 14px; color: #4b5c54; background: repeating-linear-gradient(#fffcf2 0 31px, #e8e1d1 32px); line-height: 32px; resize: vertical; outline: none; }
.data-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.data-action { min-height: 105px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #faf9f5; text-align: left; }
.data-action:hover { border-color: #b9c8c1; background: #fff; }
.data-action svg { width: 20px; height: 20px; margin-bottom: 13px; color: var(--mint); }
.data-action strong { display: block; font-size: 11px; }
.data-action span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.trip-list { display: grid; gap: 10px; }
.trip-row { padding: 12px; border: 1px solid var(--line); border-radius: 14px; display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; }
.trip-row.active { border-color: #a8cbbd; background: #f1f8f4; }
.trip-cover { width: 42px; height: 42px; border-radius: 12px; color: white; background: linear-gradient(135deg, var(--mint), var(--ink)); display: grid; place-items: center; }
.trip-cover svg { width: 19px; }
.trip-row strong { display: block; font-size: 12px; }
.trip-row small { color: var(--muted); font-size: 9px; }
.trip-row-actions { display: flex; gap: 4px; }
.trip-row-actions button { min-height: 31px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: 9px; }

/* States */
.empty-state { min-height: 180px; padding: 25px; border: 1px dashed #cfd9d3; border-radius: 16px; color: var(--muted); background: #fafbf8; display: grid; place-items: center; text-align: center; }
.empty-state.compact { min-height: 105px; }
.empty-state-icon { width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 15px; background: var(--mint-soft); display: grid; place-items: center; font-size: 21px; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 13px; }
.empty-state p { margin: 0 0 14px; font-size: 10px; }

/* Dialogs and forms */
.app-dialog { width: min(94vw, 560px); max-height: min(88vh, 760px); padding: 0; border: 0; border-radius: 24px; overflow: hidden; color: var(--ink); background: var(--card); box-shadow: 0 30px 90px rgba(8,35,28,.32); }
.app-dialog::backdrop { background: rgba(9,35,28,.5); backdrop-filter: blur(5px); }
.dialog-shell { max-height: inherit; display: flex; flex-direction: column; }
.dialog-head { min-height: 75px; padding: 18px 21px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.dialog-head h2 { margin: 0; font-size: 19px; }
.dialog-head p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.dialog-close { width: 38px; min-width: 38px; height: 38px; padding: 0; }
.dialog-body { min-height: 0; padding: 22px; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.form-field { display: grid; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label, .form-label { color: #52655c; font-size: 10px; font-weight: 700; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #dcd9d0;
  border-radius: 11px;
  color: var(--ink);
  background: white;
  outline: none;
  transition: .2s;
}
.form-field textarea { height: 84px; padding: 11px 12px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(101,170,145,.12); }
.field-hint { color: var(--muted); font-size: 9px; line-height: 1.45; }
.input-action { display: flex; gap: 7px; }
.input-action input { flex: 1; }
.input-action button { flex: 0 0 auto; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; background: #f7f8f4; font-size: 10px; }
.photo-drop { position: relative; min-height: 106px; border: 1px dashed #a9c7bb; border-radius: 14px; color: var(--muted); background: #f4f9f6; display: grid; place-items: center; text-align: center; }
.photo-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.photo-drop svg { width: 24px; height: 24px; margin-bottom: 7px; color: var(--mint); }
.photo-drop strong { display: block; color: var(--ink); font-size: 11px; }
.photo-drop span { font-size: 9px; }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.person-check { position: relative; }
.person-check input { position: absolute; opacity: 0; }
.person-check span { min-height: 31px; padding: 0 10px; border: 1px solid var(--line); border-radius: 99px; background: white; display: flex; align-items: center; font-size: 9px; }
.person-check input:checked + span { color: var(--ink-2); border-color: #9fc6b6; background: var(--mint-soft); font-weight: 700; }
.route-endpoints { grid-column: 1 / -1; padding: 11px 13px; border: 1px solid #d8e5df; border-radius: 12px; background: #f3f8f5; display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.route-endpoints > span:last-child { text-align: right; }
.route-endpoints small, .route-endpoints strong { display: block; }
.route-endpoints small { margin-bottom: 2px; color: var(--muted); font-size: 8px; }
.route-endpoints strong { font-size: 10px; overflow-wrap: anywhere; }
.route-endpoints b { color: var(--mint); }
.transport-fields { grid-column: 1 / -1; padding: 13px; border: 1px solid #e5e1d7; border-radius: 13px; background: #fbfaf6; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-actions { grid-column: 1 / -1; margin-top: 5px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-choice { min-height: 108px; padding: 13px 8px; border: 1px solid var(--line); border-radius: 15px; background: #fbfaf6; display: grid; place-items: center; align-content: center; gap: 9px; font-size: 11px; font-weight: 700; }
.quick-choice:hover { border-color: #abc9bc; background: #f2f8f4; }
.quick-choice span { width: 39px; height: 39px; border-radius: 12px; background: var(--mint-soft); display: grid; place-items: center; }
.quick-choice svg { width: 19px; height: 19px; }
.data-menu { display: grid; gap: 9px; }
.data-menu button { min-height: 55px; padding: 0 15px; border: 1px solid var(--line); border-radius: 13px; background: #fbfaf6; display: flex; align-items: center; gap: 12px; text-align: left; }
.data-menu button:hover { border-color: #b6cec4; background: #f4f8f5; }
.data-menu svg { width: 19px; height: 19px; color: var(--mint); }
.data-menu strong { display: block; font-size: 11px; }
.data-menu small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.cloud-notice { padding: 18px; border: 1px solid #d7e5de; border-radius: 16px; background: #f2f8f5; display: flex; gap: 14px; }
.cloud-notice > span { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px; color: var(--ink-2); background: var(--mint-soft); display: grid; place-items: center; }
.cloud-notice svg { width: 21px; height: 21px; }
.cloud-notice strong { font-size: 12px; }
.cloud-notice p { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.binding-steps { display: grid; gap: 10px; }
.binding-steps > div { padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #faf9f5; display: flex; align-items: center; gap: 12px; }
.binding-steps b { width: 29px; height: 29px; flex: 0 0 auto; border-radius: 9px; color: white; background: var(--ink); display: grid; place-items: center; font-size: 10px; }
.binding-steps strong, .binding-steps small { display: block; }
.binding-steps strong { font-size: 11px; }
.binding-steps small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.binding-steps code { padding: 2px 5px; border-radius: 5px; color: var(--ink); background: var(--mint-soft); }
.cloud-connected-card { padding: 18px; border-radius: 17px; color: white; background: linear-gradient(135deg, var(--ink), #2f6b59); display: flex; align-items: center; gap: 15px; }
.cloud-connected-icon { width: 46px; height: 46px; border-radius: 14px; color: var(--ink); background: #dff1e8; display: grid; place-items: center; }
.cloud-connected-icon svg { width: 22px; height: 22px; }
.cloud-connected-card small, .cloud-connected-card strong, .cloud-connected-card code { display: block; }
.cloud-connected-card small { color: #b9d6ca; font-size: 9px; }
.cloud-connected-card strong { margin: 3px 0 6px; font-size: 15px; }
.cloud-connected-card code { width: max-content; padding: 4px 7px; border: 1px solid rgba(255,255,255,.2); border-radius: 7px; color: #f7c28e; font-size: 12px; letter-spacing: .12em; }
.cloud-share-tip { margin-top: 12px; padding: 13px; border: 1px solid #f0dfca; border-radius: 12px; color: #746253; background: #fff9f0; font-size: 10px; line-height: 1.65; }
.cloud-action-row { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 8px; }
.cloud-form-section { padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: #fbfaf6; }
.cloud-section-title { margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.cloud-section-title > span { width: 30px; height: 30px; border-radius: 10px; color: white; background: var(--ink); display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.cloud-section-title strong, .cloud-section-title small { display: block; }
.cloud-section-title strong { font-size: 12px; }
.cloud-section-title small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.cloud-divider { position: relative; height: 35px; display: grid; place-items: center; }
.cloud-divider::before { content: ""; position: absolute; inset: 50% 0 auto; height: 1px; background: var(--line); }
.cloud-divider span { position: relative; z-index: 1; padding: 0 10px; color: var(--muted); background: var(--card); font-size: 9px; }
.cloud-import-check { grid-column: 1 / -1; min-height: 41px; padding: 9px 11px; border: 1px solid #dce5df; border-radius: 11px; background: #f1f7f4; display: flex; align-items: center; gap: 9px; color: #50635a; font-size: 10px; }
.cloud-import-check input { width: 17px; height: 17px; accent-color: var(--mint); }

.lightbox { max-width: 95vw; max-height: 92vh; padding: 0; border: 0; overflow: visible; background: transparent; }
.lightbox::backdrop { background: rgba(3,18,14,.88); }
.lightbox img { display: block; max-width: 92vw; max-height: 88vh; border-radius: 12px; object-fit: contain; }
.lightbox-close { position: fixed; top: 18px; right: 22px; width: 42px; height: 42px; border: 0; border-radius: 50%; color: white; background: rgba(255,255,255,.13); font-size: 27px; }
.toast-region { position: fixed; z-index: 200; right: 24px; bottom: 24px; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 230px; padding: 13px 16px; border-radius: 12px; color: white; background: #173f35; box-shadow: var(--shadow); font-size: 11px; animation: toast-in .25s ease both; }
.toast.error { background: #a94b40; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.mobile-nav { display: none; }

@media (max-width: 1100px) {
  :root { --sidebar: 82px; }
  .sidebar { padding-inline: 14px; align-items: center; }
  .brand { padding: 0; }
  .brand > span:last-child, .nav-item span, .sidebar-foot { display: none; }
  .side-nav { width: 100%; }
  .nav-item { padding: 0; justify-content: center; }
  .nav-item.active::before { left: -14px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .data-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  :root { --radius-lg: 21px; }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .main-column { margin-left: 0; }
  .topbar { height: 72px; padding: 0 16px; }
  .mobile-brand { display: flex; align-items: center; gap: 5px; }
  .brand-mark.mini { width: 28px; height: 28px; }
  .mobile-brand strong { font-size: 16px; letter-spacing: .1em; }
  .trip-switcher-wrap > .eyebrow, .trip-switch-row .compact { display: none; }
  .trip-switch-row select { max-width: 37vw; padding: 8px 25px 8px 10px; font-size: 11px; }
  .install-btn { display: none !important; }
  .top-actions .icon-btn { width: 37px; min-width: 37px; height: 37px; }
  .cloud-status-btn { width: 37px; min-width: 37px; height: 37px; padding: 0; }
  .cloud-status-btn > span:last-child { display: none; }
  .cloud-status-btn .cloud-status-dot { position: absolute; top: 4px; right: 4px; border: 2px solid var(--card); }
  main { padding: 25px 16px 32px; }
  .page-heading { margin-bottom: 21px; align-items: center; }
  .page-heading h1 { font-size: 27px; }
  .page-heading p { max-width: 230px; font-size: 11px; }
  .page-heading .primary-btn { width: 42px; min-width: 42px; height: 42px; padding: 0; font-size: 0; }
  .page-heading .primary-btn svg { width: 19px; height: 19px; }
  .mobile-nav {
    position: fixed;
    z-index: 80;
    inset: auto 0 0;
    height: calc(66px + env(safe-area-inset-bottom));
    padding: 5px 8px env(safe-area-inset-bottom);
    border-top: 1px solid rgba(213,208,198,.9);
    background: rgba(255,254,250,.95);
    backdrop-filter: blur(18px);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
  }
  .mobile-nav button { position: relative; padding: 4px; border: 0; color: #87918c; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 9px; }
  .mobile-nav svg { width: 20px; height: 20px; }
  .mobile-nav button.active { color: var(--ink); font-weight: 700; }
  .mobile-nav button.active::after { content: ""; position: absolute; bottom: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--orange); }
  .mobile-nav .mobile-add { color: var(--ink); }
  .mobile-add > span { width: 42px; height: 42px; margin-top: -24px; border: 4px solid var(--paper); border-radius: 50%; color: white; background: var(--orange); box-shadow: 0 6px 16px rgba(191,108,53,.24); display: grid; place-items: center; }
  .mobile-add em { font-style: normal; }
  .hero-card { min-height: 334px; padding: 30px 24px; background-position: 62% center; }
  .hero-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(15,48,40,.6), transparent); }
  .hero-card h1 { max-width: 290px; font-size: 33px; }
  .hero-card p { max-width: 280px; font-size: 12px; }
  .countdown-badge { top: 18px; right: 18px; padding: 9px; }
  .countdown-badge strong { font-size: 20px; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { min-width: 0; min-height: 91px; padding: 14px; gap: 10px; }
  .stat-icon { width: 36px; height: 36px; }
  .stat-copy strong { font-size: 17px; }
  .content-card { padding: 19px; }
  .place-strip { overflow-x: auto; grid-template-columns: repeat(3, minmax(145px, 1fr)); }
  .map-workspace { height: auto; min-height: 0; display: flex; flex-direction: column; }
  .map-card { height: 52vh; min-height: 390px; }
  .places-panel { height: auto; max-height: 390px; }
  .place-list { max-height: 290px; }
  .money-hero { grid-template-columns: 1fr; padding: 24px; }
  .expense-grid { grid-template-columns: 1fr; }
  .ledger-table thead { display: none; }
  .ledger-table, .ledger-table tbody, .ledger-table tr, .ledger-table td { display: block; }
  .ledger-table tr { position: relative; padding: 13px 40px 13px 0; border-top: 1px solid #ebe7df; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .ledger-table td { padding: 2px 6px; border: 0; }
  .ledger-table td:nth-child(1) { grid-row: 1 / 3; }
  .ledger-table td:nth-child(2), .ledger-table td:nth-child(3) { color: var(--muted); font-size: 9px; text-align: right; }
  .ledger-table td:nth-child(4) { text-align: right; }
  .ledger-table td:last-child { position: absolute; right: 0; top: 22px; }
  .planner-layout { grid-template-columns: 1fr; }
  .day-summary { display: none; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-card.wide { grid-column: auto; }
  .data-actions { grid-template-columns: 1fr; }
  .member-add { align-items: stretch; }
  .member-add .primary-btn { flex: 0 0 auto; padding-inline: 13px; }
  .data-action { min-height: 74px; display: grid; grid-template-columns: 30px 1fr; align-items: center; }
  .data-action svg { grid-row: 1 / 3; margin: 0; }
  .toast-region { inset: auto 14px calc(82px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; width: 100%; }
}

@media (max-width: 520px) {
  .hero-actions { align-items: stretch; }
  .hero-actions button { padding-inline: 12px; font-size: 11px; }
  .hero-meta { gap: 8px 13px; }
  .stat-card { display: block; }
  .stat-icon { margin-bottom: 9px; }
  .mini-event { grid-template-columns: 44px 1px 1fr; gap: 10px; }
  .mini-event .type-chip { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .transport-fields { grid-template-columns: 1fr; padding: 11px; gap: 11px; }
  .member-add { display: grid; grid-template-columns: 1fr auto; }
  .member-add .primary-btn { font-size: 0; }
  .member-add .primary-btn svg { margin: 0; }
  .form-field.full, .form-actions { grid-column: auto; }
  .app-dialog { width: 100vw; max-width: none; max-height: 91vh; margin: auto 0 0; border-radius: 25px 25px 0 0; }
  .quick-grid { gap: 7px; }
  .quick-choice { min-height: 96px; }
  .category-row { grid-template-columns: 70px 1fr; }
  .category-row b { grid-column: 2; margin-top: -8px; text-align: left; }
  .date-scroller { margin-inline: -2px; }
  .date-chip { min-width: 49px; padding: 5px; }
  .timeline-event { grid-template-columns: 40px 14px minmax(0, 1fr); gap: 5px; min-height: 66px; }
  .event-time { padding-top: 10px; font-size: 9px; }
  .timeline-dot { margin-top: 13px; }
  .event-card { grid-column: 3; padding: 9px 58px 9px 10px; }
  .event-actions { position: absolute; top: 3px; right: 2px; padding: 0; display: flex; }
  .event-actions button { width: 26px; height: 26px; }
  .transport-link-row { grid-template-columns: 40px 14px minmax(0, 1fr); gap: 5px; min-height: 45px; }
  .transport-rail > span { width: 20px; height: 20px; }
  .transport-card { padding-left: 8px; }
  .transport-actions button { width: 24px; }
  .day-panel { padding: 15px 11px; }
  .day-heading { padding: 0 3px 13px; }
  .day-heading h2 { font-size: 16px; }
  .day-heading .secondary-btn { min-height: 36px; padding: 0 11px; }
}

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