:root {
  color-scheme: light dark;
  --surface-base: #f2eee6;
  --surface-raised: #fbf8f2;
  --surface-overlay: rgba(251, 248, 242, 0.82);
  --surface-overlay-solid: #fbf8f2;
  --text-primary: #27231f;
  --text-secondary: #655f57;
  --text-muted: #70685f;
  --brand-accent: #aa4b30;
  --brand-on-accent: #fffaf4;
  --border-subtle: rgba(60, 49, 39, 0.11);
  --border-strong: rgba(60, 49, 39, 0.22);
  --success: #477b58;
  --warning: #9a6a2e;
  --destructive: #b4473b;
  --glass-fill: rgba(247, 243, 235, 0.74);
  --scrim: rgba(34, 29, 24, 0.36);
  --shadow-color: rgba(54, 43, 34, 0.1);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --safe-top: max(52px, env(safe-area-inset-top));
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-base: #1d1b18;
    --surface-raised: #27241f;
    --surface-overlay: rgba(39, 36, 31, 0.84);
    --surface-overlay-solid: #27241f;
    --text-primary: #eee8de;
    --text-secondary: #b9b0a4;
    --text-muted: #938b82;
    --brand-accent: #dc7a52;
    --brand-on-accent: #211713;
    --border-subtle: rgba(238, 232, 222, 0.11);
    --border-strong: rgba(238, 232, 222, 0.23);
    --success: #7da889;
    --warning: #c49a5b;
    --destructive: #df776d;
    --glass-fill: rgba(34, 31, 27, 0.76);
    --scrim: rgba(0, 0, 0, 0.52);
    --shadow-color: rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--text-primary);
  background: #2c2823;
  -webkit-font-smoothing: antialiased;
}

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

button {
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--brand-accent);
  outline-offset: 2px;
}

.stage {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: auto;
  justify-content: center;
  align-items: center;
  gap: clamp(48px, 8vw, 120px);
  padding: 36px;
}

.phone-frame {
  position: relative;
  width: 430px;
  height: min(932px, calc(100dvh - 48px));
  min-height: 690px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 58px;
  background: linear-gradient(145deg, #5e5a55, #1c1a18 22%, #090807 65%, #45413c);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 49px;
  background: var(--surface-base);
}

.dynamic-island {
  position: absolute;
  z-index: 60;
  top: 14px;
  left: 50%;
  width: 126px;
  height: 36px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #000;
}

.hardware-button {
  position: absolute;
  width: 4px;
  border-radius: 3px;
  background: #292622;
}

.volume-up {
  left: -4px;
  top: 176px;
  height: 64px;
}

.volume-down {
  left: -4px;
  top: 252px;
  height: 64px;
}

.power {
  right: -4px;
  top: 212px;
  height: 92px;
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--surface-base);
}

.boot-screen {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
}

.boot-screen img {
  border-radius: 16px;
}

.boot-screen strong {
  margin-top: 6px;
  font-size: 21px;
}

.boot-screen span {
  color: var(--text-muted);
  font-size: 13px;
}

.app-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--surface-base);
}

.topbar {
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: var(--safe-top) 18px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--glass-fill);
  backdrop-filter: saturate(125%) blur(22px);
  -webkit-backdrop-filter: saturate(125%) blur(22px);
}

.topbar-copy {
  min-width: 0;
}

.topbar-context {
  display: block;
  max-width: 260px;
  margin-bottom: 3px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.icon-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.icon-button svg,
.nav-button svg,
.fab svg,
.action-row svg {
  width: 20px;
  height: 20px;
}

.view {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding-bottom: 118px;
}

.view::-webkit-scrollbar {
  display: none;
}

.view-enter {
  animation: enter 180ms ease-out;
}

@keyframes enter {
  from {
    opacity: 0.4;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.bottom-nav {
  position: absolute;
  z-index: 35;
  right: 12px;
  bottom: calc(var(--safe-bottom) - 5px);
  left: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  min-height: 70px;
  padding: 7px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: var(--glass-fill);
  box-shadow: 0 14px 36px var(--shadow-color);
  backdrop-filter: saturate(130%) blur(26px);
  -webkit-backdrop-filter: saturate(130%) blur(26px);
}

.nav-button {
  display: flex;
  height: 54px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--text-muted);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.nav-button.active {
  border-color: var(--border-subtle);
  color: var(--text-primary);
  background: var(--surface-raised);
  font-weight: 650;
}

.nav-spacer {
  pointer-events: none;
}

.fab {
  position: absolute;
  z-index: 42;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 1px);
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  transform: translateX(-50%);
  border: 3px solid var(--surface-base);
  border-radius: 50%;
  color: var(--brand-on-accent);
  background: var(--brand-accent);
  box-shadow: 0 10px 24px var(--shadow-color);
  cursor: pointer;
}

.fab:active {
  transform: translateX(-50%) scale(0.96);
}

.content-pad {
  padding: 14px 14px 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 4px 2px 8px;
}

.section-heading.action-only {
  justify-content: flex-end;
}

.route-heading-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.text-button,
.filter-chip {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border: 0;
  color: var(--brand-accent);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.filter-chip {
  padding: 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-raised);
}

.journey-summary {
  position: relative;
  padding: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  box-shadow: none;
}

.journey-heading span {
  color: var(--text-secondary);
  font-size: 12px;
}

.journey-heading h2 {
  max-width: 270px;
  margin: 6px 0 22px;
  overflow: hidden;
  font-size: 27px;
  line-height: 1.12;
  letter-spacing: -0.045em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journey-day {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 6px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-secondary);
  background: var(--surface-base);
  font-size: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.summary-grid div {
  min-width: 0;
}

.summary-grid strong {
  display: block;
  overflow: hidden;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-grid span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.feed-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  margin: 6px 2px 0;
}

.feed-filter strong {
  font-size: 17px;
}

.post-card {
  position: relative;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  scroll-margin-top: 110px;
}

.post-card.flash {
  animation: flash 800ms ease;
}

@keyframes flash {
  20% {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 16%, transparent);
  }
}

.post-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.post-meta {
  min-width: 0;
}

.post-meta strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-meta span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.post-text {
  margin: 13px 0 0;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.photo-grid {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 12px;
}

.photo-grid.one {
  grid-template-columns: 1fr;
}

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

.photo-grid.many > :first-child:nth-last-child(3) {
  grid-row: span 2;
}

.photo-grid img,
.photo-fallback {
  display: block;
  width: 100%;
  height: 128px;
  background: var(--surface-base);
}

.photo-grid img {
  object-fit: cover;
}

.photo-fallback {
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
}

.photo-grid.one img,
.photo-grid.one .photo-fallback {
  height: 225px;
}

.post-location {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 0;
  color: var(--brand-accent);
  font-size: 12px;
}

.post-location svg {
  width: 14px;
  height: 14px;
}

.addendum {
  margin: 11px 0 0;
  padding: 10px 11px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-secondary);
  background: var(--surface-base);
  font-size: 12px;
  line-height: 1.55;
}

.linked-expense {
  display: inline-flex;
  margin-top: 10px;
  padding: 6px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
  background: var(--surface-base);
  font-size: 12px;
}

.post-foot {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 8px;
}

.post-foot button {
  min-width: 44px;
  min-height: 44px;
  padding: 5px 8px;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.post-foot button:last-child {
  color: var(--destructive);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 230px;
  padding: 34px;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 5px;
  font-size: 17px;
}

.empty-state p {
  max-width: 230px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.empty-action {
  min-width: 118px;
  margin-top: 18px;
}

.route-map {
  position: relative;
  height: 300px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
}

.route-map svg {
  position: absolute;
  z-index: 1;
  inset: 18px;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
}

.route-line {
  fill: none;
  stroke: var(--brand-accent);
  stroke-width: 1.8;
  stroke-dasharray: 4 3;
  stroke-linecap: round;
}

.route-node {
  fill: var(--surface-raised);
  stroke: var(--brand-accent);
  stroke-width: 1.4;
}

.route-node.has-post {
  fill: var(--brand-accent);
}

.map-pin {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  cursor: pointer;
}

.map-pin-dot {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 2px solid var(--surface-raised);
  border-radius: 50%;
  color: var(--brand-on-accent);
  background: var(--brand-accent);
  box-shadow: 0 5px 14px var(--shadow-color);
  font-size: 12px;
  font-weight: 750;
}

.map-pin.no-post .map-pin-dot {
  width: 18px;
  height: 18px;
  color: transparent;
  background: var(--surface-base);
  box-shadow: none;
  outline: 1px solid var(--brand-accent);
}

.map-pin-label {
  position: absolute;
  top: 40px;
  left: 50%;
  width: max-content;
  max-width: 132px;
  overflow: hidden;
  transform: translateX(-50%);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-pin-label.align-start {
  left: 0;
  transform: none;
}

.map-pin-label.align-end {
  right: 0;
  left: auto;
  transform: none;
}

.map-pin.no-post .map-pin-label {
  top: 34px;
  color: var(--text-secondary);
}

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

.route-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.route-order {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.route-copy {
  min-width: 0;
}

.route-copy strong,
.route-copy span {
  display: block;
}

.route-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-copy span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.route-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 44px 44px 1fr 1fr;
  gap: 6px;
}

.route-actions button,
.expense-actions button {
  min-height: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-secondary);
  background: var(--surface-base);
  font-size: 12px;
  cursor: pointer;
}

.route-actions button:last-child,
.expense-actions button:last-child {
  color: var(--destructive);
}

.route-actions button:disabled {
  opacity: 0.35;
  cursor: default;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 12px;
}

.metric-card {
  min-height: 126px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.metric-card.primary {
  border-color: var(--border-strong);
}

.metric-card > span {
  color: var(--text-secondary);
  font-size: 12px;
}

.metric-card > strong {
  display: block;
  margin: 16px 0 4px;
  overflow: hidden;
  font-size: clamp(18px, 6vw, 24px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card .metric-empty {
  font-size: 18px;
}

.metric-card small {
  color: var(--text-muted);
  font-size: 12px;
}

.progress {
  height: 5px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-base);
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-accent);
}

.category-bars {
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.category-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 9px;
  align-items: center;
  margin: 10px 0;
  font-size: 12px;
}

.category-row > span {
  color: var(--text-secondary);
}

.category-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-base);
}

.category-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-accent);
}

.expense-list {
  margin-top: 15px;
}

.expense-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.expense-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: var(--brand-accent);
  background: var(--surface-base);
  font-size: 12px;
  font-weight: 700;
}

.expense-copy {
  min-width: 0;
}

.expense-copy strong,
.expense-copy span {
  display: block;
}

.expense-copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-copy span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.expense-amount {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.expense-actions {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 12px 14px 4px;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--surface-raised);
}

.segmented button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.segmented button.active {
  border-color: var(--border-subtle);
  color: var(--text-primary);
  background: var(--surface-base);
  font-weight: 650;
}

.kit-progress {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.ring {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: conic-gradient(var(--brand-accent) var(--progress), var(--surface-base) 0);
}

.ring::after {
  content: attr(data-value);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-raised);
  font-size: 12px;
  font-weight: 700;
}

.kit-progress strong,
.kit-progress span {
  display: block;
}

.kit-progress strong {
  font-size: 14px;
}

.kit-progress span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.quick-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
}

.quick-add input {
  height: 46px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  color: var(--text-primary);
  background: var(--surface-raised);
}

.quick-add button,
.primary-button {
  border: 0;
  border-radius: 13px;
  color: var(--brand-on-accent);
  background: var(--brand-accent);
  font-weight: 700;
  cursor: pointer;
}

.quick-add button {
  width: 48px;
}

.check-group {
  margin: 14px 0;
}

.check-group h3 {
  margin: 0 3px 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 50px;
  padding: 0 4px 0 9px;
  border-bottom: 1px solid var(--border-subtle);
}

.check-control {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  min-height: 50px;
  align-items: center;
  font-size: 13px;
}

.check-control input {
  width: 24px;
  height: 24px;
  margin: 0;
  justify-self: center;
  accent-color: var(--brand-accent);
}

.check-row.done .check-control {
  color: var(--text-muted);
  text-decoration: line-through;
}

.delete-mini {
  min-width: 50px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  color: var(--destructive);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.memo-grid {
  display: grid;
  gap: 10px;
}

.memo-card {
  position: relative;
  min-height: 130px;
  padding: 15px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.memo-card.pinned {
  border-color: var(--border-strong);
}

.memo-card .pin {
  color: var(--brand-accent);
  font-size: 12px;
  font-weight: 650;
}

.memo-card h3 {
  margin: 8px 0;
  font-size: 15px;
}

.memo-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.memo-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 12px;
}

.memo-actions button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.memo-actions button:last-child {
  color: var(--destructive);
}

.modal-layer {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 8px;
  background: var(--scrim);
  animation: fade 150ms ease-out;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.sheet {
  width: 100%;
  max-height: calc(100% - 22px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 15px calc(15px + var(--safe-bottom));
  border: 1px solid var(--border-strong);
  border-radius: 28px;
  background: var(--surface-overlay);
  box-shadow: 0 -18px 56px var(--shadow-color);
  backdrop-filter: saturate(125%) blur(28px);
  -webkit-backdrop-filter: saturate(125%) blur(28px);
  animation: sheet-up 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  scrollbar-width: none;
}

.sheet::-webkit-scrollbar {
  display: none;
}

@keyframes sheet-up {
  from {
    transform: translateY(28px);
    opacity: 0.55;
  }
}

.sheet-grabber {
  width: 38px;
  height: 4px;
  margin: 1px auto 13px;
  border-radius: 99px;
  background: var(--border-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.04em;
}

.close-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-secondary);
  background: var(--surface-raised);
  cursor: pointer;
}

.action-sheet {
  padding-top: 12px;
}

.action-sheet h2 {
  margin: 6px 8px 14px;
  font-size: 21px;
}

.action-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 0 11px;
  border: 0;
  border-top: 1px solid var(--border-subtle);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

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

.action-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  color: var(--brand-accent);
  background: var(--surface-raised);
}

.action-row strong {
  display: block;
  font-size: 14px;
}

.action-row > em {
  color: var(--text-muted);
  font-style: normal;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  color: var(--text-secondary);
  font-size: 12px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  color: var(--text-primary);
  background: var(--surface-raised);
  outline: none;
}

.field input,
.field select {
  height: 47px;
  padding: 0 12px;
}

.field textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--brand-accent);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.amount-input {
  position: relative;
}

.amount-input::before {
  content: "¥";
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 18px;
}

.amount-input input {
  height: 58px;
  padding-left: 35px;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.photo-picker {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  color: var(--text-secondary);
  background: var(--surface-raised);
  text-align: center;
  cursor: pointer;
}

.photo-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.photo-picker strong,
.photo-picker small {
  display: block;
}

.photo-picker strong {
  color: var(--text-primary);
  font-size: 12px;
}

.photo-picker small {
  margin-top: 3px;
  font-size: 12px;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 10px;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item button {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: rgba(0, 0, 0, 0.72);
  font-size: 12px;
  cursor: pointer;
}

.preview-item button::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.primary-button {
  min-height: 48px;
  padding: 0 18px;
}

.primary-button:disabled {
  cursor: progress;
  opacity: 0.62;
}

.secondary-button,
.danger-button {
  min-height: 45px;
  padding: 0 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-primary);
  background: var(--surface-raised);
  cursor: pointer;
}

.danger-button {
  color: var(--destructive);
}

.form-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.settings-card {
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.settings-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.settings-actions button,
.file-button {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  padding: 0 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  color: var(--text-primary);
  background: var(--surface-base);
  font-size: 12px;
  cursor: pointer;
}

.settings-actions button:disabled {
  color: var(--text-muted);
  cursor: default;
  opacity: 0.62;
}

.file-button {
  position: relative;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.danger-zone {
  border-color: color-mix(in srgb, var(--destructive) 35%, var(--border-subtle));
}

.privacy-toggle {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
}

.privacy-toggle input {
  width: 42px;
  height: 24px;
  accent-color: var(--brand-accent);
}

/* Mature interaction pass: denser content, explicit actions, and resilient sheets. */
.fab {
  width: 76px;
  border-width: 2px;
  border-radius: 999px;
  gap: 4px;
  grid-template-columns: auto auto;
  padding: 0 11px;
}

.fab svg {
  width: 17px;
  height: 17px;
}

.fab span {
  font-size: 12px;
  font-weight: 700;
}

.journey-summary {
  padding: 16px 17px 14px;
  border-radius: var(--radius-lg);
}

.journey-heading h2 {
  margin: 4px 0 12px;
  font-size: 23px;
}

.summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.summary-line span + span {
  position: relative;
}

.summary-line span + span::before {
  content: "·";
  position: absolute;
  left: -9px;
  color: var(--text-muted);
}

.feed-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px auto;
  gap: 7px;
  margin: -2px 0 14px;
}

.feed-search input,
.feed-search button {
  min-width: 0;
  height: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-primary);
  background: var(--surface-raised);
}

.feed-search input {
  padding: 0 10px;
}

.feed-search button {
  padding: 0 12px;
  color: var(--brand-accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.post-head {
  align-items: start;
}

.photo-button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.context-menu {
  position: relative;
  justify-self: end;
}

.context-menu > summary {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin: -10px -8px -10px 0;
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  list-style: none;
}

.context-menu > summary::-webkit-details-marker {
  display: none;
}

.context-menu[open] > summary {
  background: var(--surface-base);
}

.context-menu-popover {
  position: absolute;
  z-index: 12;
  top: 38px;
  right: 0;
  display: grid;
  min-width: 116px;
  padding: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: var(--surface-overlay-solid);
  box-shadow: 0 12px 28px var(--shadow-color);
}

.context-menu:not([open]) > .context-menu-popover {
  display: none;
}

.context-menu-popover button {
  min-height: 44px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  text-align: left;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.context-menu-popover button:hover,
.context-menu-popover button:focus-visible {
  background: var(--surface-base);
}

.destructive-text {
  color: var(--destructive) !important;
}

.section-heading > div:first-child {
  min-width: 0;
}

.section-note {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.labeled-action {
  padding: 0 4px;
  white-space: nowrap;
}

.route-heading-actions {
  gap: 8px;
}

.route-page .section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.route-timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin: 6px 0 12px;
}

.route-timeline::before {
  content: "";
  position: absolute;
  top: 30px;
  bottom: 30px;
  left: 26px;
  width: 1px;
  background: var(--border-strong);
}

.route-timeline .route-row {
  position: relative;
  grid-template-columns: 38px minmax(0, 1fr);
  margin: 0;
  padding: 10px 9px 10px 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.route-timeline .route-row + .route-row {
  border-top: 1px solid var(--border-subtle);
}

.route-order {
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--brand-accent);
  background: var(--surface-base);
  font-weight: 750;
}

button.route-copy {
  min-height: 48px;
  padding: 0;
  border: 0;
  color: var(--text-primary);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.route-actions {
  grid-column: 2;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card.over-budget {
  border-color: color-mix(in srgb, var(--destructive) 46%, var(--border-subtle));
}

.metric-card.over-budget > span,
.metric-card.over-budget > strong {
  color: var(--destructive);
}

.metric-card.over-budget .progress i {
  background: var(--destructive);
}

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

.expense-menu {
  grid-column: auto;
}

.kit-progress.compact {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  min-height: 0;
  padding: 11px 13px;
}

.kit-progress.compact .progress {
  margin-top: 5px;
}

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

.quick-add button {
  width: auto;
  min-width: 64px;
  padding: 0 14px;
}

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

.completed-section {
  margin-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.completed-section > summary {
  min-height: 48px;
  padding: 0 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  line-height: 48px;
}

.completed-section > summary span {
  float: right;
  color: var(--text-muted);
  font-weight: 400;
}

.completed-section[open] > summary span {
  font-size: 0;
}

.completed-section[open] > summary span::after {
  content: "收起";
  font-size: 12px;
}

.completed-items {
  margin-top: 0;
}

.memo-card {
  min-height: 0;
}

.memo-card > header {
  display: flex;
  min-height: 20px;
  align-items: center;
  justify-content: space-between;
}

.memo-card h3 {
  margin-top: 4px;
}

.memo-card footer {
  gap: 8px;
}

.memo-stage {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  color: var(--brand-accent);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.memo-stage svg {
  width: 13px;
  height: 13px;
}

.action-row small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.sheet-actions {
  position: sticky;
  z-index: 8;
  bottom: calc(-15px - var(--safe-bottom));
  display: grid;
  margin: 4px -15px calc(-15px - var(--safe-bottom));
  padding: 10px 15px calc(15px + var(--safe-bottom));
  border-top: 1px solid var(--border-subtle);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--surface-overlay-solid) 88%, transparent), var(--surface-overlay-solid) 22%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.sheet-actions.split {
  grid-template-columns: 1fr 1.35fr;
  gap: 8px;
}

.danger-button.filled {
  border-color: var(--destructive);
  color: white;
  background: var(--destructive);
  font-weight: 700;
}

.preview-item {
  overflow: visible;
  margin-bottom: 31px;
}

.preview-item img {
  overflow: hidden;
  border-radius: 10px;
}

.preview-actions {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  display: grid;
  width: 100%;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.preview-actions button {
  position: static;
  width: auto;
  height: 28px;
  border-radius: 7px;
  color: var(--text-secondary);
  background: var(--surface-raised);
  font-size: 12px;
}

.preview-actions button:last-child {
  color: var(--destructive);
}

.preview-actions button:disabled {
  opacity: 0.3;
}

.preview-actions button::before {
  display: none;
}

.photo-sheet {
  height: calc(100% - 22px);
  max-height: calc(100% - 22px);
  background: #171512;
}

.photo-sheet .sheet-head {
  color: #f7f1e8;
}

.photo-viewer {
  display: grid;
  min-height: calc(100% - 76px);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.photo-viewer img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.photo-viewer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.photo-viewer-actions button {
  min-height: 46px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  color: #f7f1e8;
  background: rgba(255,255,255,.08);
}

.photo-viewer-actions button:disabled {
  opacity: .35;
}

.snapshot-summary {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-base);
}

.snapshot-summary strong {
  font-size: 13px;
}

.snapshot-summary span,
.snapshot-summary small,
.snapshot-summary p {
  color: var(--text-secondary);
  font-size: 12px;
}

.snapshot-summary small {
  color: var(--text-muted);
}

.snapshot-summary p {
  margin: 6px 0 0;
  line-height: 1.55;
}

.restore-button {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  color: var(--brand-accent);
  background: var(--surface-base);
  cursor: pointer;
}

.restore-button:disabled {
  color: var(--text-muted);
  cursor: default;
  opacity: .62;
}

.restore-confirm {
  display: grid;
  gap: 12px;
}

.warning-copy {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.65;
}

.status-line {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 650;
}

.status-line.ready {
  color: var(--success);
}

.status-line.error {
  color: var(--destructive);
}

.status-card small {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 420px) {
  .feed-search {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .feed-search input[type="date"] {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .route-heading-actions {
    display: grid;
    justify-items: end;
    gap: 0;
  }
}

.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: calc(82px + var(--safe-bottom));
  max-width: min(330px, calc(100% - 32px));
  padding: 10px 14px;
  transform: translate(-50%, 18px);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-primary);
  background: var(--surface-overlay);
  box-shadow: 0 12px 32px var(--shadow-color);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
  font-size: 12px;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.privacy-curtain {
  position: fixed;
  z-index: 250;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 13px;
  color: var(--text-primary);
  background: var(--surface-overlay-solid);
}

.privacy-curtain[hidden] {
  display: none;
}

.privacy-curtain img {
  border-radius: 16px;
}

.privacy-curtain button {
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text-secondary);
  background: var(--surface-raised);
  cursor: pointer;
}

@media (max-width: 850px) {
  body {
    overflow: hidden;
    background: var(--surface-base);
  }

  .stage {
    display: block;
    min-height: 100dvh;
    padding: 0;
  }

  .hardware-button,
  .dynamic-island {
    display: none;
  }

  .phone-frame {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  .phone-screen {
    border-radius: 0;
  }

  .toast {
    bottom: calc(82px + var(--safe-bottom));
  }
}

@media (max-width: 360px) {
  .field-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .journey-day {
    position: static;
    display: inline-flex;
    margin-bottom: 16px;
  }

  .journey-heading h2 {
    margin-bottom: 10px;
  }

  .summary-grid {
    gap: 7px;
  }
}

@media (max-height: 760px) and (min-width: 851px) {
  .phone-frame {
    width: 342px;
    min-height: 650px;
    border-radius: 48px;
  }

  .phone-screen {
    border-radius: 40px;
  }

  .stage {
    gap: 60px;
  }
}

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

  .fab:active {
    transform: translateX(-50%);
  }
}

@media (prefers-contrast: more) {
  :root {
    --text-secondary: #49433d;
    --text-muted: #5c554d;
    --border-subtle: rgba(39, 31, 25, 0.32);
    --border-strong: rgba(39, 31, 25, 0.58);
  }

  .nav-button.active,
  .segmented button.active,
  .route-row,
  .post-card,
  .expense-row {
    border-width: 2px;
  }
}

@media (prefers-color-scheme: dark) and (prefers-contrast: more) {
  :root {
    --text-secondary: #ddd5ca;
    --text-muted: #c0b6aa;
    --border-subtle: rgba(255, 248, 238, 0.32);
    --border-strong: rgba(255, 248, 238, 0.58);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .bottom-nav,
  .sheet,
  .toast {
    background: var(--surface-overlay-solid);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .modal-layer {
    background: color-mix(in srgb, var(--surface-base) 92%, black);
  }
}
