:root {
  --paper: #f5f0e5;
  --paper-deep: #ece4d4;
  --card: #fffdf7;
  --ink: #15343d;
  --ink-soft: #557078;
  --coral: #e85b3f;
  --moss: #1f6655;
  --sun: #efa72f;
  --line: #d8d0bf;
  --danger: #a9473b;
  --shadow: 0 18px 50px rgba(25, 48, 48, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(239, 167, 47, 0.08), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }
.page-wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 100px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 160px 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 78px;
  padding: 0 max(22px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(21, 52, 61, 0.13);
  background: rgba(245, 240, 229, 0.9);
  backdrop-filter: blur(18px);
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.brand-mark span { font-size: 12px; letter-spacing: .18em; font-weight: 900; }
.brand-mark b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--coral);
  color: white;
  font-size: 18px;
}
.desktop-nav { display: flex; justify-content: center; gap: 4px; }
.desktop-nav button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 10px 17px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-soft);
  cursor: pointer;
}
.desktop-nav button:hover, .desktop-nav button.active { background: var(--ink); color: white; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.identity-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 12px;
  font-weight: 800;
}
.identity-picker select { border: 0; outline: 0; background: transparent; color: var(--ink); font-weight: 900; max-width: 100px; }
.share-button, .text-button {
  border: 0;
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}
.share-button { padding: 11px 14px; border-radius: 999px; background: var(--coral); color: white; }
.text-button { color: var(--moss); padding: 8px 0; }
.text-button:hover { color: var(--coral); }

.eyebrow { margin: 0 0 9px; color: var(--coral); font-size: 11px; font-weight: 950; letter-spacing: .14em; text-transform: uppercase; }
.hero-grid { display: grid; grid-template-columns: 1.55fr .8fr; gap: 34px; align-items: stretch; padding: 26px 0 32px; }
.hero-copy { padding: 36px 0 22px; }
.hero-copy h1, .page-title-row h1 {
  margin: 0;
  letter-spacing: -.055em;
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  font-weight: 900;
}
.hero-copy h1 { font-size: clamp(52px, 7vw, 88px); line-height: .98; }
.hero-lead { max-width: 630px; margin: 25px 0 0; color: var(--ink-soft); font-size: 17px; line-height: 1.9; }
.hero-actions { display: flex; gap: 12px; margin-top: 30px; }
.primary-button, .secondary-button {
  min-height: 46px;
  padding: 0 20px;
  border-radius: 13px;
  border: 1px solid var(--ink);
  font-weight: 900;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.primary-button { background: var(--ink); color: white; box-shadow: 0 8px 24px rgba(21, 52, 61, .16); }
.secondary-button { background: transparent; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-2px); }
.primary-button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.countdown-card {
  position: relative;
  overflow: hidden;
  min-height: 370px;
  padding: 36px;
  border-radius: 30px;
  background: var(--moss);
  color: white;
  box-shadow: var(--shadow);
}
.countdown-card::after {
  content: "OSAKA";
  position: absolute;
  bottom: 16px;
  right: -13px;
  font-size: 62px;
  font-weight: 950;
  letter-spacing: -.06em;
  color: rgba(255,255,255,.07);
}
.sun-disc { position: absolute; width: 154px; height: 154px; right: -28px; top: -30px; border-radius: 50%; background: var(--sun); }
.countdown-card p { position: relative; margin: 72px 0 5px; font-size: 14px; font-weight: 900; letter-spacing: .15em; }
.countdown-card strong { position: relative; display: block; font-family: Georgia, serif; font-size: 132px; line-height: .9; letter-spacing: -.08em; }
.countdown-card > span { position: absolute; top: 178px; left: 228px; font-size: 28px; font-weight: 900; }
.countdown-card small { position: absolute; left: 38px; bottom: 34px; letter-spacing: .12em; font-weight: 800; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.metric-card { min-height: 148px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,253,247,.7); }
.metric-card.ink { background: var(--ink); color: white; border-color: var(--ink); }
.metric-card.highlight { background: #f4dca9; border-color: #e2c884; }
.metric-card p { margin: 0 0 18px; font-size: 12px; font-weight: 900; letter-spacing: .09em; }
.metric-card strong { display: block; font-family: Georgia, serif; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.04em; }
.metric-card strong i { font-family: inherit; font-size: .55em; font-style: normal; opacity: .55; }
.metric-card span { display: block; margin-top: 12px; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.metric-card.ink span { color: rgba(255,255,255,.62); }

.section-block, .view-section { padding-top: 72px; }
.section-heading, .page-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-heading h2, .subheading h2, .tool-card h2 { margin: 0; font-family: "Noto Serif TC", serif; font-size: 28px; letter-spacing: -.035em; }
.day-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 24px; }
.day-mini { position: relative; min-height: 235px; padding: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.day-mini::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--accent); }
.day-mini > div { display: flex; justify-content: space-between; align-items: center; }
.day-mini > div span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: white; font-weight: 900; font-size: 12px; }
.day-mini > div b { font-family: Georgia, serif; font-size: 16px; }
.day-mini > p { margin: 38px 0 8px; color: var(--coral); font-size: 11px; font-weight: 950; letter-spacing: .08em; }
.day-mini h3 { margin: 0; font-size: 19px; line-height: 1.45; }
.day-mini small { display: block; position: absolute; bottom: 21px; color: var(--ink-soft); line-height: 1.5; }
.flight-band { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 26px; margin-top: 52px; padding: 24px 28px; border-radius: 18px; background: var(--paper-deep); }
.flight-band > div:not(.flight-divider) { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.flight-band p { grid-column: 1 / -1; margin: 0 0 7px; color: var(--coral); font-size: 11px; font-weight: 900; }
.flight-band strong { font-family: Georgia, serif; font-size: 20px; }
.flight-band span { color: var(--coral); }
.flight-divider { padding: 9px 17px; border-radius: 999px; background: var(--ink); color: white; font-size: 11px; font-weight: 900; white-space: nowrap; }

.page-title-row { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.page-title-row h1 { font-size: clamp(44px, 6vw, 70px); }
.page-title-row > div > p:last-child { max-width: 670px; margin: 15px 0 0; color: var(--ink-soft); line-height: 1.8; }
.date-stamp { text-align: right; font-family: Georgia, serif; color: var(--coral); line-height: 1.1; }
.date-stamp b { font-size: 32px; color: var(--ink); }
.itinerary-list { display: grid; gap: 13px; margin-top: 26px; }
.day-detail { border: 1px solid var(--line); border-radius: 22px; background: var(--card); overflow: hidden; }
.day-detail summary { position: relative; display: grid; grid-template-columns: 58px 1fr auto; gap: 21px; align-items: center; padding: 25px 28px; list-style: none; cursor: pointer; }
.day-detail summary::-webkit-details-marker { display: none; }
.day-detail summary::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--accent); }
.day-number { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: white; font-weight: 950; }
.day-detail summary p { margin: 0 0 4px; color: var(--coral); font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.day-detail summary h2 { margin: 0; font-family: "Noto Serif TC", serif; font-size: 25px; letter-spacing: -.03em; }
.day-detail summary small { display: block; margin-top: 7px; color: var(--ink-soft); }
.day-detail summary i { font-size: 28px; font-style: normal; transition: transform .2s ease; }
.day-detail[open] summary i { transform: rotate(45deg); }
.day-detail-body { display: grid; grid-template-columns: 1.5fr .75fr; gap: 40px; padding: 8px 28px 32px 107px; }
.timeline-list { position: relative; }
.timeline-list::before { content: ""; position: absolute; left: 72px; top: 7px; bottom: 7px; width: 1px; background: var(--line); }
.timeline-row { position: relative; display: grid; grid-template-columns: 58px 12px 1fr; gap: 9px; align-items: start; min-height: 62px; }
.timeline-row time { font-family: Georgia, serif; font-weight: 900; }
.timeline-row > span { position: relative; z-index: 1; width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: var(--moss); box-shadow: 0 0 0 4px var(--card); }
.timeline-row.hard > span { background: var(--coral); width: 12px; height: 12px; }
.timeline-row b { font-size: 14px; }
.timeline-row p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.day-aside { align-self: start; padding: 22px; border-radius: 16px; background: var(--paper); }
.day-aside h3 { margin: 0 0 14px; font-size: 19px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 11px; font-weight: 800; }
.map-button { display: block; margin-top: 24px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--moss); font-size: 12px; font-weight: 900; }

.ledger-summary { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1px; overflow: hidden; margin-top: 26px; border-radius: 20px; background: var(--line); }
.ledger-summary > div { padding: 24px; background: var(--ink); color: white; }
.ledger-summary > div:first-child { background: var(--coral); }
.ledger-summary span { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 900; letter-spacing: .08em; opacity: .7; }
.ledger-summary strong { font-family: Georgia, serif; font-size: 32px; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 24px 0 16px; scrollbar-width: none; }
.filter-row button { white-space: nowrap; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer; font-weight: 800; font-size: 12px; }
.filter-row button.active { border-color: var(--moss); background: var(--moss); color: white; }
.expense-list { border-top: 1px solid var(--line); }
.expense-row { display: grid; grid-template-columns: 45px 1fr auto auto; gap: 18px; align-items: center; padding: 20px 4px; border-bottom: 1px solid var(--line); }
.category-badge { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--paper-deep); color: var(--coral); font-weight: 950; }
.expense-main > div { display: flex; gap: 11px; align-items: baseline; }
.expense-main span { color: var(--coral); font-size: 10px; font-weight: 900; }
.expense-main h3 { margin: 0; font-size: 17px; }
.expense-main p { margin: 7px 0 0; color: var(--ink-soft); font-size: 11px; }
.avatar-stack { display: flex; margin-top: 10px; }
.avatar-stack span { display: grid; place-items: center; width: 25px; height: 25px; margin-right: -6px; border: 2px solid var(--paper); border-radius: 50%; color: white; font-size: 10px; }
.expense-amount { min-width: 120px; text-align: right; }
.expense-amount strong { display: block; font-family: Georgia, serif; font-size: 22px; }
.expense-amount span { color: var(--ink-soft); font-size: 10px; }
.row-actions { display: flex; flex-direction: column; gap: 5px; }
.row-actions button { border: 0; background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }
.row-actions .danger { color: var(--danger); }
.empty-state, .mini-empty { text-align: center; }
.empty-state { padding: 75px 20px; border: 1px dashed var(--line); border-radius: 22px; background: rgba(255,255,255,.25); }
.empty-state > span { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 20px; border-radius: 50%; background: var(--sun); font-family: Georgia, serif; font-size: 30px; }
.empty-state h2 { margin: 0; font-family: "Noto Serif TC", serif; font-size: 28px; }
.empty-state p { max-width: 430px; margin: 10px auto 22px; color: var(--ink-soft); line-height: 1.7; }

.my-balance-card { display: grid; grid-template-columns: 1fr auto auto; gap: 20px; align-items: center; margin-top: 26px; padding: 26px 30px; border-radius: 20px; background: var(--moss); color: white; }
.my-balance-card.owe { background: var(--coral); }
.my-balance-card p { margin: 0; font-weight: 900; }
.my-balance-card strong { font-family: Georgia, "Noto Serif TC", serif; font-size: 32px; }
.my-balance-card span { padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 11px; }
.settlement-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; margin-top: 18px; }
.balance-board, .transfer-board { padding: 27px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); }
.subheading { margin-bottom: 24px; }
.balance-row { display: grid; grid-template-columns: 38px 90px 1fr 92px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(216,208,191,.65); }
.balance-row:last-child { border: 0; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: white; font-size: 12px; }
.balance-row b { font-size: 12px; }
.balance-track { height: 5px; overflow: hidden; border-radius: 99px; background: var(--paper-deep); }
.balance-track i { display: block; height: 100%; border-radius: 99px; background: var(--sun); }
.balance-row strong { text-align: right; font-family: Georgia, serif; font-size: 15px; }
.balance-row strong.positive { color: var(--moss); }
.balance-row strong.negative { color: var(--coral); }
.transfer-row { display: grid; grid-template-columns: 32px 1fr auto; gap: 13px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.transfer-row > span { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: var(--ink); color: white; font-size: 11px; }
.transfer-row div b, .transfer-row div small { display: block; }
.transfer-row div b { font-size: 13px; }
.transfer-row div small { margin-top: 3px; color: var(--ink-soft); }
.transfer-row strong { font-family: Georgia, serif; }
.mini-empty { padding: 52px 15px; color: var(--ink-soft); }
.mini-empty span { font-size: 44px; color: var(--moss); }

.tool-grid { display: grid; grid-template-columns: 1.4fr .6fr; gap: 15px; margin-top: 26px; }
.tool-card, .tool-section { border: 1px solid var(--line); border-radius: 22px; background: var(--card); }
.tool-card { min-height: 235px; padding: 27px; }
.stay-card { position: relative; overflow: hidden; background: var(--ink); color: white; }
.stay-card::after { content: "花園町"; position: absolute; right: -7px; bottom: -7px; font-family: "Noto Serif TC", serif; font-size: 63px; font-weight: 900; color: rgba(255,255,255,.05); }
.stay-card > p:not(.eyebrow) { max-width: 540px; color: rgba(255,255,255,.7); line-height: 1.7; }
.stay-card > small { color: rgba(255,255,255,.56); }
.stay-card > div { display: flex; gap: 10px; margin-top: 28px; }
.stay-card a, .stay-card button { position: relative; z-index: 1; padding: 10px 13px; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; background: transparent; color: white; cursor: pointer; font-size: 11px; font-weight: 900; }
.rate-card label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 24px; padding: 12px 14px; border-radius: 12px; background: var(--paper); font-size: 11px; font-weight: 900; }
.rate-card input { width: 82px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: right; font-weight: 900; }
.rate-card > div { display: flex; align-items: end; justify-content: space-between; margin-top: 18px; }
.rate-card > div strong { font-family: Georgia, serif; font-size: 22px; }
.rate-card > small { display: block; margin-top: 15px; color: var(--ink-soft); line-height: 1.5; }
.tool-section { margin-top: 16px; padding: 26px; }
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 20px; }
.quick-links a { display: grid; grid-template-columns: 34px 1fr auto; gap: 11px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); transition: border-color .18s ease, transform .18s ease; }
.quick-links a:hover { transform: translateY(-2px); border-color: var(--moss); }
.quick-links a > span { color: var(--coral); font-family: Georgia, serif; font-size: 11px; }
.quick-links b, .quick-links small { display: block; }
.quick-links b { font-size: 13px; }
.quick-links small { margin-top: 2px; color: var(--ink-soft); font-size: 10px; }
.quick-links i { font-style: normal; color: var(--moss); }
.tool-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.section-heading > span { display: grid; place-items: center; min-width: 52px; height: 32px; border-radius: 99px; background: var(--moss); color: white; font-size: 12px; font-weight: 900; }
.checklist-list { display: grid; gap: 8px; margin-top: 20px; }
.checklist-list label { display: grid; grid-template-columns: 25px 1fr; gap: 12px; align-items: center; padding: 11px 0; cursor: pointer; }
.checklist-list input { position: absolute; opacity: 0; }
.checklist-list label > span { width: 22px; height: 22px; border: 1.5px solid var(--line); border-radius: 7px; background: white; }
.checklist-list label.completed > span { position: relative; border-color: var(--moss); background: var(--moss); }
.checklist-list label.completed > span::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: white; font-size: 12px; }
.checklist-list small, .checklist-list b { display: block; }
.checklist-list small { color: var(--coral); font-size: 9px; font-weight: 900; }
.checklist-list b { margin-top: 3px; font-size: 12px; }
.checklist-list label.completed b { color: var(--ink-soft); text-decoration: line-through; }
.add-checklist { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.add-checklist input { min-width: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); outline: 0; }
.add-checklist button { padding: 0 15px; border: 0; border-radius: 10px; background: var(--ink); color: white; font-weight: 900; cursor: pointer; }
.phrase-panel button { display: grid; grid-template-columns: 80px 1fr auto; gap: 12px; width: 100%; padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.phrase-panel button span { color: var(--coral); font-size: 10px; font-weight: 900; }
.phrase-panel button b { font-size: 12px; }
.phrase-panel button i { color: var(--moss); font-size: 10px; font-style: normal; }
.section-heading small { color: var(--ink-soft); }
.people-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }
.people-grid button { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 11px 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); cursor: pointer; }
.people-grid span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: white; }
.people-grid b { overflow: hidden; width: 100%; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.group-panel { margin-top: 22px; }
.group-list { display: grid; gap: 9px; margin-bottom: 18px; }
.group-list article { display: grid; grid-template-columns: 36px 1fr auto auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.group-list article > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: white; font-weight: 900; }
.group-list article div { min-width: 0; }
.group-list article b, .group-list article small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-list article small { margin-top: 3px; color: var(--ink-soft); font-size: 10px; }
.group-list article button { border: 0; background: transparent; color: var(--moss); font-weight: 800; cursor: pointer; }
.group-list article button.danger { color: #a74838; }
.group-empty { margin: 0 0 16px; color: var(--ink-soft); }
.group-form { display: grid; grid-template-columns: 1fr 48px auto; gap: 10px; align-items: end; }
.group-form > input { min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: white; padding: 0 13px; }
.group-form > input[type="color"] { width: 48px; padding: 5px; }
.group-member-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.group-member-grid label { display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); cursor: pointer; font-size: 11px; font-weight: 800; }
.group-member-grid label.active { border-color: var(--moss); background: rgba(31,102,85,.08); box-shadow: inset 0 0 0 1px var(--moss); }
.group-member-grid input { position: absolute; opacity: 0; pointer-events: none; }
.group-member-grid span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: white; font-size: 10px; }

.mobile-nav { display: none; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: 30px; transform: translateX(-50%); padding: 13px 18px; border-radius: 999px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 12px; font-weight: 800; }
.modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(9, 29, 34, .58); backdrop-filter: blur(8px); }
.expense-modal { width: min(720px, 100%); max-height: calc(100vh - 38px); overflow-y: auto; border-radius: 25px; background: var(--paper); box-shadow: 0 30px 100px rgba(0,0,0,.25); }
.modal-handle { display: none; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 25px 28px 18px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-family: "Noto Serif TC", serif; font-size: 30px; }
.icon-button { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 24px; cursor: pointer; }
.expense-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 24px 28px 28px; }
.field { display: grid; gap: 7px; }
.field.wide, .split-field.wide, .modal-actions.wide { grid-column: 1 / -1; }
.field > span, .split-field legend { font-size: 11px; font-weight: 900; letter-spacing: .06em; }
.field input, .field select { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); outline: 0; color: var(--ink); }
.field input:focus, .field select:focus { border-color: var(--moss); box-shadow: 0 0 0 3px rgba(31,102,85,.1); }
.money-input { position: relative; }
.money-input b { position: absolute; left: 14px; top: 11px; font-family: Georgia, serif; font-size: 20px; }
.money-input input { padding-left: 36px; font-family: Georgia, serif; font-size: 22px; font-weight: 900; }
.split-field { min-width: 0; margin: 0; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); }
.split-heading { display: flex; justify-content: space-between; gap: 10px; }
.split-heading p { margin: 5px 0 0; color: var(--ink-soft); font-size: 10px; }
.participant-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.participant-chip { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; font-size: 11px; font-weight: 800; }
.participant-chip > span { display: grid; flex: 0 0 auto; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: white; font-size: 10px; }
.participant-chip.active { border-color: var(--moss); background: rgba(31,102,85,.08); box-shadow: inset 0 0 0 1px var(--moss); }
.currency-rate > div { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 10px; }
.currency-rate small { color: var(--ink-soft); font-size: 10px; }
.group-selector { margin-bottom: 12px; }
.group-selector > small { display: block; margin-bottom: 7px; color: var(--ink-soft); }
.group-selector > div { display: flex; flex-wrap: wrap; gap: 7px; }
.group-selector button { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: white; cursor: pointer; font-weight: 800; }
.group-selector button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--group); }
.group-selector button span { display: grid; place-items: center; min-width: 19px; height: 19px; border-radius: 99px; background: var(--cream); font-size: 9px; }
.group-selector button.active { border-color: var(--moss); color: var(--moss); background: rgba(31,102,85,.08); }
.expense-amount small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 9px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 5px; }

@media (max-width: 960px) {
  .topbar { grid-template-columns: auto 1fr; min-height: 68px; }
  .desktop-nav { display: none; }
  .top-actions { justify-self: end; }
  .page-wrap { width: min(100% - 28px, 760px); padding-top: 18px; padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
  .mobile-nav {
    position: fixed;
    z-index: 40;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: min(calc(100% - 24px), 520px);
    padding: 7px;
    transform: translate3d(-50%, 0, 0);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 20px;
    background: rgba(21,52,61,.96);
    box-shadow: 0 15px 40px rgba(0,0,0,.25);
    backdrop-filter: blur(15px);
    transition: transform .24s ease, opacity .2s ease;
    will-change: transform;
  }
  .mobile-nav.is-hidden { transform: translate3d(-50%, calc(100% + 32px + env(safe-area-inset-bottom)), 0); opacity: 0; pointer-events: none; }
  .mobile-nav button { display: grid; place-items: center; gap: 2px; min-height: 51px; border: 0; border-radius: 14px; background: transparent; color: rgba(255,255,255,.58); cursor: pointer; }
  .mobile-nav button b { font-family: Georgia, serif; font-size: 17px; }
  .mobile-nav button span { font-size: 9px; font-weight: 800; }
  .mobile-nav button.active { background: var(--coral); color: white; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .hero-grid { grid-template-columns: 1fr; }
  .countdown-card { min-height: 260px; }
  .countdown-card p { margin-top: 22px; }
  .countdown-card > span { top: 127px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .day-strip { grid-template-columns: repeat(5, 220px); overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; }
  .day-mini { scroll-snap-align: start; }
  .flight-band { grid-template-columns: 1fr; }
  .flight-divider { text-align: center; }
  .day-detail-body { grid-template-columns: 1fr; padding-left: 30px; }
  .day-aside { margin-left: 78px; }
  .settlement-grid, .tool-columns { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
}

@media (max-width: 660px) {
  .topbar { padding: 0 14px; }
  .brand-mark span, .share-button { display: none; }
  .brand-mark b { width: 31px; height: 31px; font-size: 16px; }
  .identity-picker { max-width: 180px; }
  .identity-picker select { max-width: 100px; }
  .page-wrap { width: calc(100% - 24px); }
  .hero-grid { gap: 14px; padding-top: 12px; }
  .hero-copy { padding: 20px 4px 6px; }
  .hero-copy h1 { font-size: 51px; }
  .hero-lead { margin-top: 19px; font-size: 14px; line-height: 1.75; }
  .hero-actions { margin-top: 22px; }
  .hero-actions button { flex: 1; padding: 0 10px; }
  .countdown-card { min-height: 225px; border-radius: 22px; padding: 26px; }
  .sun-disc { width: 120px; height: 120px; }
  .countdown-card p { margin-top: 10px; }
  .countdown-card strong { font-size: 102px; }
  .countdown-card > span { top: 111px; left: 173px; font-size: 22px; }
  .countdown-card small { left: 27px; bottom: 24px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 135px; padding: 17px; border-radius: 16px; }
  .metric-card p { margin-bottom: 14px; }
  .metric-card strong { font-size: 27px; }
  .metric-card span { font-size: 9px; }
  .section-block, .view-section { padding-top: 44px; }
  .section-heading h2 { font-size: 25px; }
  .section-heading .text-button { font-size: 11px; }
  .day-strip { grid-template-columns: repeat(5, 205px); margin-right: -12px; }
  .flight-band { gap: 15px; padding: 20px; }
  .flight-band strong { font-size: 17px; }
  .page-title-row { display: grid; align-items: start; }
  .page-title-row h1 { font-size: 45px; }
  .page-title-row .primary-button, .page-title-row .secondary-button { width: 100%; }
  .date-stamp { display: none; }
  .day-detail summary { grid-template-columns: 43px 1fr auto; gap: 12px; padding: 20px 17px; }
  .day-number { width: 40px; height: 40px; }
  .day-detail summary h2 { font-size: 19px; line-height: 1.4; }
  .day-detail summary small { font-size: 10px; }
  .day-detail-body { gap: 18px; padding: 3px 17px 24px; }
  .timeline-list::before { left: 59px; }
  .timeline-row { grid-template-columns: 46px 12px 1fr; }
  .day-aside { margin-left: 0; }
  .ledger-summary { grid-template-columns: 1fr 1fr; }
  .ledger-summary > div:first-child { grid-column: 1 / -1; }
  .expense-row { grid-template-columns: 40px 1fr auto; gap: 11px; }
  .category-badge { width: 38px; height: 38px; }
  .expense-main > div { display: block; }
  .expense-main h3 { margin-top: 3px; }
  .expense-amount { min-width: 86px; }
  .expense-amount strong { font-size: 18px; }
  .expense-amount span { display: none; }
  .row-actions { grid-column: 2 / -1; flex-direction: row; justify-content: flex-end; }
  .my-balance-card { grid-template-columns: 1fr auto; padding: 22px; }
  .my-balance-card strong { font-size: 25px; }
  .my-balance-card span { grid-column: 1 / -1; justify-self: start; }
  .balance-board, .transfer-board, .tool-card, .tool-section { padding: 20px; border-radius: 18px; }
  .balance-row { grid-template-columns: 34px 76px 1fr 80px; gap: 6px; }
  .balance-track { display: none; }
  .balance-row strong { grid-column: 3 / -1; }
  .quick-links { grid-template-columns: 1fr 1fr; }
  .tool-columns { gap: 0; }
  .people-grid { grid-template-columns: repeat(4, 1fr); }
  .group-form { grid-template-columns: 1fr 48px; }
  .group-form > button { grid-column: 1 / -1; }
  .group-member-grid { grid-template-columns: repeat(2, 1fr); }
  .group-list article { grid-template-columns: 34px 1fr auto; }
  .group-list article button.danger { grid-column: 3; }
  .toast { width: max-content; max-width: calc(100% - 30px); text-align: center; }
  .modal-backdrop { align-items: end; padding: 0; }
  .expense-modal { max-height: 92vh; border-radius: 24px 24px 0 0; }
  .modal-handle { display: block; width: 42px; height: 4px; margin: 9px auto 0; border-radius: 99px; background: var(--line); }
  .modal-header { padding: 16px 18px 14px; }
  .modal-header h2 { font-size: 25px; }
  .expense-form { grid-template-columns: 1fr 1fr; gap: 12px; padding: 18px; }
  .currency-rate > div { grid-template-columns: 1fr; }
  .participant-grid { grid-template-columns: 1fr 1fr; }
  .participant-chip { overflow: hidden; }
  .modal-actions { position: sticky; bottom: 0; padding: 12px 0 4px; background: var(--paper); }
  .modal-actions button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
