:root {
  --paper: #f3ead8;
  --paper-deep: #e7dcc4;
  --card: #fbf6ec;
  --ink: #2c261d;
  --ink-soft: #5e5548;
  --muted: #8a7f6e;
  --rule: #dfd2b8;
  --rule-strong: #cbbfa4;
  --seal: #b54a3c;
  --seal-deep: #8e342a;
  --moss: #3d6a52;
  --moss-soft: #dce8e0;
  --navy: #3a4a5e;
  --gold: #c4a35a;
  --shadow: 0 10px 28px rgba(70, 52, 24, 0.08);
  --serif: "Noto Serif TC", "Songti TC", serif;
  --sans: "Noto Sans TC", "PingFang HK", "Hiragino Sans CNS", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Kill horizontal overflow / shrink-to-fit bounce on mobile itemized edit */
html, body, .notebook, .page, #charges-list, .charge-card {
  max-width: 100%;
  overflow-x: hidden;
}
.item-grid, .person-items, .item-line, .payers-editor, .payer-row {
  max-width: 100%;
  min-width: 0;
}
.item-line input, .payer-row input, .payer-row select {
  min-width: 0;
  max-width: 100%;
}
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff8ea 0%, transparent 50%),
    linear-gradient(180deg, #d9c9a8 0%, #cbb897 100%);
  min-height: 100vh;
  line-height: 1.55;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}
button { cursor: pointer; }
input, select, textarea {
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 0.42rem 0.55rem;
  font-size: 0.92rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(181, 74, 60, 0.28);
  border-color: var(--seal);
}
input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--moss);
  cursor: pointer;
}

.notebook {
  display: flex;
  max-width: 1280px;
  margin: 1.4rem auto 0.6rem;
  background: var(--paper);
  border-radius: 6px 14px 14px 6px;
  box-shadow:
    var(--shadow),
    inset 0 0 0 1px rgba(255,255,255,0.45);
  min-height: calc(100vh - 5.2rem);
  position: relative;
}
.notebook::before {
  content: "";
  position: absolute;
  inset: 0 0 0 22px;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 27px,
    rgba(196, 163, 90, 0.07) 28px
  );
  pointer-events: none;
  border-radius: inherit;
}

.binding {
  width: 22px;
  flex: 0 0 22px;
  background:
    repeating-linear-gradient(
      180deg,
      #7a2d26 0 10px,
      #8e342a 10px 22px,
      #5e211c 22px 24px
    );
  border-radius: 6px 0 0 6px;
  box-shadow: inset -4px 0 8px rgba(0,0,0,0.18);
}

.page {
  flex: 1;
  padding: 1.35rem 1.6rem 1.1rem;
  position: relative;
  z-index: 1;
}

.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: end;
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 0.85rem;
}
.brand-kana {
  margin: 0;
  letter-spacing: 0.28em;
  font-size: 0.68rem;
  color: var(--muted);
}
.masthead h1 {
  font-family: var(--serif);
  font-size: 2.05rem;
  margin: 0.1rem 0 0;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.trip-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.trip-name {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  border: none;
  border-bottom: 1px dashed var(--rule-strong);
  border-radius: 0;
  background: transparent;
  padding: 0.2rem 0;
  min-width: 16rem;
}
.masthead-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 34rem;
}
.drive-status { width: 100%; text-align: right; }
.masthead-actions .btn { font-size: 0.8rem; padding: 0.36rem 0.68rem; }

.btn {
  border: 1px solid var(--ink);
  background: var(--card);
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.sm { padding: 0.28rem 0.6rem; font-size: 0.8rem; }
.btn.ghost { background: transparent; border-color: var(--rule-strong); color: var(--ink-soft); }
.btn.ink { background: var(--navy); color: #f7f1e4; border-color: var(--navy); }
.btn.seal { background: var(--seal); color: #fff8f2; border-color: var(--seal-deep); }
.btn.icon {
  width: 1.7rem; height: 1.7rem; padding: 0;
  display: inline-flex; align-items: center; justify-content: flex-end;
  border-radius: 50%;
  line-height: 1;
}
.btn.danger { color: var(--seal); border-color: #e0b8b0; background: #fff6f3; }

.checklist {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0 0.3rem;
  flex-wrap: wrap;
}
.checklist-title {
  font-family: var(--serif);
  font-size: 0.95rem;
  margin: 0;
  min-width: 3.5rem;
}
.checklist-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}
.checklist-tools {
  display: flex;
  justify-content: flex-end;
  margin: 0.15rem 0 0.35rem;
}
.check-item {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.45rem 0.7rem;
  align-items: center;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--rule);
  background: #fffaf0;
  border-radius: 8px;
}
.check-item.is-done {
  background: var(--moss-soft);
  border-color: #b7cfc0;
  color: var(--moss);
}
.check-item-lab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}
.check-notes {
  width: 100%;
  background: #fffdf8;
  border: 1px dashed var(--rule-strong);
  border-radius: 6px;
  padding: 0.22rem 0.45rem;
  font-size: 0.84rem;
}

.cloud-reload-bar {
  position: sticky;
  top: 0;
  z-index: 16;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0 0;
  padding: 0.3rem 0;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
}
.cloud-reload-bar .btn { flex: 0 0 auto; }
#btn-reload-cloud {
  background: var(--moss) !important;
  border-color: color-mix(in srgb, var(--moss) 70%, #1a1a1a) !important;
  color: #f4faf6 !important;
}
.cloud-log-row {
  display: grid;
  grid-template-columns: 7.8rem 1fr;
  gap: 0.05rem 0.55rem;
  padding: 0.32rem 0.1rem;
  border-bottom: 1px dashed var(--rule);
  font-size: 0.78rem;
}
.cloud-log-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.cloud-log-who { font-weight: 600; }
.cloud-log-summary { grid-column: 1 / -1; font-size: 0.74rem; line-height: 1.3; color: var(--navy); }
#cloud-log-list {
  max-height: min(58vh, 26rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.4rem;
}

.tabs {
  display: flex;
  gap: 0.2rem;
  margin-top: 0.7rem;
  border-bottom: 2px solid var(--ink);
}
.tab {
  background: var(--paper-deep);
  border: 1px solid var(--rule-strong);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 0.55rem 1.15rem;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink-soft);
}
.tab.is-active {
  background: var(--card);
  color: var(--ink);
  position: relative;
  top: 2px;
  padding-bottom: 0.7rem;
  border-color: var(--ink);
}

.panel {
  background: var(--card);
  border: 1px solid var(--ink);
  border-top: none;
  padding: 1.1rem 1rem 1.3rem;
  min-height: 28rem;
}
.panel[hidden] { display: none !important; }
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.filter-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.hint { color: var(--muted); font-size: 0.8rem; margin: 0; }
.trip-range {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.trip-range-label { font-weight: 600; }
.trip-date-btn {
  min-width: 9.2rem;
  text-align: left;
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  color: var(--ink);
}
.trip-date-btn:empty::before { content: "選擇日期"; color: var(--muted); }
.trip-cal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(44, 38, 29, 0.28);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem;
}
.trip-cal[hidden] { display: none; }
.trip-cal-card {
  width: min(22rem, 100%);
  background: var(--card);
  border-radius: 14px;
  padding: 0.9rem 0.95rem 1.05rem;
  box-shadow: var(--shadow);
}
.trip-cal-mode {
  margin: 0 0 0.55rem;
  text-align: center;
  font-weight: 600;
  color: var(--seal);
}
.trip-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
  font-family: var(--serif);
  font-size: 1.05rem;
}
.trip-cal-week,
.trip-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
  text-align: center;
}
.trip-cal-week {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.trip-cal-day {
  min-height: 2.4rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.trip-cal-day:hover:not(:disabled) { background: var(--paper-deep); }
.trip-cal-day.is-range { background: var(--moss-soft); }
.trip-cal-day.is-on {
  background: var(--seal);
  color: #fff8f2;
  font-weight: 700;
}
.trip-cal-day:disabled { opacity: 0.28; }
.trip-cal-pad { min-height: 2.4rem; }
.ymd {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.35;
}
.ymd-unit {
  font-family: var(--serif);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0.32rem 0 0.02rem;
}
.ymd input,
.wish-table .ymd input,
.wish-add .ymd input {
  width: auto;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--rule-strong) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 0.04rem 0.04rem !important;
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  text-align: center;
}
.ymd input:focus,
.wish-table .ymd input:focus,
.wish-add .ymd input:focus {
  outline: none !important;
  border-bottom-color: var(--seal) !important;
  box-shadow: none !important;
}
.ymd-y { width: 3.2em !important; min-width: 3.2em; }
.ymd-m, .ymd-d { width: 1.55em !important; min-width: 1.55em; }

.table-wrap { overflow-x: auto; }
.wish-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.wish-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--ink);
  padding: 0.4rem 0.4rem 0.5rem;
  white-space: nowrap;
}
.wish-table td {
  border-bottom: 1px dashed var(--rule);
  padding: 0.35rem 0.35rem;
  vertical-align: middle;
}
.wish-table input[type="text"],
.wish-table input[type="date"],
.wish-table select {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 0.25rem 0.15rem;
}
.wish-table input:focus {
  border-bottom-color: var(--seal);
  outline: none;
}
.col-check, .wish-table td:first-child { text-align: center; width: 4.2rem; }
.wish-actions { display: flex; gap: 0.3rem; white-space: nowrap; }
.maps-link {
  color: var(--navy);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  word-break: break-all;
}
.addr-saved,
.addr-edit-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-width: 0;
}
.addr-saved .maps-link,
.addr-edit-row input { width: 100%; min-width: 0; }
.addr-wish-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
}
.addr-wish-row .maps-link,
.addr-wish-row input,
.addr-wish-row .addr-empty-hint {
  flex: 1;
  min-width: 0;
}
.addr-wish-row .addr-edit,
.addr-wish-row .addr-ok {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}
.addr-empty-hint {
  color: var(--muted);
  font-size: 0.82rem;
}
.btn.sm.addr-edit,
.btn.sm.addr-ok {
  flex: 0 0 auto;
  padding: 0.08rem 0.42rem;
  font-size: 0.68rem;
  min-height: 0;
  height: auto;
  line-height: 1.25;
  white-space: nowrap;
}

/* 日程活動：詳細地址跨成整行，掣貼最右 */
.act-row > .addr-act-row {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
  margin-top: 0.2rem;
  padding-top: 0.15rem;
}
.act-row > .addr-act-row .maps-link,
.act-row > .addr-act-row input,
.act-row > .addr-act-row .addr-empty-hint {
  flex: 1 1 auto;
  min-width: 0;
}
.act-row > .addr-act-row .addr-edit,
.act-row > .addr-act-row .addr-ok {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}
.addr-act-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
}
.addr-act-row .maps-link,
.addr-act-row input,
.addr-act-row .addr-empty-hint {
  flex: 1;
  min-width: 0;
}
.addr-act-row .addr-edit,
.addr-act-row .addr-ok {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}
.wish-add {
  display: grid;
  grid-template-columns: auto 1.2fr 0.7fr 0.7fr 0.7fr 1fr 1fr auto;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--rule-strong);
}
.add-kicker {
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--seal);
}

.schedule-hint { margin: 0 0 0.7rem; }
.schedule-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.4rem 0.8rem;
  margin: 0 0 0.7rem;
}
.schedule-fold-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  order: -1;
  flex: 0 0 auto;
}
.schedule-toolbar .schedule-hint {
  margin: 0;
  flex: 1 1 12rem;
  order: 1;
}
.btn.sm.fold-day {
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
  padding: 0.08rem 0.38rem;
  font-size: 0.68rem;
  line-height: 1.25;
}
.day-col.is-folded {
  width: 10.2rem;
}
.day-col.is-folded .theme-label,
.day-col.is-folded .day-view-meta,
.day-col.is-folded .act-list,
.day-col.is-folded .act-add-bottom,
.day-col.is-folded .day-mode,
.day-col.is-folded .day-foot,
.day-col.is-folded .date-input,
.day-col.is-folded [data-act="del-day"] {
  display: none;
}
.day-col.is-folded .day-head {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.55rem 0.45rem 0.65rem;
  border-bottom: none;
}
.day-col.is-folded .day-date-row {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  gap: 0.35rem;
}
.day-col.is-folded .day-date {
  font-size: 0.9rem;
  text-align: left;
  padding: 0;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.15;
}
.day-col.is-folded .folded-wd {
  font-size: 0.62rem;
  letter-spacing: 0.02em;
}
.day-col.is-folded .day-side-actions {
  margin-top: 0;
  width: 100%;
}
.day-col.is-folded .fold-day {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.32rem 0.4rem;
  min-height: 1.85rem;
  line-height: 1.2;
  border-radius: 999px;
  border: 1px solid var(--seal);
  background: var(--seal);
  color: #fffdf8;
  box-shadow: 0 1px 0 rgba(90, 40, 40, 0.18);
}
.day-col.is-folded .fold-day:hover,
.day-col.is-folded .fold-day:focus-visible {
  filter: brightness(1.06);
  outline: none;
}
.day-col.is-folded .del-day {
  order: -1;
}
.folded-done {
  display: none;
}
.day-col.is-folded .folded-done {
  display: block;
  align-self: flex-start;
  margin: 0.35rem 0 0.15rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--moss);
  background: var(--moss-soft);
  border: 1px solid #b7cfc0;
  border-radius: 999px;
  text-align: center;
  letter-spacing: 0.04em;
}
.folded-summary {
  display: none;
}
.day-col.is-folded .folded-summary {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--rule-strong);
}
.folded-sum-row {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.folded-sum-label {
  font-size: 0.58rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.folded-sum-val {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.folded-sum-row.is-empty .folded-sum-val {
  color: var(--muted);
  font-weight: 500;
}
.day-col.is-folded .fold-pack-past {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  font-size: 0.68rem;
  padding: 0.2rem 0.15rem;
  min-height: 0;
  line-height: 1.2;
  white-space: nowrap;
}
.day-col:not(.is-folded) .fold-pack-past { display: none; }
.folded-theme { display: none; }

.day-act-fold-bar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-top: 0.45rem;
  width: 100%;
}
.day-act-fold-bar .btn {
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
  padding: 0.08rem 0.42rem;
  font-size: 0.68rem;
  line-height: 1.25;
  white-space: nowrap;
}

.folded-places {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.folded-places li {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
  word-break: break-word;
}
.folded-places li.is-empty,
.folded-places-empty li {
  color: var(--muted);
  font-weight: 500;
}

.folded-maps {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.32rem 0.4rem;
  min-height: 1.85rem;
  line-height: 1.2;
  border-radius: 999px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fffdf8;
}
a.folded-maps:hover,
a.folded-maps:focus-visible {
  filter: brightness(1.06);
  outline: none;
}
.folded-maps:disabled,
button.folded-maps:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--paper-deep);
  border-color: var(--rule-strong);
  color: var(--muted);
}

.schedule-scroller {
  overflow-x: auto;
  padding-bottom: 0.4rem;
}
.schedule-track {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  min-height: 26rem;
  width: max-content;
}
.day-col {
  width: 300px;
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 0 rgba(90, 70, 40, 0.04);
}
.day-head {
  padding: 0.55rem 0.8rem 0.4rem;
  border-bottom: 1px solid var(--ink);
  background:
    linear-gradient(#fff8ea, #fff8ea),
    repeating-linear-gradient(180deg, transparent 0 22px, rgba(223,210,184,0.45) 23px);
}
.day-date-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.4rem;
}
.day-head-left {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 0.15rem;
}
.day-side-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.28rem;
  flex: 0 0 7rem;
  width: 7rem;
  min-width: 7rem;
  align-self: flex-start;
}
.day-side-actions .day-side-btn,
.day-side-actions .fold-day,
.day-side-actions .day-mode {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.28rem 0.2rem;
  min-height: 1.75rem;
  line-height: 1.15;
  border-radius: 999px;
}
.day-col.is-folded .day-mode {
  font-size: 0.62rem;
  padding: 0.1rem 0.15rem;
}
.day-view-meta {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.28;
  color: var(--ink);
}
.day-head-left .day-view-meta:first-of-type,
.day-head-left .day-date + .day-view-meta,
.day-head-left .day-date + .theme-label {
  margin-top: 0.18rem;
}
.day-head-left .day-view-meta + .day-view-meta {
  margin-top: 0.12rem;
}
.day-view-meta > span {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.05rem;
}
.day-region-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  margin-top: 0.45rem;
}
.day-region-row .day-region-label,
.day-region-row .day-region-meta {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}
.day-region-row .day-mode {
  flex: 0 0 auto;
  align-self: flex-end;
  white-space: nowrap;
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  min-height: 0;
  margin-bottom: 0.05rem;
}
.day-foot.is-locked {
  gap: 0.35rem;
}
.act-row.is-locked {
  grid-template-columns: auto 1fr auto;
}
.act-time-view {
  min-width: 3.2rem;
  font-family: var(--serif);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding-top: 0.12rem;
  color: var(--navy);
}
.act-view-place { font-weight: 600; color: var(--navy); }
.act-view-line { font-size: 0.84rem; }
.act-view-note { font-size: 0.78rem; color: var(--muted); }
.act-view-muted { font-size: 0.78rem; color: var(--muted); }
.day-date { font-family: var(--serif); font-weight: 700; font-size: 1.02rem; }
.weekday {
  font-size: 0.78rem;
  color: var(--seal);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.theme-label {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.day-head-left .theme-label + .theme-label {
  margin-top: 0.15rem;
}
.theme-input {
  width: 100%;
  margin-top: 0.15rem;
  font-family: var(--serif);
  font-weight: 600;
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--rule-strong);
  border-radius: 0;
  padding: 0.15rem 0;
}
.act-list { flex: 1; padding: 0.35rem 0.55rem 0.2rem; }
.act-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.25rem 0.4rem;
  padding: 0.45rem 0.15rem;
  border-bottom: 1px dashed var(--rule);
  position: relative;
  align-items: start;
}
.act-time {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 3.9rem;
}
.act-time-row {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.act-time input {
  width: 2.85rem;
  min-width: 2.85rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: var(--serif);
  font-size: 0.76rem;
  padding: 0.1rem 0.05rem;
}
.act-time .time-plus,
.act-time [data-act="clear-time-end"] {
  flex: 0 0 auto;
  width: 0.95rem;
  height: 0.95rem;
  min-width: 0.95rem;
  min-height: 0.95rem;
  padding: 0;
  font-size: 0.58rem;
  line-height: 1;
}
.act-time-to {
  font-size: 0.62rem;
  color: var(--muted);
  flex: 0 0 auto;
}
.act-row input, .act-row textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.12rem 0;
  font-size: 0.84rem;
}
.act-row textarea { resize: none; min-height: 2.2rem; }
.act-main { display: flex; flex-direction: column; gap: 0.1rem; }
.act-tools {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 0.15rem;
}
.act-tools .btn.icon,
.day-date-row [data-act="del-day"] {
  width: 1.2rem;
  height: 1.2rem;
  min-width: 1.2rem;
  min-height: 1.2rem;
  font-size: 0.7rem;
}
.act-row.is-act-hidden {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  grid-template-columns: none;
  padding: 0.4rem 0.25rem;
}
.act-hidden-left {
  flex: 0 0 auto;
  min-width: 4.2rem;
  max-width: 34%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
}
.act-hidden-time {
  font-family: var(--serif);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
  line-height: 1.2;
}
.act-hidden-theme {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--serif);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
  word-break: break-word;
  padding: 0 0.2rem;
}
.act-hidden-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0;
  padding-top: 0;
}
.act-tools .act-hide {
  padding: 0.08rem 0.35rem;
  font-size: 0.68rem;
  min-height: 0;
  height: auto;
  line-height: 1.25;
  white-space: nowrap;
}
.act-show {
  flex: 0 0 auto;
  padding: 0.08rem 0.42rem;
  font-size: 0.68rem;
  min-height: 0;
  height: auto;
  line-height: 1.25;
}
.act-hidden-actions .act-maps,
.act-hidden-actions .act-show {
  flex: 0 0 auto;
  padding: 0.08rem 0.42rem;
  font-size: 0.68rem;
  min-height: 0;
  height: auto;
  line-height: 1.25;
  white-space: nowrap;
  text-decoration: none;
}
.act-maps.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}


.act-tag-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.05rem 0 0.1rem;
}
.act-tag-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.1rem 1.4rem 0.1rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 0.55rem) 55%, calc(100% - 0.35rem) 55%;
  background-size: 0.28rem 0.28rem, 0.28rem 0.28rem;
  background-repeat: no-repeat;
  max-width: 100%;
}
.act-tag-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.08rem 0.5rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
  white-space: nowrap;
  flex: 0 0 auto;
}
.tag-unplanned,
.act-tag-select.tag-unplanned { background-color: #ebe4d6; color: #6a6154; }
.tag-planned,
.act-tag-select.tag-planned { background-color: #dce8e0; color: #2f5a42; }
.tag-unbooked,
.act-tag-select.tag-unbooked { background-color: #e8dfd0; color: #7a5a2e; }
.tag-booked,
.act-tag-select.tag-booked { background-color: #d7e4f0; color: #2f4d6a; }
.tag-tentative,
.act-tag-select.tag-tentative { background-color: #efe3c8; color: #7a5f24; }
.tag-waitlist,
.act-tag-select.tag-waitlist { background-color: #e6dceb; color: #5c4570; }
.tag-discarded,
.act-tag-select.tag-discarded { background-color: #e8ddd8; color: #6e5248; text-decoration: line-through; }

.tag-custom,
.act-tag-select.tag-custom { background-color: #e4ebe8; color: #3d5a4f; }
.tag-custom-0,
.act-tag-select.tag-custom-0 { background-color: #dde8f2; color: #35566a; }
.tag-custom-1,
.act-tag-select.tag-custom-1 { background-color: #e8e2f2; color: #55406e; }
.tag-custom-2,
.act-tag-select.tag-custom-2 { background-color: #f2e4dc; color: #6e4a3a; }
.tag-custom-3,
.act-tag-select.tag-custom-3 { background-color: #e4f0e0; color: #3a5c3f; }
.tag-custom-4,
.act-tag-select.tag-custom-4 { background-color: #f2ecd8; color: #6a5a2e; }
.tag-custom-5,
.act-tag-select.tag-custom-5 { background-color: #f0e0e6; color: #6a3f52; }

.place-input { color: var(--navy); font-weight: 600; }
.act-add-bottom {
  margin: 0.45rem auto 0.35rem;
  align-self: center;
  display: block;
}
.day-foot {
  margin-top: auto;
  padding: 0.55rem 0.75rem 0.75rem;
  border-top: 1px solid var(--rule-strong);
  background: #f7f0e0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.day-foot label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
}
.day-foot input, .day-foot textarea {
  background: #fffdf8;
  font-size: 0.84rem;
}
.day-foot textarea { resize: vertical; min-height: 3rem; }
.add-day-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  width: 104px;
  min-height: 16rem;
}
.add-day-col .add-day { width: 100%; flex: 1 1 auto; min-height: 6rem; }
.add-day-sub {
  font-size: 0.78rem;
  font-family: var(--sans);
  font-weight: 500;
}
.btn.add-days-many {
  flex: 1.4 1 auto;
  min-height: 7.5rem;
  width: 100%;
  font-size: 0.95rem;
  font-family: var(--serif);
  font-weight: 700;
  padding: 0.7rem 0.35rem;
  white-space: normal;
  line-height: 1.35;
  border-radius: 10px;
}
.add-day {
  width: 104px;
  border: 1.5px dashed var(--seal);
  background: rgba(181, 74, 60, 0.04);
  border-radius: 10px;
  color: var(--seal);
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-height: 6rem;
}
.add-day:hover { background: rgba(181, 74, 60, 0.1); }

.exp-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 0.9rem;
}
.exp-people, .exp-rate {
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
}
.exp-people h3, .exp-rate h3, .settle h3 {
  font-family: var(--serif);
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}
.people-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.people-head h3 {
  margin: 0;
}
.people-event-date-lab {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0 0 0.55rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.people-event-date {
  display: block;
  width: auto;
  max-width: 11.5rem;
  box-sizing: border-box;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  min-height: 2.6rem;
}
.event-date-edit:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}
.event-date-edit[hidden] {
  display: none !important;
}
.event-date-edit .people-event-date-lab {
  width: auto;
  max-width: 100%;
}
.event-date-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}
.event-date-head h3 {
  margin: 0;
}
.event-date-head #btn-meta-lock,
.event-date-head #btn-meta-fold {
  flex: 0 0 auto;
  font-size: 0.74rem;
  padding: 0.15rem 0.55rem;
  min-height: 0;
  height: auto;
  line-height: 1.3;
  white-space: nowrap;
}
.event-date-head #btn-meta-lock:not([hidden]) {
  margin-left: auto;
}
.event-date-head #btn-meta-lock[hidden] ~ #btn-meta-fold,
.prep-people.is-collapsed .event-date-head #btn-meta-fold {
  margin-left: auto;
}
.prep-people.is-collapsed .event-date-head {
  margin-bottom: 0.2rem;
}
.prep-people-extra[hidden] {
  display: none !important;
}
.event-date-block {
  margin: 0 0 0.75rem;
}

.event-date-locked {
  font-size: 0.95rem;
  color: var(--ink);
  padding: 0.15rem 0 0.25rem;
  line-height: 1.45;
}
.event-date-edit .people-event-date-lab {
  margin-bottom: 0.45rem;
}
.event-date-extend {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.15rem;
}
.event-date-extend-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.event-date-extend-custom {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.event-date-extend-custom input {
  width: 4.2rem;
  min-height: 2rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  padding: 0.25rem 0.4rem;
  box-sizing: border-box;
}
#event-date-range-hint {
  margin: 0.15rem 0 0;
  min-height: 1.2em;
}
.people-head .people-toggle {
  margin-left: auto;
}
.btn.sm.people-toggle {
  flex: 0 0 auto;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  min-height: 0;
  height: auto;
  line-height: 1.3;
  white-space: nowrap;
}
.prep-people { margin: 0.35rem 0 0.85rem; }
.people-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.55rem; }
.people-row.is-locked { gap: 0.3rem; margin-bottom: 0.2rem; }
.person-tag {
  font-size: 0.76rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: #fffaf0;
  color: var(--ink-soft);
  font-weight: 600;
  white-space: nowrap;
}

/* 心願鎖定卡 */
.wish-locked td { padding: 0.3rem 0 !important; }
.wish-locked td::before { content: none !important; }
.wish-lock-card {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  background: #faf6ec;
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.wish-lock-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.5rem;
  font-size: 0.82rem;
}
.wish-lock-name {
  font-weight: 700;
  font-family: var(--serif);
  font-size: 0.94rem;
  color: var(--ink);
}
.wish-lock-meta { color: var(--ink-soft); }
.wish-lock-addr { font-size: 0.78rem; }
.wish-lock-note { color: var(--muted); flex: 1 0 100%; }
.wish-lock-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}
.wish-lock-tools .btn.sm {
  font-size: 0.7rem;
  padding: 0.12rem 0.45rem;
  min-height: 0;
  height: auto;
  line-height: 1.3;
  white-space: nowrap;
}
.wish-lock-tools .btn.icon { width: 1.35rem; height: 1.35rem; min-width: 1.35rem; }
.wish-actions .wish-btn-lock { margin-left: 0.2rem; }
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #efe6d2;
  border-radius: 999px;
  padding: 0.18rem 0.25rem 0.18rem 0.55rem;
}
.person-chip input {
  width: 5.5rem;
  background: transparent;
  border: none;
  padding: 0.15rem 0.1rem;
  font-weight: 600;
}
.people-add {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.people-add input {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}
#people-add[hidden] { display: none !important; }
.rate-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
}
#fx-rate { max-width: 10rem; font-variant-numeric: tabular-nums; }
.exp-add-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0.85rem 0 0.45rem;
  letter-spacing: 0.04em;
}
.exp-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.15rem 0 0.85rem;
  flex-wrap: wrap;
  align-items: center;
}
.exp-actions #btn-expand-all-charges {
  margin-left: auto;
}
.exp-actions #btn-hide-settled {
  margin-left: 0;
}


.settle-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  flex-wrap: nowrap;
  min-height: 1.75rem;
}
.settle-head h3 {
  margin: 0;
  flex: 0 0 auto;
  font-size: 0.95rem;
  white-space: nowrap;
}
.settle-fold {
  flex: 0 0 auto;
  margin-left: auto;
}
.settle-head-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  align-items: center;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.settle-head-actions[hidden] {
  display: none !important;
}
.settle-head-actions .btn {
  flex: 0 1 auto;
  padding: 0.12rem 0.42rem;
  font-size: 0.7rem;
  min-height: 0;
  line-height: 1.2;
  white-space: nowrap;
}
.settle-panel-body[hidden] {
  display: none !important;
}
.settle-folded-summary {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settle-folded-summary[hidden] {
  display: none !important;
}
.settle.is-folded {
  padding-bottom: 0.35rem;
}
.fx-block { margin: 0.2rem 0 0.15rem; }
#currency-panel {
  margin-bottom: 0.45rem;
}
#settle-section {
  margin-top: 0;
}
#settle-section .settle-body {
  margin-top: 0;
}
.fx-list {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-top: 0.2rem;
}
.fx-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem 0.35rem;
}
.fx-code {
  width: 5.4rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.fx-code-wrap {
  position: relative;
  display: flex;
  flex: 0 1 7rem;
  max-width: 7rem;
  min-width: 0;
}
.fx-code-search {
  width: 100%;
  min-width: 0;
  min-height: 2rem;
  max-height: 2.2rem;
  padding: 0.25rem 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  box-sizing: border-box;
}
.fx-code-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.15rem);
  z-index: 8;
  max-height: 12rem;
  overflow: auto;
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(70, 52, 24, 0.12);
  padding: 0.2rem;
}
.fx-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  color: var(--ink);
}
.fx-suggest-item:hover,
.fx-suggest-item.is-on {
  background: #f3ebe0;
}
.fx-suggest-empty {
  padding: 0.55rem 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.fx-rate {
  width: 6.2rem;
  flex: 0 0 auto;
  max-width: 7rem;
  min-height: 2rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}
.fx-eq, .fx-hkd {
  font-size: 0.86rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.fx-add { align-self: flex-start; }
.fx-view {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
}
.fx-chip {
  font-size: 0.74rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: #fffaf0;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.btn.sm.fx-toggle {
  flex: 0 0 auto;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  min-height: 0;
  height: auto;
  line-height: 1.3;
  white-space: nowrap;
}
.fx-edit-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin-top: 0.15rem;
}
.fx-edit-actions .fx-del {
  flex: 0 0 auto;
  white-space: nowrap;
  order: 0;
}
.fx-edit-actions .fx-add {
  flex: 0 0 auto;
  order: 1;
}
.fx-edit-actions .fx-toggle {
  flex: 0 0 auto;
  margin-left: auto;
  order: 2;
}
.fx-row.is-selected {
  outline: 2px solid var(--seal);
  outline-offset: 2px;
  border-radius: 8px;
  background: #fff6ea;
}
.fx-row .fx-del {
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: 0;
  padding: 0.28rem 0.5rem;
  font-size: 0.72rem;
}
.fx-edit-actions .fx-add {
  flex: 0 0 auto;
}
.fx-edit-actions .fx-toggle {
  flex: 0 0 auto;
  margin-left: auto;
}
.settle-remain {
  margin: 0.3rem 0 0.15rem;
  font-size: 0.86rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.bal-card {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  align-items: flex-start;
}
.bal-card .settle-clear { margin-top: 0.1rem; }
#btn-refresh-fx:disabled {
  opacity: 0.55;
  cursor: wait;
}

.charges-list { display: flex; flex-direction: column; gap: 0.85rem; }
.charge-card {
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  padding: 0.85rem 0.95rem 0.75rem;
}
.charge-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
  align-items: center;
  margin-bottom: 0.65rem;
}
.charge-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 8rem;
}
.charge-title-wrap .charge-title { flex: 1; min-width: 0; }
.charge-edit-confirm {
  display: flex;
  justify-content: flex-end;
  margin: 0.85rem 0 0.2rem;
}
.charge-confirm-btn {
  min-width: 9.5rem;
  padding: 0.58rem 2.1rem;
  border-radius: 999px;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  line-height: 1.2;
}
.charge-card.is-editing .charge-head {
  gap: 0.4rem;
}
.charge-card.is-editing .charge-head > [data-act="del-charge"] {
  flex: 0 0 auto;
  order: -1;
  margin-right: 0.1rem;
}

.charge-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}
.charge-card.is-folded { padding-bottom: 0.45rem; }
.charge-card.is-folded .charge-head { margin-bottom: 0.2rem; }
.charge-card.is-folded .charge-actions .btn:not(.fold-charge) {
  display: none !important;
}
.charge-actions.is-folded-only {
  gap: 0;
}
.charge-folded-line {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.btn.sm.fold-charge { flex: 0 0 auto; }
.btn.sm.fold-charge.is-compact {
  min-width: 1.7rem;
  width: 1.7rem;
  height: 1.7rem;
  min-height: 1.7rem;
  padding: 0;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.locked-items {
  list-style: none;
  margin: 0.15rem 0 0.45rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.locked-items li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
  align-items: baseline;
  font-size: 0.84rem;
  padding: 0.2rem 0.4rem;
  background: #faf6ec;
  border: 1px dashed var(--rule);
  border-radius: 6px;
}
.locked-items .li-who { font-weight: 700; color: var(--navy); }
.locked-items .li-amt { margin-left: auto; font-variant-numeric: tabular-nums; }
.locked-items .li-note { flex: 1 0 100%; color: var(--ink-soft); font-size: 0.78rem; }
.item-notes-view {
  margin: 0.15rem 0 0.45rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.item-notes-title { font-weight: 700; }
.item-notes-view ul { margin: 0.15rem 0 0; padding-left: 1.1rem; }
.charge-notes-lab,
.charge-notes-view {
  display: block;
  margin: 0.15rem 0 0.35rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.charge-notes-lab input {
  width: 100%;
  margin-top: 0.15rem;
}
.kind-pill {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #efe6d2;
  color: var(--ink-soft);
  font-weight: 600;
}
.kind-pill.itemized { background: #ead9d4; color: var(--seal-deep); }
.charge-title { flex: 1; min-width: 0; font-weight: 600; }
.charge-title-text {
  flex: 1;
  min-width: 6rem;
  font-weight: 600;
  font-family: var(--serif);
  font-size: 1.02rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.charge-card.is-locked {
  background: #f6f0e2;
  border-color: var(--rule);
}
.charge-card.is-locked .locked-meta {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0 0 0.45rem;
  font-variant-numeric: tabular-nums;
}
.charge-card.is-locked .charge-foot {
  color: var(--ink);
  font-weight: 500;
  background: #efe6d2;
}
.charge-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.55rem;
  align-items: end;
}
.charge-meta.is-stacked,
.charge-meta.is-date-only {
  grid-template-columns: 1fr;
}
.charge-meta > label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  width: 100%;
}
.charge-meta .amount-lab .amount-with-calc,
.discount-fields .amount-with-calc {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  width: 100%;
}
.charge-meta .amount-lab input[type="number"],
.discount-fields input[type="number"] {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  min-height: 2.4rem;
}
.payers-editor {
  width: 100%;
  margin: 0.15rem 0 0.35rem;
  padding: 0.45rem 0.55rem 0.5rem;
  border: 1px dashed var(--rule-strong);
  border-radius: 8px;
  background: #faf6ec;
}
.payers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.86rem;
  font-family: var(--serif);
}
.payers-rows { display: flex; flex-direction: column; gap: 0.35rem; }
.payer-row {
  display: grid;
  grid-template-columns: minmax(5.5rem, 1fr) 6rem auto;
  gap: 0.3rem;
  align-items: center;
}
.payer-row select,
.payer-row input { width: 100%; min-width: 0; }
.payer-row-spacer { width: 2rem; }
.payers-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.payers-hint.warn {
  color: var(--seal);
  font-weight: 600;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  padding: 0.2rem 0 0.4rem;
}
.share-row label { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.88rem; }
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0.6rem;
}
.person-items {
  border: 1px dashed var(--rule-strong);
  border-radius: 8px;
  padding: 0.5rem 0.55rem 0.55rem;
  background: #faf6ec;
}
.person-items h4 {
  margin: 0;
  font-size: 0.86rem;
  font-family: var(--serif);
  flex: 1;
  min-width: 0;
  text-align: left;
}
.person-items-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  margin: 0;
  padding: 0.2rem 0.15rem;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.person-items-chevron {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1;
}
.person-items.is-collapsed {
  padding: 0.15rem 0.35rem;
}
.person-items.is-collapsed .person-items-body {
  display: none;
}
.person-items.is-open .person-items-toggle {
  margin-bottom: 0.3rem;
}
.person-items-body {
  display: block;
}
.item-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.8rem auto;
  gap: 0.25rem;
  margin-bottom: 0.45rem;
  align-items: center;
}
.item-line .item-notes {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  background: #fffdf8;
  border: 1px dashed var(--rule-strong);
  border-radius: 6px;
  padding: 0.18rem 0.4rem;
}
.item-line-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.item-line-foot .item-notes {
  flex: 1;
  min-width: 0;
}
.item-line-foot .item-notes-toggle {
  flex: 0 0 auto;
}
.item-line-foot .item-add-under {
  flex: 0 0 auto;
  margin-left: auto;
  min-height: 2.1rem;
}
.charge-foot {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  background: #f3ead8;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}
.charge-sum { font-variant-numeric: tabular-nums; }

.settle {
  margin: 0 0 0.65rem;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  padding: 0.65rem 0.75rem 0.7rem;
  background: #fffdf8;
}
.settle-body { margin-top: 0.4rem; }
.settle-empty { color: var(--muted); }
.debt-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.debt-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--seal);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
}
.debt-amt { font-variant-numeric: tabular-nums; font-weight: 700; }
.bal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}
.bal-card {
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.84rem;
}
.bal-card strong { display: block; font-family: var(--serif); }
.pos { color: var(--moss); }
.neg { color: var(--seal); }

.toast {
  position: fixed;
  bottom: 4.2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #f7f1e4;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 80;
  box-shadow: var(--shadow);
  max-width: min(92vw, 28rem);
  text-align: center;
  pointer-events: none;
}

.ad-banner {
  max-width: 1280px;
  margin: 0 auto 0.8rem;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 0.9rem;
  background: #ece4d2;
  border: 1px dashed #c3b79a;
  color: #8d8372;
  pointer-events: none;
  user-select: none;
  opacity: 0.72;
  font-size: 0.8rem;
}
.ad-tag {
  font-size: 0.68rem;
  border: 1px solid #c3b79a;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
}
.ad-copy { flex: 1; }
.ad-cta {
  border: 1px solid #c3b79a;
  background: transparent;
  color: inherit;
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(44, 38, 29, 0.35);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  z-index: 50;
  padding: 1rem;
}
.modal.modal-over { z-index: 70; }
.modal[hidden] { display: none; }
.modal-card {
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 12px;
  padding: 1.1rem 1.15rem 1rem;
  width: min(26rem, 100%);
  box-shadow: var(--shadow);
}
.modal-card h3 { font-family: var(--serif); margin: 0 0 0.4rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.45rem; margin-top: 1rem; }
.modal-card-wide { width: min(28rem, 100%); }
.unarchive-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin: 0.55rem 0 0.35rem;
}
.unarchive-list {
  max-height: min(50vh, 22rem);
  overflow-y: auto;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: #fffdf8;
  padding: 0.25rem 0;
}
.unarchive-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px dashed var(--rule);
  cursor: pointer;
}
.unarchive-item:last-child { border-bottom: none; }
.unarchive-item input {
  margin-top: 0.2rem;
  flex: 0 0 auto;
}
.unarchive-item-body { min-width: 0; flex: 1; }
.unarchive-item-date {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.95rem;
}
.unarchive-item-theme {
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: var(--navy);
  font-weight: 600;
  word-break: break-word;
}
.unarchive-item-theme.is-empty {
  color: var(--muted);
  font-weight: 500;
}

.move-days-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: min(52vh, 22rem);
  overflow: auto;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: #fffdf8;
  margin-top: 0.55rem;
}
.move-day-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.move-day-item:last-child { border-bottom: none; }
.move-day-item:hover,
.move-day-item:focus-visible {
  background: var(--paper-deep);
  outline: none;
}
.move-day-item.is-selected {
  background: #f3ebe0;
  box-shadow: inset 3px 0 0 var(--seal);
}
.move-day-item-date {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--navy);
}
.move-day-item-theme {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  word-break: break-word;
}
.move-day-item-theme.is-empty {
  color: var(--muted);
  font-weight: 500;
}
.move-day-item.is-slot .move-day-item-date {
  font-size: 0.84rem;
  font-weight: 650;
}
.move-day-item.is-slot .move-day-item-theme {
  font-weight: 500;
  color: var(--muted);
}

.tags-list {
  max-height: min(50vh, 22rem);
  overflow-y: auto;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: #fffdf8;
  padding: 0.35rem 0.45rem 0.55rem;
  margin: 0.55rem 0 0.65rem;
}
.tags-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  margin: 0.45rem 0.25rem 0.3rem;
}
.tags-section-label:first-child { margin-top: 0.15rem; }
.tags-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
}
.tags-row-builtin {
  background: rgba(0, 0, 0, 0.02);
  margin-bottom: 0.15rem;
}
.tags-row-custom {
  background: rgba(47, 90, 66, 0.04);
  margin-bottom: 0.15rem;
}
.tags-row-note {
  font-size: 0.7rem;
  color: var(--muted);
  flex: 0 0 auto;
}
.tags-del {
  min-width: 1.8rem;
  padding: 0.1rem 0.35rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--seal);
}
.tags-empty {
  padding: 0.35rem 0.45rem 0.15rem;
  margin: 0;
}
.tags-add-form {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.25rem;
}
.tags-add-form input {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
  padding: 0.4rem 0.55rem;
}

.date-input {
  font-size: 0.82rem;
  padding: 0.15rem 0.3rem;
  max-width: 9.4rem;
}


.checklist-details {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  width: 100%;
}
.checklist-details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.checklist-details > summary::after {
  content: "摺疊";
  color: var(--seal);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
}
.checklist-details:not([open]) > summary::after { content: "展開"; }
.checklist-details > summary::-webkit-details-marker,
.checklist-details > summary::marker {
  display: none;
  content: none;
}

.settle-head {
  margin-bottom: 0.1rem;
}
#btn-merge-settle.is-on,
#btn-merge-settle[aria-pressed="true"] {
  background: var(--moss);
  color: #f4faf6;
  border-color: var(--moss);
}
.settle-block + .settle-block {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--rule-strong);
}
.settle-block h4 {
  font-family: var(--serif);
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}
.charge-date {
  font-variant-numeric: tabular-nums;
}
.charge-card.is-settled .charge-title-text,
.charge-card.is-settled .charge-title,
.charge-card.is-settled .locked-meta {
  text-decoration: line-through;
  color: var(--muted);
}
.settled-badge {
  flex: 0 0 auto;
  font-size: 0.64rem;
  letter-spacing: 0.02em;
  padding: 0.04rem 0.35rem;
  border-radius: 999px;
  background: var(--moss-soft);
  color: var(--moss);
  font-weight: 700;
  border: 1px solid #b7cfc0;
  white-space: nowrap;
  text-decoration: none;
}
.settle-picker {
  margin-top: 0.55rem;
  padding: 0.55rem 0.65rem 0.6rem;
  background: #f3ead8;
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.settle-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0 0.5rem;
}
.settle-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.btn.settle-person.is-on {
  background: var(--moss-soft);
  color: var(--moss);
  border-color: #b7cfc0;
  text-decoration: line-through;
}
.btn[data-act="toggle-settle"].is-on {
  background: var(--seal);
  color: #fff8f2;
  border-color: var(--seal-deep);
  text-decoration: none;
}

.tabbar { display: none; }

.settle-chip {
  flex: 1 1 12rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  background: #f3ead8;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.42rem 0.7rem;
  font-variant-numeric: tabular-nums;
  min-height: 2.4rem;
  display: flex;
  align-items: center;
}
.settle-chip.has-debt {
  border-left: 4px solid var(--seal);
  color: var(--ink);
  font-weight: 600;
}
.settle-chip[hidden] { display: none !important; }

.schedule-scroller {
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

@media (max-width: 860px) {
  .masthead { grid-template-columns: 1fr; }
  .wish-add { grid-template-columns: 1fr 1fr; }
  .exp-top { grid-template-columns: 1fr; }
  .notebook { margin: 0.5rem; }
  .page { padding: 1rem 0.8rem; }
}

/* 列印樣式放喺檔案最底，避免手機 media query 蓋過 */


/* —— 手機：底欄 + 全幅手帳，方便單手分帳 —— */
@media (max-width: 760px) {
  html {
    -webkit-text-size-adjust: 100%;
  }
  input, select, textarea {
    font-size: 16px !important;
  }
  body {
    min-height: 100dvh;
    min-height: 100svh;
    background: var(--paper);
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .binding { display: none; width: 0; flex: 0 0 0; }
  .notebook::before { display: none; }
  .notebook {
    margin: 0;
    max-width: none;
    border-radius: 0;
    min-height: 100dvh;
    min-height: 100svh;
    box-shadow: none;
  }
  .page {
    padding: 0.75rem 0.75rem calc(7.5rem + env(safe-area-inset-bottom, 0px));
  }
  #panel-schedule {
    padding-bottom: 1.25rem;
  }
  .schedule-scroller {
    padding-bottom: 0.5rem;
  }
  .day-col {
    margin-bottom: 0.35rem;
  }
  .day-foot {
    padding-bottom: calc(0.85rem + 0.25rem);
  }

  .masthead {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 0.55rem;
  }
  .masthead h1 { font-size: 1.55rem; letter-spacing: 0.08em; }
  .trip-name { min-width: 0; width: 100%; font-size: 1.05rem; }
  .masthead-actions {
    max-width: none;
    justify-content: flex-start;
    width: 100%;
  }
  .masthead-actions .btn {
    min-height: 44px;
    padding: 0.5rem 0.85rem;
    font-size: 0.86rem;
  }

  .btn {
    min-height: 44px;
    padding: 0.5rem 0.9rem;
  }
  .btn.sm { min-height: 44px; padding: 0.4rem 0.7rem; }
  .btn.icon {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }
  .act-tools .btn.icon,
  .day-date-row [data-act="del-day"] {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
  }

  input, select, textarea {
    font-size: 16px;
    padding: 0.5rem 0.6rem;
  }
  input[type="checkbox"] {
    width: 1.35rem;
    height: 1.35rem;
    min-width: 1.35rem;
  }

  /* 出發前：一列 disclosure */
  .checklist {
    padding: 0.45rem 0 0.15rem;
    align-items: stretch;
  }
  .checklist-details {
    display: block;
    width: 100%;
    background: #fffaf0;
    border: 1px solid var(--rule-strong);
    border-radius: 10px;
    padding: 0.15rem 0.7rem;
  }
  .checklist-details > summary {
    cursor: pointer;
    pointer-events: auto;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    font-family: var(--serif);
    font-size: 0.95rem;
  }
  .checklist-details > summary::-webkit-details-marker,
  .checklist-details > summary::marker {
    display: none;
    content: none;
  }
  .checklist-details > summary::after {
    content: "展開";
    color: var(--seal);
    font-family: var(--sans);
    font-weight: 600;
    font-size: 0.82rem;
  }
  .checklist-details[open] > summary::after { content: "摺疊"; }
  .checklist-row {
    padding: 0.15rem 0 0.55rem;
    gap: 0.4rem;
  }
  .check-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .check-item-lab { min-height: 36px; }
  .check-notes { font-size: 16px; min-height: 40px; }

  /* 頂欄 tabs 俾底欄取代 */
  .tabs { display: none; }

  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: var(--card);
    border-top: 1.5px solid var(--ink);
    box-shadow: 0 -8px 20px rgba(70, 52, 24, 0.08);
    padding: 0.2rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom, 0px));
  }
  .tabbar-btn {
    flex: 1;
    min-height: 44px;
    min-width: 0;
    border: none;
    background: transparent;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--ink-soft);
    border-radius: 10px;
    padding: 0.55rem 0.2rem;
  }
  .tabbar-btn.is-active {
    color: #fff8f2;
    background: var(--seal);
  }

  .panel {
    border: 1px solid var(--ink);
    border-radius: 0 0 10px 10px;
    padding: 0.85rem 0.7rem 1.1rem;
    min-height: 0;
  }

  .toast {
    bottom: calc(3.8rem + env(safe-area-inset-bottom, 0px));
  }

  .ad-banner {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    pointer-events: none !important;
  }

  /* 願望清單：疊成卡片 */
  .wish-table thead { display: none; }
  .wish-table,
  .wish-table tbody {
    display: block;
    width: 100%;
  }
  .wish-table tr {
    display: block;
    background: #fffdf8;
    border: 1px solid var(--rule-strong);
    border-radius: 10px;
    padding: 0.55rem 0.7rem 0.65rem;
    margin-bottom: 0.65rem;
  }
  .wish-table td {
    display: grid;
    grid-template-columns: 4.6rem 1fr;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    border-bottom: none;
    padding: 0.28rem 0;
  }
  .wish-table td::before {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 600;
  }
  .wish-table td:nth-child(1)::before { content: "已規劃"; }
  .wish-table td:nth-child(2)::before { content: "名稱"; }
  .wish-table td:nth-child(3)::before { content: "地區"; }
  .wish-table td:nth-child(4)::before { content: "類型"; }
  .wish-table td:nth-child(5)::before { content: "預計日期"; }
  .wish-table td:nth-child(6)::before { content: "詳細地址"; }
  .wish-table td:nth-child(7)::before { content: "備註"; }
  .wish-table td:nth-child(8)::before { content: none; }
  .wish-table td:nth-child(1),
  .wish-table .col-check { text-align: left; width: auto; }
  .wish-table td[colspan] {
    display: block;
    padding: 1rem 0.2rem;
  }
  .wish-table td[colspan]::before { content: none; }
  .wish-table tr.wish-edit,
  .wish-lock-card {
    position: relative;
  }
  .wish-table td.wish-actions {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 2.8rem;
    padding: 0.85rem 0 0.15rem !important;
    margin-top: 0.2rem;
    border-top: 1px dashed var(--rule);
  }
  .wish-table td.wish-actions::before { content: none !important; }
  .wish-actions .btn { flex: 0 0 auto; min-height: 36px; }
  .wish-actions .wish-btn-x {
    position: static;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    margin: 0;
  }
  .wish-actions .wish-btn-mid {
    margin: 0 auto;
  }
  .wish-actions .wish-btn-right {
    margin-left: 0;
  }
  .wish-table tr.wish-edit {
    padding-top: 0.7rem;
    padding-right: 0.7rem;
  }
  .wish-locked { padding: 0 !important; border: none !important; background: transparent !important; }
  .wish-lock-card {
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.7rem 0.7rem 0.65rem;
    background: #fffdf8;
    border: 1px solid var(--rule-strong);
    border-radius: 10px;
  }
  .wish-lock-tools {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    min-height: 2.4rem;
    margin: 0;
    padding-top: 0.45rem;
    border-top: 1px dashed var(--rule);
  }
  .wish-lock-tools .btn.sm {
    position: static;
    min-height: 36px;
    font-size: 0.76rem;
    padding: 0.25rem 0.7rem;
  }
  .wish-lock-tools .wish-btn-x {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    margin: 0;
  }
  .wish-lock-tools .wish-btn-mid { margin: 0 auto; }
  .wish-lock-tools .wish-btn-right { margin-left: 0; margin-right: 0; }
  .wish-lock-main { padding-right: 0; }
  .wish-add {
    grid-template-columns: 1fr;
  }
  .trip-range { width: 100%; }
  .trip-date-btn { flex: 1; min-width: 0; min-height: 44px; font-size: 16px; }
  .trip-cal-day { min-height: 44px; font-size: 16px; }
  .ymd { flex-wrap: wrap; }
  .ymd input { min-height: 44px; font-size: 16px; }
  .wish-add .btn { width: 100%; }

  /* 日程：橫滑日子欄 */
  .schedule-scroller {
    margin: 0 -0.7rem;
    padding: 0 0.7rem 0.6rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  .day-col {
    width: min(88vw, 300px);
    flex: 0 0 min(88vw, 300px);
    scroll-snap-align: start;
  }
  .day-col.is-folded {
    width: 7.6rem;
    flex: 0 0 7.6rem;
  }
  .btn.sm.fold-day {
    min-height: 26px;
    padding: 0.08rem 0.35rem;
  }
  .day-col.is-folded .fold-day {
    min-height: 2rem;
    font-size: 0.78rem;
    padding: 0.36rem 0.4rem;
  }
  .add-day {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
  .add-day-col {
    flex: 0 0 108px;
    width: 108px;
    scroll-snap-align: start;
  }
  .btn.add-days-many { min-height: 7rem; font-size: 0.92rem; }
  .act-time input {
    min-height: 34px;
    font-size: 15px;
    width: 3.35rem;
    min-width: 3.35rem;
  }
  .ymd input { font-size: 16px; min-height: 36px; }
  .act-time .btn.icon.time-plus,
  .act-time .btn.sm.icon.time-plus,
  .act-time .btn.icon[data-act="clear-time-end"],
  .act-time .btn.sm.icon[data-act="clear-time-end"],
  .act-time .time-plus,
  .act-time [data-act="clear-time-end"] {
    width: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    height: 22px !important;
    padding: 0 !important;
    font-size: 0.62rem !important;
    line-height: 1 !important;
  }
  .day-side-actions .btn,
  .day-side-actions .btn.sm {
    min-height: 1.75rem !important;
    height: auto !important;
    padding: 0.28rem 0.2rem !important;
    font-size: 0.62rem !important;
  }
  .btn.sm.addr-edit,
  .btn.sm.addr-ok {
    min-height: 28px;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
  }

  /* 花費分帳：找數在上，兩個大掣 sticky 跟住下面 */
  .exp-top { grid-template-columns: 1fr; }
  .settle {
    margin: 0 0 0.4rem;
    padding: 0.5rem 0.6rem 0.55rem;
    position: relative;
    z-index: 6;
  }
  #currency-panel {
    margin-bottom: 0.35rem;
    padding: 0.35rem 0.5rem 0.4rem;
  }
  #currency-panel .fx-block {
    margin: 0.15rem 0 0.1rem;
  }
  #currency-panel .fx-list {
    gap: 0.22rem;
    margin-top: 0.15rem;
  }
  .settle-folded-summary {
    font-size: 0.68rem;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .settle-head {
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.3rem;
  }
  #settle-section #btn-merge-settle,
  #currency-panel #btn-refresh-fx {
    min-height: 0;
    height: auto;
    padding: 0.12rem 0.4rem;
    font-size: 0.68rem;
  }
  .btn[data-act="toggle-settle"],
  .btn.settle-person,
  .btn[data-act="settle-all"],
  .btn[data-act="unsettle-all"] {
    min-height: 44px;
  }
  .exp-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 0.1rem 0 0.75rem;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card);
    padding: 0.35rem 0 0.5rem;
  }
  .exp-actions .btn {
    width: 100%;
    min-height: 48px;
    font-size: 0.95rem;
    font-weight: 600;
  }
  .exp-actions #btn-hide-settled {
    grid-column: 1 / -1;
    width: auto;
    min-width: 7.5rem;
    justify-self: end;
    margin-left: 0;
  }
  .charge-card { width: 100%; scroll-margin-top: 4.6rem; }
  .charge-meta label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: none;
    width: 100%;
    min-width: 0;
    font-size: 0.8rem;
  }
  .charge-meta {
    grid-template-columns: 1fr;
  }
  /* Dense edit UI: avoid 44px min-heights making unlock look zoomed */
  .charge-card.is-editing {
    padding: 0.55rem 0.65rem 0.5rem;
  }
  .charge-card.is-editing .charge-head {
    margin-bottom: 0.4rem;
    gap: 0.3rem 0.4rem;
  }
  .charge-card.is-editing input,
  .charge-card.is-editing select,
  .charge-card.is-editing textarea {
    font-size: 16px;
    min-height: 34px;
    padding: 0.28rem 0.45rem;
  }
  .charge-card.is-editing .share-row {
    gap: 0.3rem 0.45rem;
    padding: 0.1rem 0 0.25rem;
  }
  .charge-card.is-editing .share-row label {
    min-height: 34px;
    padding: 0.15rem 0.4rem;
    background: #efe6d2;
    border-radius: 999px;
  }
  .item-grid { grid-template-columns: 1fr; gap: 0.35rem; }
  .charge-card.is-editing .item-line {
    grid-template-columns: minmax(0, 1fr) 4.8rem auto;
    gap: 0.15rem;
    margin-bottom: 0.2rem;
  }
  .charge-card.is-editing .item-line input {
    min-height: 34px;
    font-size: 16px;
    padding: 0.25rem 0.4rem;
  }
  .charge-card.is-editing .item-line .item-notes {
    font-size: 16px;
    min-height: 34px;
    padding: 0.18rem 0.4rem;
  }
  .charge-card.is-editing .item-line .item-notes-toggle {
    grid-column: 1 / -1;
    justify-self: start;
    min-height: 28px;
    height: auto;
    padding: 0.1rem 0.45rem;
    font-size: 0.72rem;
    margin: 0;
  }
  .charge-card.is-editing .person-items {
    padding: 0.25rem 0.3rem 0.3rem;
  }
  .charge-card.is-editing .person-items.is-collapsed {
    padding: 0;
  }
  .charge-card.is-editing .person-items.is-collapsed .person-items-toggle {
    min-height: 36px;
    padding: 0.3rem 0.45rem;
    border-radius: 8px;
    background: #f3ead8;
  }
  .charge-card.is-editing .person-items.is-open {
    padding: 0.25rem 0.3rem 0.35rem;
  }
  .charge-card.is-editing .person-items.is-open .person-items-toggle {
    min-height: 32px;
    padding: 0.15rem 0.1rem;
  }
  .charge-card.is-editing .person-items h4 {
    font-size: 0.8rem;
  }
  .charge-card.is-editing .payers-editor {
    padding: 0.22rem 0.3rem 0.28rem;
    margin: 0.05rem 0 0.18rem;
  }
  .charge-card.is-editing .payers-head {
    margin-bottom: 0.15rem;
    font-size: 0.78rem;
  }
  .charge-card.is-editing .payer-row {
    gap: 0.15rem;
  }
  .charge-card.is-editing .charge-meta {
    gap: 0.22rem;
  }
  .charge-card.is-editing .charge-notes-lab {
    margin: 0.05rem 0 0.18rem;
  }
  .charge-card.is-editing .item-grid {
    gap: 0.22rem;
  }
  .charge-card.is-editing .person-items-body .btn.sm.ghost {
    min-height: 32px;
    margin-top: 0.05rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.78rem;
  }
  .charge-card.is-editing .charge-edit-confirm {
    margin: 0.45rem 0 0.1rem;
  }
  .charge-card.is-editing .charge-confirm-btn {
    min-width: 6.5rem;
    min-height: 36px;
    padding: 0.35rem 1.35rem;
    font-size: 0.86rem;
    letter-spacing: 0.1em;
  }
  .charge-card.is-editing .charge-foot {
    margin-top: 0.35rem;
    padding: 0.28rem 0.45rem;
    font-size: 0.78rem;
  }
  .charge-card.is-editing .btn.sm.danger.icon {
    width: 34px;
    height: 34px;
    min-height: 34px;
    min-width: 34px;
  }
  /* non-editing share/item fallbacks (locked cards don't use these inputs) */
  .share-row label {
    min-height: 44px;
    padding: 0.25rem 0.45rem;
    background: #efe6d2;
    border-radius: 999px;
  }
  .item-line {
    grid-template-columns: minmax(0, 1fr) 4.8rem auto;
    gap: 0.2rem;
    margin-bottom: 0.3rem;
  }

  .people-event-date-lab { margin-bottom: 0.65rem; }
  .people-event-date {
    min-height: 44px;
    font-size: 16px;
    padding: 0.5rem 0.65rem;
    width: auto;
    max-width: 11.5rem;
  }
  .event-date-head #btn-meta-lock,
  .event-date-head #btn-meta-fold {
    min-height: 32px;
    font-size: 0.74rem;
    padding: 0.15rem 0.55rem;
  }
  .event-date-extend-custom input {
    min-height: 36px;
    font-size: 16px;
  }
  .people-add {
    width: 100%;
    max-width: 100%;
  }
  .people-add input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
    font-size: 16px;
  }
  .people-add .btn {
    flex: 0 0 auto;
    min-height: 44px;
  }
  #settle-section {
    overflow: visible;
  }
  #settle-section .settle-body {
    overflow: visible;
  }
  .bal-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
  }
  .bal-card {
    min-width: 0;
    padding: 0.55rem 0.65rem 0.6rem;
    overflow: visible;
  }
  .bal-card .settle-clear {
    min-height: 36px;
    padding: 0.28rem 0.7rem;
    font-size: 0.82rem;
    width: auto;
  }
  .settle {
    overflow: visible;
    padding-bottom: 0.75rem;
  }
  .page {
    padding-bottom: calc(8.5rem + env(safe-area-inset-bottom, 0px));
  }
  .person-chip { min-height: 44px; padding: 0.2rem 0.3rem 0.2rem 0.6rem; }
  .person-chip input { font-size: 16px; width: 6.2rem; }
  .btn.sm.people-toggle { min-height: 32px; font-size: 0.74rem; padding: 0.15rem 0.55rem; }
  .person-tag { font-size: 0.8rem; }

  #fx-rate { max-width: none; width: 100%; min-height: 44px; font-size: 16px; }

  .fx-row {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.25rem;
  }
  .fx-code-wrap {
    flex: 0 1 7rem;
    max-width: 7rem;
  }
  .fx-code,
  .fx-rate {
    width: auto;
    max-width: 7rem;
    min-height: 2rem;
    font-size: 0.82rem;
  }
  .fx-rate {
    width: 5.6rem;
    flex: 0 0 auto;
  }
  .fx-eq, .fx-hkd { font-size: 0.78rem; }
  .btn.sm.fx-toggle { min-height: 28px; font-size: 0.7rem; padding: 0.1rem 0.45rem; }
  .fx-chip { font-size: 0.68rem; }
  .fx-add,
  .settle-clear {
    min-height: 44px;
  }
  #currency-panel #btn-refresh-fx {
    min-height: 0;
  }
  .settle-head-actions {
    width: auto;
    gap: 0.2rem;
    margin: 0;
  }
  .settle-head-actions .btn {
    min-height: 0;
    flex: 0 1 auto;
  }
  .fx-code-search {
    max-height: 2rem;
    min-height: 1.9rem;
    font-size: 0.78rem;
    padding: 0.15rem 0.35rem;
  }
  .fx-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.2rem;
  }
  .fx-edit-actions .btn {
    min-height: 32px;
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
  }

  .settle {
    margin-top: 0;
  }

  .modal-card { width: min(26rem, 100%); }
  .modal-actions .btn { min-height: 44px; min-width: 5.5rem; }
}


/* —— 列印／PDF：放最後，蓋過手機樣式 —— */
@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  html, body {
    background: #fff !important;
    color: #111 !important;
    min-height: 0 !important;
    padding: 0 !important;
  }

  .notebook,
  .page,
  .panel,
  .day-col,
  .charge-card,
  .exp-people,
  .exp-rate,
  .wish-table tr,
  .person-items,
  .bal-card,
  .debt-item,
  .day-head,
  .day-foot,
  .checklist-details {
    background: #fff !important;
    box-shadow: none !important;
  }

  .notebook {
    margin: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    border-radius: 0 !important;
  }
  .notebook::before { display: none !important; }
  .page { padding: 0 !important; }

  .binding,
  .ad-banner,
  .masthead-actions,
  .tabs,
  .tabbar,
  #tabbar,
  .act-tools,
  .time-plus,
  [data-act="add-time-end"],
  [data-act="clear-time-end"],
  .add-day,
  .act-add-bottom,
  .fold-day,
  .schedule-fold-actions,
  .settle-chip,
  .addr-edit,
  .wish-add,
  .people-add,
  .exp-actions,
  .wish-actions,
  .settle-picker,
  #btn-merge-settle,
  #btn-refresh-fx,
  [data-act="add-fx"],
  [data-act="del-fx"],
  [data-act="clear-person"],
  .settle-clear,
  [data-act="toggle-settle"],
  .trip-cal,
  #trip-cal,
  .modal,
  #modal,
  #unarchive-modal,
  #tags-modal,
  #move-days-modal,
  #move-acts-modal,
  .toast,
  #toast,
  #import-file {
    display: none !important;
  }

  .day-col.is-folded {
    width: 300px !important;
  }
  .day-col.is-folded .theme-label,
  .day-col.is-folded .act-list,
  .day-col.is-folded .day-foot,
  .day-col.is-folded .date-input {
    display: revert !important;
  }

  .panel,
  .panel[hidden],
  #panel-wishlist,
  #panel-schedule,
  #panel-expenses {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
    min-height: 0 !important;
    border: 1px solid #222 !important;
    border-radius: 0 !important;
    padding: 0.7rem 0.6rem 1rem !important;
    page-break-inside: auto;
  }

  #panel-schedule,
  #panel-expenses {
    break-before: page;
    margin-top: 0.8rem;
  }

  .panel::before {
    display: block;
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.55rem;
    padding-bottom: 0.2rem;
    border-bottom: 1.5px solid #111;
    color: #111;
  }
  #panel-wishlist::before { content: "出發前準備"; }
  #panel-schedule::before { content: "日程表"; }
  #panel-expenses::before { content: "花費分帳"; }

  .masthead {
    border-bottom: 1.5px solid #111 !important;
    margin-bottom: 0.6rem;
  }
  .masthead h1 { color: #111 !important; }
  .trip-name {
    border: none !important;
    border-bottom: 1px solid #111 !important;
    background: transparent !important;
  }

  input, select, textarea {
    border: none !important;
    background: transparent !important;
    color: #111 !important;
    box-shadow: none !important;
    outline: none !important;
  }

  .schedule-scroller {
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .schedule-track {
    display: flex !important;
    flex-wrap: wrap !important;
    width: auto !important;
    max-width: 100% !important;
    min-height: 0 !important;
  }
  .day-col {
    width: calc(50% - 8px) !important;
    flex: 0 0 calc(50% - 8px) !important;
    max-width: none !important;
    break-inside: avoid;
    border: 1px solid #333 !important;
  }

  .settle,
  .settle-body,
  .bal-grid,
  .debt-list {
    display: block !important;
    visibility: visible !important;
  }
  .settle {
    margin-top: 0 !important;
    margin-bottom: 0.7rem !important;
    break-inside: avoid;
  }
  .charge-card.is-locked { background: #fff !important; }
  .bal-grid {
    display: grid !important;
  }
  .debt-list {
    display: flex !important;
  }

  .wish-table { display: table !important; width: 100% !important; }
  .wish-table thead { display: table-header-group !important; }
  .wish-table tbody { display: table-row-group !important; }
  .wish-table tr { display: table-row !important; margin: 0 !important; padding: 0 !important; border: none !important; }
  .wish-table th, .wish-table td {
    display: table-cell !important;
    border-bottom: 1px solid #ccc !important;
    color: #111 !important;
  }
  .wish-table td::before { content: none !important; display: none !important; }
  .wish-table td:last-child { display: none !important; }
  .wish-table th:last-child { display: none !important; }

  .charge-card, .debt-item, .bal-card { break-inside: avoid; border-color: #333 !important; }
  .pos, .neg { color: #111 !important; }

  .exp-actions { position: static !important; }
}

.settings-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
  color: var(--navy);
}
.settings-card {
  margin-top: 0.85rem;
  padding: 0.85rem 0.9rem 1rem;
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
}
.settings-card h4 {
  font-family: var(--serif);
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--navy);
}
.settings-label {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.settings-label .fx-code-search {
  margin-top: 0.25rem;
  display: block;
  width: 100%;
  min-height: 2.4rem;
  max-height: 2.6rem;
  box-sizing: border-box;
}
.settings-suggest {
  position: static;
  margin-top: 0.35rem;
  max-height: 12rem;
}
.settings-current {
  margin: 0.55rem 0 0;
  font-weight: 700;
  color: var(--navy);
  font-size: 0.92rem;
}

.auth-box { margin-top: 0.55rem; }
.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}
#auth-email {
  margin-top: 0.25rem;
  display: block;
  width: 100%;
  min-height: 2.4rem;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}
#auth-setup-hint code { font-size: 0.85em; }

.save-fold {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}
.save-fold > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.save-fold > summary::-webkit-details-marker { display: none; }
.save-fold-summary.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.save-fold-summary.btn::after {
  content: "▾";
  font-size: 0.75em;
  opacity: 0.75;
}
.save-fold[open] .save-fold-summary.btn::after { content: "▴"; }
.save-fold-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 40;
  min-width: 10.5rem;
  padding: 0.4rem;
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(40, 30, 20, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.save-fold-item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}
.save-fold-item.danger {
  margin-top: 0.2rem;
  color: var(--seal);
  border-color: #e0b8b0;
  background: #fff6f3;
}
.save-fold-item.danger:hover {
  background: #ffeee9;
}

@media (max-width: 760px) {
  .save-fold { display: block; width: 100%; }
  .save-fold-summary.btn { width: 100%; justify-content: center; }
  .save-fold-panel {
    position: static;
    margin-top: 0.35rem;
    box-shadow: none;
    min-width: 0;
  }
}



/* Email / encrypt / JSON backup / export-docs modal fields */
#email-export-modal .settings-label,
#encrypt-export-modal .settings-label,
#encrypt-import-modal .settings-label,
#json-backup-modal .settings-label {
  display: block;
  margin: 0.65rem 0 0;
}
#email-export-modal .settings-label input,
#encrypt-export-modal .settings-label input,
#encrypt-import-modal .settings-label input,
#json-backup-modal .settings-label input {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  box-sizing: border-box;
}

.modal-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0.35rem;
}
.modal-choice-row .btn {
  flex: 1 1 8rem;
  justify-content: center;
  text-align: center;
}
#json-backup-modal .json-backup-step {
  margin-top: 0.25rem;
}
#json-backup-pass-fields {
  margin-top: 0.35rem;
}

.save-fold-hint {
  margin: 0.15rem 0.2rem 0.35rem;
  font-size: 0.72rem;
  line-height: 1.35;
  max-width: 16rem;
}
@media (max-width: 720px) {
  .save-fold-hint { max-width: none; }
}

#settle-section .settle-head {
  margin-bottom: 0.35rem;
}
#settle-section #btn-merge-settle {
  flex: 0 0 auto;
}

.base-currency-block {
  margin: 0 0 0.55rem;
}
.base-currency-block .settings-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
}
.base-currency-block .fx-code-search {
  margin-top: 0.25rem;
  width: 100%;
  max-width: 16rem;
  box-sizing: border-box;
}
.base-currency-block .settings-current {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
}

.modal-card {
  max-width: calc(100vw - 2rem);
  overflow: hidden;
  box-sizing: border-box;
}
.modal-day-label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0.55rem;
}
#modal-day {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.wish-lock-tools .wish-btn-mid {
  margin-left: 0;
}
@media (max-width: 760px) {
  .wish-lock-tools {
    justify-content: space-between;
  }
  .wish-lock-tools .wish-btn-mid {
    margin: 0 auto;
  }
}

#hub-home-card .hub-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.35rem;
}
#hub-home-card .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: 0;
}

/* cloud share modal */
.cloud-save-card {
  width: min(36rem, 100%);
  max-height: calc(100dvh - 5.5rem);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}
#cloud-save-modal.modal {
  align-items: flex-start;
  padding: 0.55rem 0.55rem calc(4.25rem + env(safe-area-inset-bottom, 0px));
}
.cloud-modal-head #cloud-help-open { flex: 0 0 auto; }
.cloud-section-head { flex-wrap: wrap; }
.cloud-section { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px dashed rgba(90,70,40,0.28); }
.cloud-section:first-of-type { border-top: 0; padding-top: 0; }
.cloud-section-title { margin: 0 0 0.35rem; font-size: 1.02rem; font-family: var(--serif); }
.cloud-list { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.45rem; }
.cloud-row { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.55rem 0.6rem; border: 1px solid rgba(90,70,40,0.18); border-radius: 10px; background: rgba(255,252,245,0.7); }
.cloud-row-main { display: flex; flex-direction: column; gap: 0.15rem; }
.cloud-row-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cloud-token-line { display: block; font-size: 0.72rem; word-break: break-all; opacity: 0.85; margin-top: 0.15rem; }
#cloud-import-token { width: 100%; }

.share-view-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.75rem;
  background: linear-gradient(90deg, rgba(255, 236, 179, 0.95), rgba(255, 220, 160, 0.95));
  border-bottom: 1px solid rgba(90, 70, 40, 0.25);
  color: #5a4020;
  font-size: 0.92rem;
  text-align: center;
}
.share-view-banner[hidden] { display: none !important; }
.cloud-member-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.86rem;
}
.cloud-member-row select {
  font-size: 0.86rem;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  border: 1px solid rgba(90,70,40,0.28);
  background: #fffef8;
}
.cloud-members-box {
  margin-top: 0.35rem;
  padding-top: 0.3rem;
  border-top: 1px dashed rgba(90,70,40,0.2);
}


.membership-row{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem .85rem;margin:.35rem 0 .5rem}
.membership-row .membership-tier{margin:0}
.admin-entry-link{font-size:.92rem;font-weight:600;color:#8b3a2f;text-decoration:underline;text-underline-offset:2px}
.admin-entry-link:hover{color:#5c241c}


/* create-share disabled */
.btn:disabled,
.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
#cloud-create-share[disabled],
#cloud-create-share.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cloud-title-row{display:flex;flex-wrap:wrap;align-items:center;gap:.35rem .55rem;justify-content:space-between}
.cloud-title-row strong{margin:0;flex:1;min-width:0}
.cloud-title-actions{display:inline-flex;flex-wrap:wrap;gap:.35rem;margin-left:auto}
.cloud-row-actions{align-items:center}
.cloud-row-actions{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:0.35rem;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}
.cloud-row-actions .btn.sm{flex:0 0 auto; white-space:nowrap}
.cloud-row-save{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:0.35rem;
  margin-top:0.2rem;
}
.cloud-row-save .cloud-save-here{margin-left:0}
.cloud-fold-btn{flex:0 0 auto; margin-left:0}
.cloud-title-end{display:inline-flex;align-items:center;gap:.35rem;margin-left:auto;flex:0 0 auto}
.cloud-fold-btn{margin-left:0}

.cloud-row-compact{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:0.3rem;
}
.cloud-row-compact .btn.sm{
  flex:1 1 0;
  min-width:0;
  white-space:nowrap;
  font-size:0.68rem;
  padding:0.16rem 0.28rem;
  min-height:1.65rem;
  line-height:1.15;
}
.cloud-fold-all-row{
  display:flex;
  gap:0.35rem;
  margin:0.35rem 0 0.15rem;
}
.cloud-row-under-title{
  display:flex;
  flex-wrap:wrap;
  gap:0.35rem;
  margin-top:0.25rem;
}
.cloud-row.is-folded .cloud-title-actions,
.cloud-row.is-folded .cloud-row-under-title,
.cloud-row.is-folded .cloud-row-meta,
.cloud-row.is-folded .cloud-row-extra{display:none !important}
.cloud-row.is-folded .cloud-row-compact{display:flex}
.cloud-row:not(.is-folded) .cloud-row-compact{display:none}

.preview-badge{
  display:inline-block;
  margin-left:0.4rem;
  padding:0.08rem 0.38rem;
  border-radius:999px;
  background:#2f6f4e;
  color:#fff;
  font-size:0.62rem;
  font-weight:700;
  letter-spacing:0.04em;
  vertical-align:middle;
}


button.is-disabled, .btn.is-disabled{opacity:.55;cursor:not-allowed}

.ad-banner .ad-slot { width: 100%; min-height: 0; }
.ad-banner .ad-privacy { margin-left: auto; font-size: 0.75rem; opacity: 0.75; }
.ad-banner[hidden] { display: none !important; }

.cloud-link-box { margin-top: 0.35rem; }
.cloud-link-box[hidden] { display: none !important; }
.cloud-link-box .cloud-token-line { display: block; word-break: break-all; overflow-wrap: anywhere; }

.cloud-modal-head{display:flex;align-items:center;justify-content:space-between;gap:.5rem;flex-wrap:nowrap}
.cloud-modal-head h3{margin:0;flex:1;min-width:0}
.cloud-section-head{
  display:flex;
  align-items:center;
  gap:.4rem;
  flex-wrap:wrap;
  margin-bottom:.35rem;
}
.cloud-section-head .cloud-section-title{margin:0;flex:0 1 auto;}
.cloud-section-head #cloud-save-refresh{margin-left:auto;}


/* Amount calculator popover */
.amount-with-calc {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  width: 100%;
}
.amount-with-calc input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
}
.amount-calc-btn {
  flex: 0 0 auto;
  min-width: 1.85rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.78rem;
  line-height: 1.1;
}
.payer-row {
  grid-template-columns: minmax(5rem, 1fr) minmax(5.5rem, 7rem) auto;
}
.charge-meta .amount-lab {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.2rem !important;
  flex-wrap: nowrap !important;
  width: 100%;
  text-align: left;
}
.charge-meta .amount-lab .amount-with-calc {
  width: auto;
  min-width: 6.5rem;
}
.amt-calc-pop {
  position: fixed;
  z-index: 9200;
  box-sizing: border-box;
  padding: 0.55rem;
  border: 1px solid var(--rule-strong, #c9b896);
  border-radius: 10px;
  background: #fffdf7;
  box-shadow: 0 10px 28px rgba(40, 28, 10, 0.18);
}
.amt-calc-pop[hidden] { display: none !important; }
.amt-calc-display {
  margin-bottom: 0.4rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  background: #f3ead7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  text-align: right;
  word-break: break-all;
  min-height: 1.6em;
}
.amt-calc-keys {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.28rem;
}
.amt-calc-key {
  min-height: 2.15rem;
  border: 1px solid var(--rule, #d8c9a8);
  border-radius: 7px;
  background: #fff;
  color: var(--ink, #2a2116);
  font-size: 0.95rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.amt-calc-key:active { background: #efe6d2; }
.amt-calc-key.op { background: #f7f0e2; font-weight: 600; }
.amt-calc-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-top: 0.45rem;
}
@media (max-width: 520px) {
  .payer-row {
    grid-template-columns: minmax(4.5rem, 1fr) minmax(5rem, 1.2fr) auto;
  }
  .amt-calc-key { min-height: 2.35rem; }
}



.charges-section.settle {
  margin: 0 0 0.65rem;
}
.charges-section-head {
  margin-bottom: 0;
}
.charges-section:not(.is-folded) .charges-section-head {
  margin-bottom: 0.35rem;
}
.charges-section-body[hidden] {
  display: none !important;
}
.charges-section.is-folded {
  padding-bottom: 0.2rem;
}


/* 雲端：匯入好友風琴摺疊（預設收起） */
.cloud-fold-section { padding-top: 0.85rem; }
.cloud-fold-details {
  border: 1px solid rgba(90, 70, 40, 0.22);
  border-radius: 12px;
  background: rgba(255, 252, 245, 0.75);
  padding: 0.35rem 0.55rem 0.55rem;
}
.cloud-fold-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
  padding: 0.25rem 0.1rem;
  margin: 0;
}
.cloud-fold-summary::-webkit-details-marker { display: none; }
.cloud-fold-summary::marker { content: ""; }
.cloud-fold-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
}
.cloud-fold-toggle.btn { flex: 0 0 auto; margin: 0; pointer-events: none; }
.cloud-fold-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(90, 70, 40, 0.2);
  margin-top: 0.3rem;
}
.cloud-fold-sub { margin-top: 0.65rem; }


.cloud-help-fold { margin: 0.35rem 0 0.75rem; }
.cloud-help-list {
  margin: 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.cloud-help-list li {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink);
}
#cloud-share-limits { font-weight: 600; }

.discount-box { margin: 0.25rem 0 0.15rem; width: 100%; }
.discount-toggle { font-size: 0.82rem; font-weight: 600; color: var(--navy); }
.discount-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.35rem 0.4rem;
  margin-top: 0.3rem;
  width: 100%;
  align-items: end;
}
.discount-fields > label {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.72rem;
  font-weight: 600;
  min-width: 0;
}
.discount-fields input[type="number"] {
  width: 8.2rem;
  max-width: 8.2rem;
  height: 2.4rem;
  min-height: 2.4rem;
  max-height: 2.4rem;
  padding: 0.25rem 0.45rem;
  font-size: 0.92rem;
  box-sizing: border-box;
  line-height: 1.2;
}
.discount-fields .amount-with-calc { width: 100%; }
.discount-fields .hint { grid-column: 1 / -1; margin: 0; font-size: 0.72rem; }
.discount-fields.is-single { grid-template-columns: minmax(0, 14rem); }
.charge-meta.is-stacked .amount-lab .amount-with-calc {
  max-width: 14rem;
}
.charge-meta.is-stacked .amount-lab input[type="number"],
.discount-fields.is-single input[type="number"] {
  width: 8.2rem;
  max-width: 8.2rem;
  height: 2.4rem;
  min-height: 2.4rem;
  max-height: 2.4rem;
  flex: 0 0 8.2rem;
}
.discount-owed {
  margin: 0.35rem 0 0.15rem;
  border: 1px dashed var(--rule-strong);
  border-radius: 8px;
  background: #fffdf8;
  padding: 0.15rem 0.55rem 0.25rem;
}
.discount-owed summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  list-style: none;
  padding: 0.35rem 0;
}
.discount-owed summary::-webkit-details-marker { display: none; }
.discount-owed summary::after { content: " ▸"; font-weight: 500; color: var(--muted); }
.discount-owed[open] summary::after { content: " ▾"; }
.discount-owed-list { list-style: none; margin: 0 0 0.25rem; padding: 0; }
.discount-owed-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.18rem 0;
  border-top: 1px dashed var(--rule);
  font-size: 0.82rem;
}

.cloud-row-save-left{display:inline-flex;align-items:center;gap:.3rem}
