:root {
  color-scheme: light;
  --bg: #f7f0e4;
  --ink: #2d251d;
  --muted: #756f66;
  --line: #e4d7c4;
  --panel: rgba(255, 255, 255, 0.86);
  --sage: #52745f;
  --maple: #b34d2e;
  --gold: #c18c30;
  --sky: #7fa6b8;
  --danger: #9b3c2c;
  --shadow: 0 14px 34px rgba(62, 45, 30, 0.13);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.d1-route-map {
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid rgba(128, 83, 43, .18);
  border-radius: 22px;
  background: linear-gradient(145deg, #fffaf1, #f4ead8);
}

.route-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.route-summary b { width: 100%; color: #7a4d2d; }
.route-summary span { padding: 7px 10px; border-radius: 999px; background: #fff; font-size: 13px; font-weight: 700; }
.route-summary i { color: #c56f43; font-style: normal; }
.pin-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pin-group { padding: 13px; border-radius: 16px; background: rgba(255,255,255,.78); }
.pin-group h4 { margin: 0 0 10px; color: #7a4d2d; }
.map-pin { display: grid; grid-template-columns: 28px minmax(0,1fr); column-gap: 8px; padding: 8px 0; color: inherit; text-decoration: none; border-bottom: 1px dashed rgba(128,83,43,.16); }
.map-pin:last-child { border-bottom: 0; }
.map-pin > span { grid-row: 1 / 3; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #d65f45; color: white; font-size: 11px; font-weight: 800; }
.map-pin > span::first-line { transform: rotate(45deg); }
.map-pin b, .map-pin small { grid-column: 2; }
.map-pin small { color: var(--muted, #756b62); }
.route-note { margin: 14px 0 0; font-size: 13px; color: #6f6257; }

@media (max-width: 760px) {
  .pin-groups { grid-template-columns: 1fr; }
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  min-width: 0;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 8%, rgba(179, 77, 46, 0.18), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(193, 140, 48, 0.18), transparent 28%),
    linear-gradient(180deg, #f4eadc 0%, #f8f3eb 42%, #eef3ed 100%);
  color: var(--ink);
}

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

button,
.icon-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--maple);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.secondary,
.secondary {
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  border: 1px solid var(--line);
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 18px;
  background: rgba(249, 243, 234, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

h1,
h2,
h3,
h4,
p,
strong,
b,
small {
  margin: 0;
  overflow-wrap: anywhere;
}

h1 {
  font-size: 18px;
  line-height: 1.2;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
}

h3 {
  font-size: 16px;
}

a {
  color: var(--maple);
  font-weight: 800;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.eyebrow.light {
  color: rgba(255, 255, 255, 0.84);
}

.content {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 16px;
}

.hero-panel,
.panel,
.info-card,
.day-card,
.data-card,
.prep-card,
.focus-card,
.shopping-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.trip-hero {
  position: relative;
  min-height: 320px;
  margin: -16px -16px 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
  background: #574434 var(--hero-image) center/cover;
  color: #fff;
}

.trip-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.06) 0%, rgba(0, 0, 0, 0.08) 34%, rgba(35, 24, 17, 0.8) 100%),
    linear-gradient(90deg, rgba(49, 29, 17, 0.44), transparent 72%);
}

.trip-hero.compact-hero {
  min-height: 210px;
  margin-bottom: 12px;
}

.trip-hero.overview-hero {
  min-height: 158px;
  margin-bottom: 12px;
}

.hero-shade {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding: 26px 18px 18px;
}

.hero-shade h2 {
  max-width: 760px;
  font-size: 30px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

.hero-shade p:not(.eyebrow) {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.45;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.hero-meta span,
.status-pill,
.tag,
.check-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #f3eadc;
  color: #7a4a2b;
  font-size: 12px;
  font-weight: 800;
}

.hero-meta span {
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.route-panel,
.resource-panel,
.checklist-panel {
  margin-top: 14px;
}

.route-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.route-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.route-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.route-head div {
  display: grid;
  gap: 4px;
}

.route-head small,
.route-card p,
.shop-location {
  color: var(--muted);
  line-height: 1.45;
}

.route-card ol {
  margin: 10px 0;
  padding-left: 22px;
  color: var(--ink);
}

.route-card li + li {
  margin-top: 6px;
}

.shop-location {
  margin-top: 6px;
  font-size: 13px;
}

.trip-hero > button {
  position: relative;
  z-index: 1;
  align-self: flex-end;
  margin: 0 14px 16px 0;
}

.panel,
.prep-card,
.focus-card {
  padding: 16px;
  margin-top: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.prep-card p,
.focus-card p,
.info-card p,
.data-card p,
.place-row p,
.itinerary-item p,
.shop-body p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfce;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--maple), var(--gold), var(--sage));
}

.today-focus {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.75fr);
  gap: 12px;
  margin: 12px 0;
}

.overview-today {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.overview-today h3 {
  margin-top: 3px;
  font-size: 21px;
}

.overview-today p:not(.eyebrow) {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
}

.overview-today-copy { min-width: 0; }
.overview-today .today-route { font-size: 13px; }
.overview-today .today-stay { font-size: 13px; font-weight: 700; }

.overview-task-panel { padding: 14px; }
.overview-task-list { display: grid; }

.overview-task-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.overview-task-row:last-child { border-bottom: 0; }
.overview-task-row > div { display: grid; gap: 3px; }
.overview-task-row strong { font-size: 14px; }
.overview-task-row small { color: var(--muted); line-height: 1.35; }

.task-check {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--sage);
  font-size: 20px;
}

.task-check.is-done { background: #e9f1e8; }
.overview-completed-tasks,
.overview-completed-tickets { margin-top: 10px; }
.overview-completed-tasks > summary,
.overview-completed-tickets > summary { cursor: pointer; color: var(--muted); font-weight: 800; }
.overview-completed-tasks > div,
.overview-completed-tickets > div { margin-top: 4px; }

.overview-status-groups {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ticket-compact-row,
.overview-resource-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.ticket-compact-row span,
.overview-resource-row > span { color: var(--muted); white-space: nowrap; }
.overview-resource-row > div { display: grid; gap: 3px; }
.overview-resource-row small { color: var(--muted); }
.text-action { min-height: 34px; padding: 0 4px; background: transparent; color: var(--maple); }

.overview-wallet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.overview-wallet > div { display: grid; gap: 5px; }
.overview-wallet > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.overview-wallet strong { font-size: 18px; }
.overview-wallet strong span { color: var(--muted); font-weight: 400; }
.overview-wallet strong small { color: var(--muted); font-size: 12px; }
.overview-progress { margin-top: 12px; }

.route-guide-card {
  margin: 0 0 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.route-guide-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.route-guide-heading h4 { margin: 2px 0; font-size: 16px; }
.route-guide-heading small,
.route-guide-heading > span,
.route-guide-fare { color: var(--muted); font-size: 13px; }
.route-guide-fare { margin-top: 5px; }
.route-guide-card ol { margin: 10px 0; padding-left: 21px; }
.route-guide-card li { padding: 3px 0; line-height: 1.45; }
.route-guide-note { color: var(--maple); font-size: 13px; line-height: 1.45; }

.ticket-detail-list { display: grid; }
.ticket-detail-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ticket-detail-row > div { display: flex; justify-content: space-between; gap: 12px; }
.ticket-detail-row > div span { color: var(--sage); font-weight: 800; text-align: right; }
.ticket-detail-row p { margin-top: 4px; color: var(--muted); line-height: 1.4; }
.info-trip-outline .grid.two { margin-top: 8px; }

.library-card {
  position: relative;
  min-height: 148px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
  border-radius: 8px;
  padding: 14px;
  background: #594231 var(--card-image) center/cover;
  color: #fff;
}

.library-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(36, 24, 16, 0.82));
}

.library-card > * {
  position: relative;
  z-index: 1;
}

.library-card p {
  margin-top: 6px;
  max-width: 620px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.45;
}

.focus-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.muted-card {
  display: block;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-card,
.day-card,
.data-card {
  padding: 14px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field.compact {
  min-width: 112px;
}

select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.tag.warning {
  background: #fae5d8;
  color: var(--danger);
}

.tag-row,
.actions,
.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.timeline,
.card-list {
  display: grid;
  gap: 14px;
}

.date-rail {
  position: sticky;
  top: 70px;
  z-index: 2;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(86px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding: 8px 2px 12px;
  margin: -2px 0 10px;
  background: rgba(249, 243, 234, 0.92);
  scrollbar-width: none;
}

.date-rail::-webkit-scrollbar,
.chip-filters::-webkit-scrollbar {
  display: none;
}

.date-tab {
  min-width: 86px;
  min-height: 66px;
  display: grid;
  gap: 2px;
  align-content: center;
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
}

.date-tab.active {
  background: #fff6e6;
  color: #8a3d25;
  border-color: #d19845;
  box-shadow: 0 8px 18px rgba(132, 72, 34, 0.16);
}

.date-tab span,
.date-tab b,
.date-tab small {
  line-height: 1.1;
  white-space: nowrap;
}

.date-tab span {
  font-weight: 900;
}

.date-tab small {
  font-size: 11px;
}

.day-card header,
.data-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.block {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.block h4 {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.d1-brief {
  margin: 12px 0 18px;
  padding: 16px;
  border: 1px solid rgba(183, 97, 71, 0.22);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 247, 237, 0.98), rgba(244, 235, 221, 0.82));
}

.d1-brief-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.d1-brief-head h4 { margin: 2px 0 0; color: var(--ink); }
.d1-brief-head > span { padding: 6px 10px; border-radius: 999px; background: var(--ink); color: white; font-size: 12px; white-space: nowrap; }
.d1-brief-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.d1-brief-grid article { padding: 10px; border-radius: 10px; background: rgba(255,255,255,.72); }
.d1-brief-grid small, .d1-brief-grid b { display: block; }
.d1-brief-grid small { color: var(--muted); margin-bottom: 4px; }
.d1-brief-grid b { font-size: 13px; line-height: 1.45; }
.d1-pending { margin: 10px 0 0; padding: 10px; border-radius: 10px; background: rgba(255, 223, 171, .38); font-size: 13px; }

.daily-lodging {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 12px 0 16px;
  padding: 14px;
  border: 1px solid rgba(84, 117, 105, .24);
  border-radius: 12px;
  background: rgba(235, 244, 239, .76);
}

.daily-lodging.no-stay { background: rgba(238, 240, 243, .82); border-color: var(--line); }
.lodging-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--ink); color: white; font-size: 20px; }
.daily-lodging h4 { margin: 2px 0 5px; color: var(--ink); }
.daily-lodging small { display: block; color: var(--muted); line-height: 1.5; }

.place-row,
.itinerary-item {
  display: grid;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.place-row {
  grid-template-columns: 96px minmax(0, 1fr) auto;
  padding: 12px 0;
}

.place-row:first-child {
  border-top: 0;
}

.place-row img,
.itinerary-item img {
  width: 96px;
  height: 76px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.itinerary-item {
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: start;
  background: rgba(255, 250, 243, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.itinerary-item img {
  width: 110px;
  height: 92px;
}

.itinerary-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.itinerary-title-row strong {
  color: var(--ink);
  line-height: 1.4;
}

.travel-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e6f1e9;
  color: var(--sage);
  font-size: 11px;
  font-weight: 800;
}

.item-place {
  margin-top: 4px !important;
  color: #8a5c3d !important;
  font-size: 13px;
  font-weight: 800;
}

.item-facts {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.item-facts p {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  margin: 0 !important;
  color: var(--ink);
  line-height: 1.45;
  font-size: 13px;
}

.item-facts b {
  color: var(--muted);
  font-size: 12px;
}

.item-facts span {
  color: var(--ink);
}

.inline-actions {
  margin-top: 10px;
}

.reminders {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--danger);
}

.chip-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: none;
}

.chip-filters .field {
  min-width: 132px;
}

.shopping-day-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(88px, 1fr);
  gap: 8px;
  overflow-x: auto;
  margin: -2px -16px 14px;
  padding: 2px 16px 8px;
  scrollbar-width: none;
}

.shopping-day-button {
  position: relative;
  min-height: 82px;
  display: grid;
  gap: 1px;
  justify-items: start;
  align-content: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  box-shadow: 0 7px 16px rgba(62, 45, 30, 0.08);
}

.shopping-day-button span {
  color: var(--maple);
  font-size: 17px;
  font-weight: 900;
}

.shopping-day-button b { font-size: 13px; }
.shopping-day-button small { color: var(--muted); font-size: 11px; }

.shopping-day-button em {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #efe5d5;
  font-size: 11px;
  font-style: normal;
}

.shopping-day-button.active {
  border-color: #cc8c5b;
  background: #fff2df;
  box-shadow: inset 0 0 0 1px rgba(179, 77, 46, 0.28), 0 7px 18px rgba(179, 77, 46, 0.12);
}

.shopping-board-header {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(0, 1.6fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid rgba(179, 77, 46, 0.18);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 249, 239, 0.96), rgba(238, 244, 237, 0.9));
}

.shopping-board-header h2 { margin: 2px 0 4px; font-size: 28px; }
.shopping-board-header p { margin: 0; color: var(--muted); }
.shopping-board-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shopping-add-button { flex: 0 0 auto; min-height: 42px; white-space: nowrap; }

.shopping-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.shopping-summary span {
  min-height: 66px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 8px 4px;
  border: 1px solid rgba(82, 116, 95, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.shopping-summary b { color: var(--sage); font-size: 18px; }
.shopping-summary small { color: var(--muted); font-size: 11px; }

.shopping-summary span:last-child {
  grid-column: 1 / -1;
  min-height: 56px;
}

.shopping-day-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 4px 0 10px;
}

.shopping-day-heading h3 { margin: 1px 0 0; }
.shopping-day-heading > span { color: var(--muted); font-size: 13px; font-weight: 800; }

.shopping-store-group { margin: 0 0 16px; }
.shopping-store-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 2px 10px;
  margin: 0 0 8px;
  padding: 7px 10px;
  border-left: 4px solid var(--maple);
  border-radius: 8px;
  background: #fffaf4;
  box-shadow: 0 2px 8px rgba(62, 45, 30, 0.08);
}
.shopping-store-heading h4 { margin: 0; font-size: 15px; line-height: 1.35; }
.shopping-store-heading > span { color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.shopping-store-time { margin-right: 6px; color: var(--maple); font-variant-numeric: tabular-nums; }

.shopping-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.shopping-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(62, 45, 30, 0.1);
}

.shopping-card.bought { opacity: 0.64; }
.shopping-card.missed { border-color: rgba(155, 60, 44, 0.4); }

.shop-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #ebe5da;
}

.shop-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.shop-image:has(img)::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), transparent 58%, rgba(0, 0, 0, 0.24));
}

.shop-image-unresolved {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 18px;
  background: #f3f0e9;
  color: #625d55;
  text-align: center;
}

.shop-image-unresolved b { font-size: 13px; }
.shop-image-unresolved span { max-width: 260px; font-size: 11px; line-height: 1.45; }

.shop-image-label {
  position: absolute;
  left: 7px;
  bottom: 7px;
  z-index: 1;
  max-width: calc(100% - 82px);
  overflow: hidden;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #4c4943;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-image em {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 1;
  max-width: calc(100% - 52px);
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--maple);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-image em.status-missed { background: rgba(155, 60, 44, 0.9); color: #fff; }
.shop-image em.status-bought { background: rgba(82, 116, 95, 0.92); color: #fff; }

.shop-bought-toggle {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 2;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--maple);
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.shop-bought-toggle:hover,
.shop-bought-toggle:focus-visible { background: var(--maple); color: #fff; }

.shopping-card.bought .shop-bought-toggle { background: rgba(82, 116, 95, 0.92); color: #fff; }

.shopping-day-section + .shopping-day-section { margin-top: 22px; }

.shop-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
}

.shop-body h3 {
  display: -webkit-box;
  min-height: 38px;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.shop-meta { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 800; }
.shop-meta [class^="priority-"] { color: var(--maple); }
.shop-price { margin: 0; color: var(--ink); font-size: 13px; font-weight: 900; }

.shop-location {
  display: -webkit-box;
  min-height: 32px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.shop-source-link {
  align-self: flex-start;
  color: var(--maple);
  font-size: 11px;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.shop-body details { margin-top: auto; color: var(--muted); font-size: 11px; }
.shop-body details p { margin: 5px 0 0; line-height: 1.45; }
.shop-body summary { cursor: pointer; font-weight: 800; }

.shop-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 10px 10px;
}

.shop-actions button { min-height: 34px; padding: 0 7px; font-size: 11px; }

.shopping-empty {
  grid-column: 1 / -1;
  padding: 34px 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
}

.shopping-empty p { margin-bottom: 0; color: var(--muted); }

.shopping-edit-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  background: rgba(35, 28, 23, 0.45);
  backdrop-filter: blur(3px);
}

.shopping-edit-sheet {
  position: fixed;
  z-index: 21;
  left: 50%;
  bottom: 0;
  width: min(620px, 100%);
  max-height: min(88vh, 760px);
  overflow-y: auto;
  padding: 18px;
  border-radius: 20px 20px 0 0;
  background: #fffaf4;
  box-shadow: 0 -18px 50px rgba(35, 28, 23, 0.24);
  transform: translateX(-50%);
}

.shopping-edit-sheet header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.shopping-edit-sheet h3 { margin: 2px 0 0; }
.shopping-edit-sheet form { display: grid; gap: 12px; }
.shopping-edit-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.shopping-edit-actions .danger-button { margin-right: auto; }
.shopping-edit-sheet .field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.shopping-edit-sheet input,
.shopping-edit-sheet select,
.shopping-edit-sheet textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px; background: #fff; color: var(--ink); }
.shopping-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shopping-city-hint { margin: -4px 0 0; color: var(--muted); font-size: 12px; }
.shopping-photo-field { display: grid; gap: 8px; }
.shopping-photo-field .field small { font-weight: 500; line-height: 1.5; }
.shopping-photo-field input[type="file"] { padding: 8px; }
.shopping-photo-field input[type="file"]::file-selector-button { margin-right: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff6e6; color: var(--ink); font: inherit; font-weight: 800; }
.shopping-photo-preview { display: grid; place-items: center; min-height: 132px; overflow: hidden; border: 1px dashed var(--line); border-radius: 10px; background: rgba(255,255,255,.72); color: var(--muted); }
.shopping-photo-preview img { display: block; width: min(100%, 220px); height: 180px; object-fit: contain; }
.shopping-photo-error { min-height: 1.2em; margin: 0; color: var(--maple); font-size: 12px; }
.shopping-remove-photo { justify-self: start; }
.shopping-city-hint + .field { margin-top: 0; }
.shopping-edit-sheet { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.shopping-edit-actions { position: sticky; bottom: -1px; z-index: 2; margin: 4px -18px -18px; padding: 12px 18px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,250,244,.98); }
.d3-ticket-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--maple); border-radius: 8px; background: rgba(255, 250, 243, .9); }
.d3-ticket-notice div { display: grid; gap: 3px; color: var(--muted); font-size: 12px; }
.d3-ticket-notice strong { color: var(--ink); font-size: 14px; }
.d3-ticket-notice .text-action { min-height: 36px; padding: 5px 8px; white-space: nowrap; }
.itinerary-shopping-link { display: inline-flex; align-items: center; min-height: 36px; margin-top: 8px; padding: 5px 0; border: 0; background: transparent; color: var(--maple); text-align: left; font-size: 13px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.shop-itinerary-link { display: block; margin: 8px 0; padding: 0; border: 0; background: transparent; color: var(--maple); text-align: left; font-size: 12px; font-weight: 800; }

.checklist-panel {
  display: grid;
  gap: 10px;
}

.checklist-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.72);
  overflow: hidden;
}

.checklist-group summary {
  min-height: 54px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  cursor: pointer;
}

.checklist-group summary span {
  color: var(--maple);
  font-weight: 900;
}

.checklist-group summary small {
  color: var(--muted);
  font-weight: 800;
}

.checklist-group div {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.checklist-group label {
  min-height: 42px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.checklist-group input {
  width: 20px;
  height: 20px;
  accent-color: var(--maple);
}

.phrase {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.big-card {
  margin-top: 12px;
  border: 2px solid var(--danger);
  border-radius: 8px;
  padding: 18px;
  color: var(--danger);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.35;
  background: #fff8f6;
}

.info-quiet {
  border-color: #efd0c5;
}

.resource-list {
  display: grid;
  gap: 10px;
}

.resource-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.78);
}

.resource-row > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff1dc;
  color: var(--maple);
  font-weight: 900;
}

.resource-row p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.expense-screen,
.expense-summary-card,
.expense-mini-grid article,
.stats-card,
.expense-row {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.expense-screen {
  display: grid;
  gap: 20px;
  padding: 22px 10px 2px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.expense-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.expense-header h2 {
  margin-top: 8px;
  color: var(--ink);
  font-size: 32px;
  letter-spacing: 0;
}

.avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #b34d2e, #e7a94e);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.rate-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(30, 45, 70, 0.04);
}

.rate-pill span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--sage);
}

.expense-summary-card {
  position: relative;
  margin-top: 20px;
  padding: 28px 22px 22px;
}

.expense-tabs {
  width: fit-content;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #f3eadc;
}

.expense-tabs span,
.expense-tabs b {
  min-width: 72px;
  padding: 8px 14px;
  border-radius: 8px;
  text-align: center;
}

.expense-tabs span {
  background: #fff8ee;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(62, 45, 30, 0.12);
}

.expense-tabs b {
  color: var(--muted);
}

.expense-count {
  position: absolute;
  top: 26px;
  right: 22px;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff1dc;
  color: var(--ink);
}

.expense-count strong {
  font-size: 30px;
  line-height: 1;
}

.expense-count small {
  color: var(--muted);
}

.expense-summary-card > p {
  margin-top: 56px;
  color: var(--muted);
  font-weight: 800;
}

.expense-summary-card h2 {
  margin-top: 10px;
  color: var(--ink);
  font-size: 48px;
  line-height: 1.05;
}

.expense-summary-card > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.budget-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
  color: var(--muted);
  font-weight: 800;
}

.budget-row b {
  color: #7a4a2b;
}

.blue-progress {
  height: 10px;
  overflow: hidden;
  margin-top: 10px;
  border-radius: 999px;
  background: #eadfce;
}

.blue-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--maple), var(--gold), var(--sage));
}

.budget-over {
  color: #b34d2e !important;
}

.expense-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.expense-mini-grid article {
  padding: 18px;
}

.expense-mini-grid p {
  color: var(--muted);
  font-weight: 800;
}

.expense-mini-grid strong {
  display: block;
  margin-top: 14px;
  color: var(--ink);
  font-size: 28px;
}

.expense-mini-grid .green {
  color: var(--sage);
}

.expense-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 2px 10px;
}

.expense-section-title h3 {
  font-size: 22px;
}

.expense-list {
  display: grid;
  gap: 10px;
}

.expense-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.expense-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fff1dc;
  font-size: 22px;
}

.expense-row p,
.expense-row small {
  color: var(--muted);
  line-height: 1.35;
}

.expense-row > div:last-child {
  text-align: right;
}

.expense-row b {
  color: var(--ink);
  font-size: 18px;
  white-space: nowrap;
}

.stats-card {
  margin-top: 14px;
  padding: 18px;
}

.stats-card h3 {
  font-size: 22px;
}

.stats-layout {
  display: grid;
  grid-template-columns: minmax(150px, 0.75fr) minmax(0, 1.25fr);
  gap: 18px;
  align-items: center;
  margin-top: 18px;
}

.donut {
  width: min(100%, 180px);
  aspect-ratio: 1;
  border-radius: 999px;
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 32%;
  border-radius: inherit;
  background: #fff;
}

.legend-list {
  display: grid;
  gap: 10px;
}

.legend-list p {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.legend-list span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.legend-list b {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.rebate-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.rebate-row:first-of-type {
  border-top: 0;
}

.rebate-row p,
.rebate-row small {
  color: var(--muted);
}

.rebate-row > div:last-child {
  text-align: right;
}

.rebate-row > div:last-child b {
  display: block;
  color: var(--maple);
  font-size: 24px;
}

.mini-ring {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: conic-gradient(var(--maple) 0 var(--ring), #eadfce var(--ring) 100%);
  position: relative;
}

.mini-ring::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: inherit;
  background: #fffaf3;
}

.mini-ring b {
  position: relative;
  z-index: 1;
  color: var(--ink);
}

.muted {
  color: var(--muted);
}

.balance-low {
  color: var(--danger) !important;
}

.expense-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 2px 10px;
}

.expense-toolbar h3 {
  font-size: 22px;
}

.expense-toolbar p,
.empty-expense p,
.expense-row small,
.sheet-note {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.expense-row {
  grid-template-columns: 54px minmax(0, 1fr) auto auto;
}

.expense-row.is-refund {
  background: #f0f6f1;
  border-color: #c8dacd;
}

.expense-row.is-refund > div:last-of-type b {
  color: var(--sage);
}

.expense-row-actions,
.method-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.expense-row-actions .icon-button,
.method-controls .icon-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
}

.empty-expense {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.legend-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  text-align: left;
}

.legend-filter.active {
  border-color: var(--line);
  background: #fff1dc;
}

.legend-filter span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.legend-filter b {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.expense-fab {
  position: fixed;
  right: max(18px, calc((100vw - 980px) / 2 + 18px));
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 6;
  width: 58px;
  height: 58px;
  min-height: 58px;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 12px 28px rgba(126, 54, 32, 0.28);
  font-size: 32px;
  line-height: 1;
}

.expense-menu-backdrop,
.expense-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 7;
  background: rgba(35, 28, 22, 0.42);
  backdrop-filter: blur(3px);
}

.expense-action-menu,
.expense-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 8;
  width: min(100%, 620px);
  transform: translateX(-50%);
  padding: 18px max(18px, env(safe-area-inset-left)) calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #fffaf3;
  box-shadow: 0 -16px 40px rgba(55, 39, 26, 0.2);
}

.expense-action-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.expense-action-menu button:not(.secondary) {
  min-height: 94px;
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 4px;
  padding: 16px;
  text-align: left;
}

.expense-action-menu button:disabled {
  opacity: 0.52;
}

.expense-action-menu button span {
  font-size: 22px;
}

.expense-action-menu button small {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
}

.expense-action-menu > .secondary {
  grid-column: 1 / -1;
}

.expense-sheet {
  max-height: min(88vh, 820px);
  overflow-y: auto;
}

.expense-sheet.compact-sheet {
  max-height: min(70vh, 620px);
}

.expense-sheet > header {
  position: sticky;
  top: -18px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -18px -2px 16px;
  padding: 18px 2px 12px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
}

.expense-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.expense-form .field,
.add-payment-form .field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.expense-form input,
.expense-form select,
.expense-form textarea,
.add-payment-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.expense-form textarea {
  resize: vertical;
}

.expense-form .full,
.expense-form-actions.full {
  grid-column: 1 / -1;
}

.expense-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.receipt-items-editor {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.receipt-items-editor legend {
  padding: 0 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.receipt-items-head,
.receipt-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 40px;
  gap: 8px;
  align-items: center;
}

.receipt-items-head {
  padding: 0 2px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.receipt-items-list {
  display: grid;
  gap: 8px;
}

.receipt-item-row .icon-button {
  width: 40px;
  min-height: 40px;
}

.receipt-items-empty {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.receipt-items-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.receipt-items-summary p {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.receipt-items-summary span {
  color: var(--muted);
  font-size: 12px;
}

.receipt-items-mismatch {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: #fff5e7;
  color: #6f431d;
  font-size: 12px;
  line-height: 1.45;
}

.expense-item-preview {
  display: grid;
  gap: 2px;
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
}

.expense-item-preview li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.expense-item-preview b {
  flex: 0 0 auto;
  color: var(--ink);
}

.danger-button {
  background: #fff;
  color: var(--danger);
  border: 1px solid #d9b6ab;
}

.form-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-left: 4px solid var(--danger);
  background: #f8e8e3;
  color: #73311e;
  line-height: 1.45;
}

.undo-bar {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 10;
  width: min(calc(100% - 24px), 560px);
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transform: translateX(-50%);
  padding: 8px 10px 8px 14px;
  border-radius: 8px;
  background: #2d251d;
  color: #fff;
  box-shadow: var(--shadow);
}

.undo-bar button {
  min-height: 38px;
  background: #fff;
  color: var(--ink);
}

.payment-method-list {
  display: grid;
  gap: 8px;
}

.payment-method-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.payment-method-row.inactive {
  opacity: 0.62;
}

.payment-method-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.refund-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.refund-summary span {
  color: var(--muted);
  text-align: right;
}

.rename-payment-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.rename-payment-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.backup-reminder,
.backup-card {
  margin: 16px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.backup-reminder { border-left: 4px solid var(--gold); }

.backup-reminder p,
.backup-card p,
.backup-status {
  margin: 5px 0 0;
  color: var(--muted);
}

.backup-card .actions,
.backup-reminder .actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.backup-status {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  background: #f2f6f1;
  color: #315640;
}

.backup-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.backup-preview > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbf6ee;
}

.backup-preview dt { color: var(--muted); font-size: 13px; }
.backup-preview dd { margin: 4px 0 0; font-weight: 700; }

.restore-steps {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.confirm-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.confirm-row input { margin-top: 3px; width: 18px; height: 18px; }

.danger-solid { background: #9b3429; border-color: #9b3429; color: #fff; }
.danger-solid:disabled { background: #d8d5d0; border-color: #d8d5d0; color: #777; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.ocr-status-card .actions,
.receipt-tools,
.receipt-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.ocr-storage-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf6ee;
}

.ocr-storage-row b { text-align: center; }
.ocr-storage-row small { color: var(--muted); }
.ocr-caution { color: #845027; font-weight: 700; }

.receipt-source-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.receipt-source {
  position: relative;
  min-height: 120px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 5px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--maple);
  color: #fff;
  cursor: pointer;
  overflow: hidden;
}

.receipt-source span { font-size: 13px; opacity: 0.82; }
.receipt-source b { font-size: 19px; }
.receipt-source small { color: rgba(255, 255, 255, 0.8); }

.receipt-file-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.receipt-source:focus-within {
  outline: 3px solid #f4c36d;
  outline-offset: 2px;
}

.receipt-environment-warning {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: #fff7e8;
  color: #71411f;
  font-size: 13px;
  font-weight: 700;
}

.receipt-crop-stage {
  position: relative;
  min-height: 300px;
  max-height: 52vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #251f1a;
  touch-action: none;
}

.receipt-crop-stage > img {
  max-width: 100%;
  max-height: 52vh;
  object-fit: contain;
  transition: transform 160ms ease;
}

.receipt-crop-frame {
  position: absolute;
  left: var(--crop-left);
  top: var(--crop-top);
  right: var(--crop-right);
  bottom: var(--crop-bottom);
  border: 2px solid #fff;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.42);
}

.receipt-crop-frame button {
  position: absolute;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--maple);
  touch-action: none;
}

.receipt-crop-frame [data-crop-handle="nw"] { left: -15px; top: -15px; }
.receipt-crop-frame [data-crop-handle="ne"] { right: -15px; top: -15px; }
.receipt-crop-frame [data-crop-handle="sw"] { left: -15px; bottom: -15px; }
.receipt-crop-frame [data-crop-handle="se"] { right: -15px; bottom: -15px; }

.receipt-tools > * { flex: 1 1 120px; }
.file-button { display: grid; place-items: center; min-height: 46px; cursor: pointer; }

.receipt-progress {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.receipt-progress strong { font-size: 36px; color: var(--maple); }
.receipt-progress > span { color: var(--muted); font-weight: 700; }

.receipt-preview-button {
  width: 100%;
  height: 190px;
  min-height: 190px;
  margin-bottom: 14px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #2b241e;
}

.receipt-preview-button img { width: 100%; height: 100%; object-fit: contain; }

.low-confidence {
  padding: 8px;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: #fff7e8;
}

.receipt-text-fallback {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.receipt-text-fallback summary { cursor: pointer; font-weight: 800; }
.receipt-text-fallback form { display: grid; gap: 10px; margin-top: 10px; }
.receipt-text-fallback textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.receipt-text-fallback pre { max-height: 220px; overflow: auto; margin: 10px 0 0; padding: 10px; background: #f6f7f8; border-radius: 6px; white-space: pre-wrap; word-break: break-word; font-size: 12px; }

.receipt-zoom {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(22, 18, 15, 0.94);
}

.receipt-zoom img { max-width: 100%; max-height: 92vh; object-fit: contain; }
.receipt-zoom button { position: absolute; top: max(18px, env(safe-area-inset-top)); right: 18px; }

.method-controls button {
  min-height: 40px;
  padding: 0 10px;
}

.method-controls button:disabled {
  opacity: 0.38;
}

.add-payment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--visual-viewport-bottom-offset, 0px);
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.nav-item {
  min-width: 0;
  min-height: 58px;
  display: grid;
  gap: 2px;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 4px;
}

.nav-item.active {
  background: #fff1dc;
  color: #8a3d25;
}

.nav-item span {
  font-size: 18px;
}

.nav-item b {
  font-size: 12px;
}

@media (max-width: 900px) {
  .shopping-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shopping-board-header { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .content {
    padding: 12px;
  }

  .topbar,
  .day-card header,
  .data-card header,
  .section-title,
  .focus-card,
  .trip-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .trip-hero {
    min-height: 292px;
    margin: -12px -12px 14px;
  }

  .trip-hero.compact-hero {
    min-height: 196px;
  }

  .trip-hero.overview-hero { min-height: 134px; }

  .hero-shade h2 {
    font-size: 25px;
  }

  .date-rail {
    top: 74px;
    grid-auto-columns: 88px;
  }

  .today-focus,
  .grid.two,
  .stats-layout {
    grid-template-columns: 1fr;
  }

  .overview-today { align-items: flex-start; flex-direction: column; }
  .overview-today > button { align-self: flex-start; }
  .overview-status-groups { grid-template-columns: 1fr; gap: 8px; }
  .overview-resource-row { flex-wrap: wrap; }
  .overview-resource-row > div { flex: 1 1 100%; }
  .overview-wallet { grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
  .overview-wallet > div + div { padding-left: 10px; }
  .overview-wallet strong { font-size: 15px; }
  .route-guide-heading { flex-direction: column; gap: 4px; }
  .ticket-detail-row > div { align-items: flex-start; flex-direction: column; gap: 3px; }
  .ticket-detail-row > div span { text-align: left; }

  .shopping-day-rail { margin-right: -12px; margin-left: -12px; padding-right: 12px; padding-left: 12px; }
  .shopping-board-header { padding: 14px; }
  .shopping-board-header h2 { font-size: 24px; }
  .shopping-board-heading { align-items: flex-start; flex-direction: column; }
  .shopping-add-button { width: 100%; }
  .shopping-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; }
  .shopping-summary span:last-child { grid-column: 1 / -1; }
  .shopping-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .shopping-edit-grid { grid-template-columns: 1fr; }
  .shop-body { padding: 8px; }
  .shop-actions { padding: 0 8px 8px; }

  .expense-header h2 {
    font-size: 28px;
  }

  .expense-summary-card h2 {
    font-size: 34px;
  }

  .expense-summary-card {
    padding: 18px;
  }

  .expense-count {
    position: static;
    width: auto;
    height: auto;
    min-height: 54px;
    grid-template-columns: auto auto;
    justify-content: center;
    gap: 4px;
    margin-top: 12px;
  }

  .expense-summary-card > p {
    margin-top: 24px;
  }

  .budget-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .stats-layout {
    justify-items: stretch;
  }

  .donut {
    width: 170px;
    justify-self: center;
  }

  .resource-row,
  .rebate-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .resource-row .icon-button,
  .rebate-row > div:last-child {
    grid-column: 1 / -1;
  }

  .expense-row {
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: start;
  }

  .expense-icon {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }

  .expense-row > div:last-child {
    grid-column: 2;
    text-align: left;
  }

  .expense-row > div:last-child b,
  .expense-row > div:last-child small {
    display: block;
  }

  .legend-list p {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .legend-list b {
    grid-column: 2;
  }

  .rate-pill {
    width: 100%;
    justify-content: center;
  }

  .expense-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .expense-toolbar .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .expense-row > div:nth-of-type(2) {
    grid-column: 2;
    text-align: left;
  }

  .expense-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .legend-filter {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .legend-filter b {
    grid-column: 2;
  }

  .expense-action-menu {
    grid-template-columns: 1fr;
  }

  .expense-action-menu > .secondary {
    grid-column: 1;
  }

  .expense-form {
    grid-template-columns: 1fr;
  }

  .expense-form .full,
  .expense-form-actions.full {
    grid-column: 1;
  }

  .payment-method-row {
    grid-template-columns: 1fr;
  }

  .method-controls {
    justify-content: flex-start;
  }

  .add-payment-form {
    grid-template-columns: 1fr;
  }

  .refund-summary,
  .rename-payment-form {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .refund-summary span {
    text-align: left;
  }

  .backup-reminder,
  .backup-card {
    align-items: stretch;
    flex-direction: column;
  }

  .backup-card .actions,
  .backup-reminder .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .backup-preview { grid-template-columns: 1fr; }

  .receipt-source-grid { grid-template-columns: 1fr 1fr; }

  .receipt-source {
    min-height: 104px;
    padding: 12px;
  }

  .receipt-crop-stage { min-height: 260px; }

  .ocr-storage-row {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .ocr-storage-row b { text-align: left; }

  .receipt-confirmation .confirm-row { grid-column: 1; }

  .receipt-items-head,
  .receipt-item-row {
    grid-template-columns: minmax(0, 1fr) 88px 40px;
  }

  .receipt-items-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .receipt-items-summary p {
    justify-content: space-between;
  }

  .place-row,
  .itinerary-item {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .place-row img,
  .itinerary-item img {
    width: 82px;
    height: 72px;
  }

  .d1-brief-head { display: grid; }
  .d1-brief-head > span { width: fit-content; }
  .d1-brief-grid { grid-template-columns: 1fr; }

  .place-row .actions {
    grid-column: 1 / -1;
  }

  .big-card {
    font-size: 20px;
  }
}
.expense-date-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  padding: 4px 2px 12px;
  margin-bottom: 4px;
}

.rate-pill { max-width: 100%; flex-wrap: wrap; border-radius: 20px; padding: 6px 12px; }
.rate-pill .rate-edit { min-height: 34px; padding: 4px 10px; margin-left: auto; font-size: 14px; }

.expense-date-rail button {
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.expense-date-rail button.active {
  border-color: var(--maple);
  background: #fff1dc;
  color: var(--maple);
}

.expense-row {
  display: block;
  padding: 0;
}

.expense-row summary {
  display: grid;
  grid-template-columns: minmax(70px, 92px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.expense-row summary::-webkit-details-marker { display: none; }
.expense-row summary:focus-visible { outline: 2px solid var(--maple); outline-offset: 2px; }
.expense-date-category { min-width: 0; line-height: 1.25; }
.expense-date-category b { display: block; font-size: 12px; overflow-wrap: anywhere; }
.expense-date-category small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.expense-brief { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.expense-row summary > b { white-space: nowrap; font-size: 16px; }
.expense-detail {
  display: block;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.expense-row > .expense-detail:last-child { grid-column: auto; text-align: left; }
.expense-detail p { margin: 4px 0; font-size: 14px; }
.expense-detail .expense-row-actions { margin-top: 10px; }

@media (max-width: 420px) {
  .expense-row summary { gap: 8px; grid-template-columns: minmax(60px, 84px) minmax(0, 1fr) auto; }
  .expense-row summary > b { font-size: 14px; }
  .expense-detail { padding-left: 12px; }
}

/* Info page (v54): compact header, hotels and flights, OCR one-liner */
.info-head { padding: 4px 2px 0; }
.info-head h2 { margin: 2px 0 0; font-size: 20px; }
.info-stay { display: grid; gap: 10px; }
.info-flight, .info-lodging { display: grid; gap: 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.info-flight small, .info-lodging small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.info-lodging-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.info-lodging-head span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lodging-access { display: block; color: var(--ink) !important; }
.daily-lodging a[href^="tel:"], .info-lodging a[href^="tel:"] { color: var(--sky); font-weight: 700; }
.ocr-status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ocr-status-line b.warning { color: var(--danger, #9b3c2c); }
.ocr-status-line .text-action { min-height: 0; padding: 0; }
.info-backup { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.info-backup p { margin: 0; flex: 1 1 200px; }

/* Itinerary: folded route notes, weather chip */
.day-extras { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 8px 12px; margin-block: 8px; }
.day-extras summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.day-extras[open] summary { margin-bottom: 8px; }
.wx-chip { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin-top: 6px; padding: 3px 10px; border-radius: 999px; background: #e9f0f3; color: var(--ink); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wx-chip small { font-weight: 400; color: var(--muted); font-size: 11px; }

/* v56: iPhone Safari zooms in on any form field under 16px; fields inherited 12–13px from their labels. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
select,
textarea {
  font-size: 16px;
}

/* iPhone Safari draws date fields with its own centred, fixed-width control; make them behave like the other fields. */
input[type="date"],
input[type="datetime-local"],
input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  text-align: left;
}
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;
  margin: 0;
  /* WebKit bug 198959: with appearance:none the value box can collapse in height. */
  min-height: 1.5em;
  line-height: 1.5;
}

/* v57: money boxes stay 2×2 on phones (今日支出／剩餘預算／現金／ICOCA). */
@media (max-width: 900px) {
  .expense-mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .expense-mini-grid article { padding: 12px 14px; min-width: 0; }
  .expense-mini-grid p { font-size: 13px; }
  .expense-mini-grid strong { margin-top: 6px; font-size: 22px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
}

/* v57: add-expense buttons — icon in its own column so both buttons line up the same way. */
.expense-action-menu button:not(.secondary) {
  grid-template-columns: 32px minmax(0, 1fr);
  justify-content: stretch;
  justify-items: start;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  text-align: left;
}
.expense-action-menu button:not(.secondary) span { grid-row: 1 / 3; justify-self: center; }
.expense-action-menu button:not(.secondary) b,
.expense-action-menu button:not(.secondary) small { grid-column: 2; }

/* v59: Japanese note to show at a ticket counter */
.staff-note { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 10px 12px; }
.staff-note summary { cursor: pointer; font-weight: 800; color: var(--maple); }
.staff-note-text { margin-top: 8px; white-space: pre-wrap; background: #fff; color: var(--ink); border-radius: 10px; padding: 12px; font-size: 17px; line-height: 1.65; font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif; overflow-wrap: anywhere; }

/* AI receipt import (paste the AI's JSON, preview, append) */
.expense-action-menu button.ai-entry {
  grid-column: 1 / -1;
  min-height: 76px;
}

.ai-import-steps {
  margin: 0 0 10px;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  line-height: 1.5;
}

.ai-import-prompt {
  width: 100%;
  margin: 8px 0 12px;
  font-size: 12px;
  line-height: 1.45;
}

.ai-import-summary {
  margin: 0 0 12px;
  font-weight: 800;
}

.ai-import-form {
  display: grid;
  gap: 14px;
}

.ai-import-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.ai-import-row > .full,
.ai-import-row > .ai-import-include,
.ai-import-row > p,
.ai-import-row > ul,
.ai-import-row > legend {
  grid-column: 1 / -1;
}

.ai-import-row .field input,
.ai-import-row .field select {
  width: 100%;
  min-width: 0;
}

.ai-import-row.is-duplicate {
  border-color: var(--gold);
}

.ai-import-row.is-manual {
  opacity: 0.85;
  border-style: dashed;
}

.ai-import-include {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.ai-import-check {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ai-import-check.has-diff {
  color: var(--danger);
}

.ai-import-warnings {
  margin: 0;
  padding-left: 18px;
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 420px) {
  .ai-import-row {
    grid-template-columns: 1fr;
  }
}

/* Ledger page v62: yen-first overview, daily bars, colored shares, list grouped by day */
.ledger-overview { padding: 18px; }
/* v67: two equal columns, so a long day route can never squeeze the trip total; amounts never break mid-number. */
.ledger-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.ledger-totals p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 800; }
.ledger-totals strong { display: block; margin-top: 4px; color: var(--ink); font-size: 30px; line-height: 1.1; white-space: nowrap; }
.ledger-totals small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.ledger-today { min-width: 0; text-align: right; }
.ledger-today p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ledger-today strong { font-size: 24px; }
.ledger-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.ledger-chips span { padding: 5px 10px; border-radius: 999px; background: #f3eadc; color: var(--ink); font-size: 13px; font-weight: 700; }
.ledger-chips .balance-low, .ledger-chips .budget-over { background: #fbe4dc; color: var(--danger); }
/* v77: payment mix — full-width row under the totals on phones, the middle of three columns on wide screens. */
.ledger-today { order: 2; }
.ledger-mix { order: 3; grid-column: 1 / -1; min-width: 0; padding-top: 10px; border-top: 1px solid var(--line); }
.ledger-mix dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 6px 0 0; }
.ledger-mix dl div { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.ledger-mix dt { color: var(--muted); font-size: 13px; white-space: nowrap; }
.ledger-mix dd { margin: 0; color: var(--ink); font-size: 14px; font-weight: 800; white-space: nowrap; }
.ledger-mix dl div.is-separate { grid-column: 1 / -1; padding-top: 6px; border-top: 1px dashed var(--line); }
.ledger-mix dl div.is-separate dd { color: var(--muted); }
.balance-tile small.tile-note { display: block; margin-top: 2px; font-size: 11px; white-space: nowrap; }

.ledger-days h3, .ledger-shares h3 { margin: 0 0 10px; font-size: 18px; }
.day-bars { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; align-items: end; }
.day-bar { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 2px; min-width: 0; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.day-bar-value { height: 16px; overflow: hidden; white-space: nowrap; text-overflow: clip; font-size: 10px; }
.day-bar-track { position: relative; display: block; height: 96px; border-bottom: 2px solid var(--line); }
.day-bar-fill { position: absolute; left: 12%; right: 12%; bottom: 0; border-radius: 4px 4px 0 0; background: #d98a6c; }
.day-bar.is-today .day-bar-fill { background: var(--maple); }
.day-bar.is-today { color: var(--ink); font-weight: 800; }
.day-bar.is-negative .day-bar-track { border-bottom-color: var(--sage); }
.day-bar.is-negative .day-bar-value { color: var(--sage); }
.day-bar.active .day-bar-track { background: #fff1dc; border-radius: 4px 4px 0 0; }
.day-bar.active .day-bar-label { color: var(--maple); font-weight: 800; }
.day-bar-label { height: 18px; line-height: 18px; }
.day-bar:focus-visible { outline: 2px solid var(--maple); outline-offset: 2px; }

.ledger-share + .ledger-share { margin-top: 14px; }
.ledger-share-title { margin: 0 0 6px; color: var(--muted); font-size: 13px; font-weight: 800; }
.share-bar { display: flex; height: 10px; overflow: hidden; margin-bottom: 6px; border-radius: 999px; background: #f3eadc; }
.share-bar span { display: block; height: 100%; }
.share-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto 38px; gap: 8px; align-items: center; width: 100%; min-height: 34px; padding: 4px 6px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); font-size: 14px; text-align: left; }
.share-row b { font-size: 14px; white-space: nowrap; }
.share-row small { color: var(--muted); text-align: right; }
.share-row.active { border-color: var(--line); background: #fff1dc; }
.share-dot { width: 10px; height: 10px; border-radius: 999px; }

.link-button { min-height: 0; padding: 0 2px; border: 0; background: transparent; color: var(--maple); font-size: inherit; font-weight: 800; text-decoration: underline; }
.expense-toolbar .actions .active { border-color: var(--maple); background: #fff1dc; color: var(--maple); }

.ledger-groups { gap: 12px; }
.ledger-day { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.9); box-shadow: var(--shadow); }
.ledger-day-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; background: #f6ecdd; }
.ledger-day-head b { color: var(--ink); font-size: 15px; }
.ledger-day-head div:first-child span { display: block; color: var(--muted); font-size: 12px; }
.ledger-day-total { text-align: right; }
.ledger-day-total b { display: block; white-space: nowrap; }
.ledger-day-total small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; }
.ledger-entry { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; background: transparent; }
.ledger-entry summary { grid-template-columns: 36px minmax(0, 1fr) auto; }
.ledger-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; font-size: 14px; font-weight: 800; }
.ledger-entry-main { min-width: 0; }
.ledger-entry-main small { display: block; margin-top: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.ledger-entry-amount { text-align: right; }
.ledger-entry-amount b { display: block; font-size: 16px; white-space: nowrap; }
.ledger-entry-amount small { display: block; font-size: 12px; white-space: nowrap; }
.ledger-entry.is-refund { background: #f0f6f1; }

@media (max-width: 420px) {
  .ledger-totals strong { font-size: 26px; }
  .ledger-today strong { font-size: 20px; }
  .ledger-entry summary { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .day-bar-track { height: 80px; }
}
.ledger-share-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

/* v63: balance tiles, one-line day headers, two-column shares on wide screens */
.ledger-balances { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.balance-tile { min-width: 0; padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; }
.balance-tile span { display: block; font-size: 12px; font-weight: 800; }
.balance-tile strong { display: block; margin-top: 2px; overflow-wrap: anywhere; font-size: 20px; line-height: 1.2; }
.balance-tile { background: #f3eadc; color: var(--ink); }
.balance-tile span { color: var(--muted); }
.balance-tile small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.balance-tile.balance-low, .balance-tile.budget-over { border-color: var(--danger); background: #fbe4dc; color: var(--danger); }
.balance-tile.balance-low span, .balance-tile.balance-low small, .balance-tile.budget-over span, .balance-tile.budget-over small { color: var(--danger); }
.share-twd { white-space: nowrap; }
.ledger-day-head { flex-wrap: nowrap; padding: 9px 12px; }
.ledger-day-name { flex: 1 1 auto; min-width: 7.5em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ledger-day-name span { display: inline; color: var(--muted); font-size: 12px; }
.ledger-day-total { flex: 0 1 auto; min-width: 0; white-space: normal; text-align: right; }
.ledger-day-total b { display: inline; white-space: nowrap; }
.ledger-day-total small { display: inline-block; white-space: nowrap; }
@media (min-width: 720px) {
  .ledger-totals { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; }
  .ledger-mix { order: 0; grid-column: auto; padding: 0 0 0 24px; border-top: 0; border-left: 1px solid var(--line); }
  .ledger-mix dl { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 8px; }
  .ledger-mix dd { font-size: 16px; }
}
@media (min-width: 720px) {
  .ledger-share-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
  .ledger-share-grid .ledger-share + .ledger-share { margin-top: 0; }
}
@media (max-width: 420px) {
  .balance-tile { padding: 8px 9px; }
  .balance-tile strong { font-size: 16px; }
}

.report-link {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
}
.report-link > span:first-child { font-size: 22px; }
.report-link > span:nth-child(2) { flex: 1; min-width: 0; display: grid; }
.report-link small { color: var(--muted); font-size: 12px; }
.report-link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
