:root{
  --teal:#1B7A73; --teal-dark:#10534E;
  --coral:#C05A42; --coral-dark:#8E3F2D;
  --sand:#F6EFE3; --paper:#FFFDF8;
  --ink:#2A2D2F; --ink-soft:#5B5F62;
  --line:#2A2D2F;
  --ok:#2F9E5B;
}
*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
body{
  margin:0; background:var(--sand); color:var(--ink);
  font-family:"Noto Sans TC",-apple-system,sans-serif;
  -webkit-font-smoothing:antialiased;
  padding-bottom:60px;
}
h1,h2,h3{margin:0;}
a{color:inherit;}

/* ---------- HEADER ---------- */
header.top{
  position:relative; overflow:hidden;
  background:linear-gradient(160deg,var(--teal-dark),var(--teal));
  color:#fff; padding:40px 20px 28px; text-align:center;
}
.header-pattern{
  position:absolute; right:-40px; top:-40px; z-index:0;
  font-size:200px; line-height:1; opacity:.09;
  transform:rotate(-14deg); pointer-events:none;
}
header.top h1{
  position:relative; z-index:1;
  font-size:clamp(27px,5vw,38px); font-weight:800; letter-spacing:.2px; line-height:1.15;
}

.countdown{
  position:relative; z-index:1;
  margin:26px auto 0; max-width:260px;
  border-top:1px solid rgba(255,255,255,.3); border-bottom:1px solid rgba(255,255,255,.3);
  padding:16px 0;
}
.countdown .num{font-size:42px; font-weight:800; line-height:1; font-variant-numeric:tabular-nums; letter-spacing:-.5px;}
.countdown .label{font-size:12.5px; font-weight:600; margin-top:6px; opacity:.8; letter-spacing:.2px;}

.summary-row{
  position:relative; z-index:1;
  display:flex; justify-content:center; flex-wrap:wrap; margin-top:20px;
  font-size:12.5px; font-weight:600; opacity:.85; letter-spacing:.2px;
}
.summary-chip{background:none; color:#fff; font-weight:inherit; font-size:inherit; padding:0; border:none; border-radius:0;}
.summary-chip:not(:last-child)::after{content:"·"; margin:0 10px; opacity:.5;}

.city-bar{
  position:relative; z-index:1;
  display:flex; max-width:560px; margin:22px auto 0; height:28px;
  border-radius:8px; overflow:hidden; border:1px solid rgba(255,255,255,.35);
}
.city-bar .seg{
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700; color:#fff; white-space:nowrap; overflow:hidden; opacity:.95;
}
.city-legend{
  position:relative; z-index:1;
  display:flex; justify-content:center; gap:14px; flex-wrap:wrap; margin-top:8px; font-size:11.5px; opacity:.85;
}
.city-legend span{display:inline-flex; align-items:center; gap:5px; font-weight:600;}
.city-legend i{width:9px; height:9px; border-radius:3px; display:inline-block;}

/* ---------- TABS ---------- */
nav.tabs{
  position:sticky; top:0; z-index:10;
  display:flex; overflow-x:auto; background:var(--paper);
  border-bottom:3px solid var(--line);
}
nav.tabs button{
  flex:1 0 auto; border:none; background:none; cursor:pointer;
  font-family:inherit; font-weight:800; font-size:13.5px; color:var(--ink-soft);
  padding:13px 16px; border-bottom:4px solid transparent; white-space:nowrap;
}
nav.tabs button.active{color:var(--coral-dark); border-bottom-color:var(--coral);}

main{max-width:760px; margin:0 auto; padding:22px 16px 10px;}
.panel{display:none;}
.panel.active{display:block;}

/* ---------- CARD ---------- */
.card{
  background:var(--paper); border:3px solid var(--line); border-radius:20px;
  box-shadow:6px 6px 0 rgba(42,45,47,.10); padding:18px 20px; margin-bottom:18px;
}
.card h2{font-size:18px; font-weight:900; margin-bottom:12px; display:flex; align-items:center; gap:8px;}
.card h2 .tag{
  font-size:11px; font-weight:800; background:var(--teal); color:#fff;
  padding:2px 9px; border-radius:999px; letter-spacing:1px;
}

/* map + flights */
.leaflet-map{
  width:100%; height:320px; border-radius:14px; border:3px solid var(--line); margin-bottom:10px;
  background:#eee;
}
.map-legend{display:flex; flex-wrap:wrap; gap:10px; margin-bottom:12px; font-size:12px; font-weight:700;}
.map-legend span{display:inline-flex; align-items:center; gap:5px;}
.map-legend i{width:12px; height:12px; border-radius:50%; display:inline-block; border:2px solid #fff; box-shadow:0 0 0 1.5px var(--line);}
.map-pin{
  border-radius:50%; display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:800; font-size:11px; border:2px solid #fff; box-shadow:0 1px 4px rgba(0,0,0,.4);
}
.map-link{
  display:inline-flex; align-items:center; gap:8px; background:var(--teal); color:#fff;
  font-weight:800; font-size:13.5px; padding:9px 16px; border-radius:12px; text-decoration:none;
  border:2px solid var(--teal-dark); margin-bottom:14px;
}
.flight-card{
  border:2px solid var(--line); border-radius:14px; padding:12px 14px; margin-bottom:10px; background:#fff;
}
.flight-card .dir{
  display:inline-block; font-size:11px; font-weight:800; background:var(--coral); color:#fff;
  padding:2px 9px; border-radius:999px; margin-bottom:6px;
}
.flight-card .route{display:flex; justify-content:space-between; align-items:center; font-weight:800; font-size:14px; flex-wrap:wrap; gap:6px;}
.flight-card .meta{font-size:12.5px; color:var(--ink-soft); margin-top:4px;}

.hotel-row{
  display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap;
  border:2px solid var(--line); border-radius:14px; padding:10px 14px; margin-bottom:8px; background:#fff;
}
.hotel-row .h-name{font-weight:800; font-size:14px;}
.hotel-row .h-meta{font-size:12.5px; color:var(--ink-soft);}
.hotel-row a{
  font-size:12.5px; font-weight:800; color:var(--teal-dark); text-decoration:none;
  border:2px solid var(--teal-dark); padding:4px 10px; border-radius:10px; white-space:nowrap;
}

/* daily timeline */
.day-block{border:2px solid var(--line); border-radius:16px; margin-bottom:16px; overflow:hidden; background:#fff;}
.day-block .d-head{
  background:var(--coral); color:#fff; padding:10px 16px; font-weight:900; font-size:14px;
  display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px;
}
.day-block .d-sub{font-size:12px; font-weight:700; opacity:.95; margin-top:2px; width:100%;}
.event-row{display:flex; gap:10px; padding:10px 16px; border-bottom:1px dashed #ddd;}
.event-row:last-child{border-bottom:none;}
.event-row .ic{font-size:19px; flex:0 0 auto; width:30px; text-align:center;}
.event-body{flex:1 1 auto; min-width:0;}
.event-top{display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:3px;}
.event-row .time{display:inline-block; font-weight:800; font-size:12px; background:var(--ink); color:#fff; padding:1px 8px; border-radius:7px;}
.event-row h4{font-size:14.5px; font-weight:800; margin:2px 0 1px;}
.event-row p{font-size:12.5px; color:var(--ink-soft); margin:0;}
.event-map-link{
  display:inline-flex; align-items:center; gap:4px; font-size:11.5px; font-weight:800;
  color:var(--teal-dark); text-decoration:none; border:2px solid var(--teal-dark); padding:3px 9px; border-radius:999px;
}
.luggage-note{
  margin:0 16px 12px; font-size:12.5px; background:var(--sand); border:2px dashed var(--teal);
  border-radius:10px; padding:8px 12px;
}

/* packing */
.pack-cat{margin-bottom:16px;}
.pack-cat h3{font-size:14.5px; font-weight:900; margin-bottom:8px; color:var(--teal-dark);}
.pack-item{
  display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:10px;
  border:2px solid #e7ddc7; margin-bottom:6px; background:#fff; cursor:pointer;
}
.pack-item input{width:18px; height:18px; accent-color:var(--teal);}
.pack-item span{font-size:13.5px; font-weight:600; flex:1 1 auto;}
.pack-item.checked{background:#EAF6EF; border-color:var(--ok);}
.pack-item.checked span{text-decoration:line-through; color:var(--ink-soft);}
.pack-progress{font-size:12.5px; color:var(--ink-soft); margin-bottom:14px; font-weight:700;}
.item-remove{
  border:none; background:none; color:var(--coral-dark); font-size:15px; cursor:pointer;
  font-family:inherit; padding:2px 4px; flex:0 0 auto; line-height:1;
}

.add-row{display:flex; gap:8px; margin-bottom:14px;}
.add-row input{
  flex:1 1 auto; font-size:13.5px; padding:9px 12px; border-radius:10px;
  border:2px solid var(--line); font-family:inherit; min-width:0;
}
.add-row button{
  font-size:13px; font-weight:800; color:#fff; background:var(--teal); border:2px solid var(--teal-dark);
  padding:0 16px; border-radius:10px; cursor:pointer; font-family:inherit; white-space:nowrap;
}
.add-row button:hover{background:var(--teal-dark);}

/* currency */
.rate-display{
  text-align:center; background:var(--sand); border:2px solid var(--teal); border-radius:14px;
  padding:14px; margin-bottom:16px; font-weight:800;
}
.rate-display .big{font-size:22px; color:var(--teal-dark);}
.rate-display .updated{font-size:11px; color:var(--ink-soft); font-weight:600; margin-top:4px;}
.conv-row{display:flex; gap:10px; align-items:center; justify-content:center; margin-bottom:6px;}
.conv-row input{
  flex:0 0 auto; width:150px; max-width:50%; font-size:20px; font-weight:800; padding:10px 12px; border-radius:12px;
  border:2px solid var(--line); font-family:inherit;
}
.conv-arrow{text-align:center; font-size:20px; font-weight:800; color:var(--ink-soft); margin-bottom:6px;}
.conv-result{font-size:24px; font-weight:900; color:var(--coral-dark); text-align:center; margin-bottom:14px;}
.quick-amounts{display:flex; flex-wrap:wrap; gap:8px; justify-content:center;}
.quick-amounts button{
  border:2px solid var(--teal-dark); background:#fff; color:var(--teal-dark); font-weight:800;
  font-size:13px; padding:7px 14px; border-radius:999px; cursor:pointer; font-family:inherit;
}
.quick-amounts button:hover{background:var(--teal); color:#fff;}

/* whoami */
.whoami-picker{display:flex; flex-wrap:wrap; gap:8px; align-items:center;}
.whoami-btn{
  font-size:13px; font-weight:800; color:var(--ink); background:#fff; border:2px solid var(--line);
  padding:7px 14px; border-radius:999px; cursor:pointer; font-family:inherit;
}
.whoami-btn.active{color:#fff; background:var(--teal); border-color:var(--teal-dark);}

/* expenses */
.currency-fold summary{font-size:18px; font-weight:900; cursor:pointer;}
.currency-fold .rate-display{margin-top:12px;}

.expense-total{
  text-align:center; font-size:18px; font-weight:900; color:var(--coral-dark);
  background:var(--sand); border:2px solid var(--coral); border-radius:12px; padding:10px; margin-bottom:12px;
}
.balance-summary{margin-bottom:8px;}
.balance-row{
  display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap;
  font-size:13px; font-weight:700; padding:8px 10px; border-bottom:1px dashed #ddd;
}
.balance-row:last-child{border-bottom:none;}
.balance-row .credit{color:var(--ok);}
.balance-row .debit{color:var(--coral-dark);}
.settle-row{
  font-size:13px; font-weight:800; padding:8px 10px; border:2px solid var(--teal); border-radius:10px;
  margin-top:6px; background:#fff;
}

.expense-cat{margin-bottom:16px;}
.expense-cat h3{font-size:14.5px; font-weight:900; margin-bottom:8px; color:var(--teal-dark);}
.expense-row{
  border:2px solid var(--line); border-radius:12px; padding:10px 12px; margin-bottom:8px; background:#fff;
}
.expense-main{display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:4px;}
.e-amount{font-weight:900; font-size:15px; color:var(--coral-dark);}
.e-store{font-weight:700; font-size:13px; flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.expense-sub{display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap; font-size:12px; color:var(--ink-soft); margin-bottom:6px;}
.sharer-chips{display:flex; gap:5px; flex-wrap:wrap;}
.sharer-chip{
  font-size:11px; font-weight:800; background:var(--sand); border:1.5px solid var(--line);
  padding:1px 8px; border-radius:999px; white-space:nowrap;
}
.expense-actions{display:flex; gap:10px; align-items:center; font-size:12.5px;}
.expense-actions a{color:var(--teal-dark); font-weight:700; text-decoration:none;}
.expense-actions button{border:none; background:none; color:var(--coral-dark); cursor:pointer; font-size:13px; font-family:inherit;}

.expense-form, .expense-edit-form{
  display:flex; flex-direction:column; gap:10px; border:2px dashed var(--teal); border-radius:12px;
  padding:14px; margin-bottom:14px; background:var(--sand);
}
.expense-form label, .expense-edit-form label{font-size:12.5px; font-weight:800; display:flex; flex-direction:column; gap:4px;}
.expense-form select, .expense-edit-form select,
.expense-form input[type=text], .expense-edit-form input[type=text],
.expense-form input[type=number], .expense-edit-form input[type=number]{
  font-size:13.5px; padding:8px 10px; border-radius:10px; border:2px solid var(--line); font-family:inherit;
}
.expense-photo-row{display:flex; gap:10px;}
.expense-photo-label{
  flex:1 1 0; display:flex; align-items:center; justify-content:center; gap:6px;
  font-size:13px; font-weight:800; color:var(--teal-dark); background:#fff;
  border:2px solid var(--teal-dark); border-radius:10px; padding:10px; cursor:pointer; text-align:center;
}
.expense-photo-label input{display:none;}
.ee-sharers, .ee-item-sharers{display:flex; flex-wrap:wrap; gap:8px;}
.sharer-check{
  display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:700;
  border:2px solid var(--line); border-radius:999px; padding:4px 10px; background:#fff; cursor:pointer;
}
.sharer-check.small{padding:2px 8px; font-size:11px;}
.sharer-check input{accent-color:var(--teal);}
.ee-toggle-items, .ee-item-add{
  align-self:flex-start; font-size:12px; font-weight:800; color:var(--teal-dark); background:#fff;
  border:2px solid var(--teal-dark); padding:5px 12px; border-radius:999px; cursor:pointer; font-family:inherit;
}
.ee-items{display:flex; flex-direction:column; gap:8px; border-top:2px dashed var(--line); padding-top:10px;}
.item-row{display:flex; align-items:center; gap:6px; flex-wrap:wrap;}
.item-row .item-name{flex:1 1 120px; min-width:0;}
.item-row .item-amount{flex:0 0 80px;}
.ee-item-check{font-size:11.5px; color:var(--ink-soft); font-weight:700;}
.expense-edit-actions{display:flex; gap:10px;}
.expense-edit-actions button{
  font-size:13px; font-weight:800; padding:7px 16px; border-radius:10px; cursor:pointer; font-family:inherit;
}
.ee-save{color:#fff; background:var(--teal); border:2px solid var(--teal-dark);}
.ee-cancel{color:var(--ink-soft); background:none; border:2px solid var(--line);}
.expense-form > button{
  font-size:13.5px; font-weight:800; color:#fff; background:var(--teal); border:2px solid var(--teal-dark);
  padding:9px 16px; border-radius:10px; cursor:pointer; font-family:inherit;
}
.expense-form > button:disabled{opacity:.6; cursor:not-allowed;}

/* documents */
.panel-title{font-size:18px; font-weight:900; margin:4px 2px 14px;}
.card .sub{font-size:12px; color:var(--ink-soft); font-weight:600; margin-bottom:12px; line-height:1.6;}

.shared-card{border-color:var(--teal-dark);}
.shared-card h2{color:var(--teal-dark);}

.cat-row{
  border:2px solid var(--line); border-radius:12px; padding:10px 12px; margin-bottom:8px; background:#fff;
}
.cat-row:last-child{margin-bottom:0;}
.cat-head{display:flex; justify-content:space-between; align-items:center; margin-bottom:6px;}
.cat-head .cname{font-weight:800; font-size:13.5px;}
.upload-btn{
  font-size:12px; font-weight:800; color:var(--teal-dark); background:none; border:2px solid var(--teal-dark);
  padding:4px 10px; border-radius:999px; cursor:pointer; font-family:inherit;
}
.upload-btn:disabled{opacity:.5; cursor:not-allowed;}
.file-row{
  display:flex; justify-content:space-between; align-items:center; gap:8px; font-size:12.5px;
  padding:6px 0; border-top:1px dashed #ddd;
}
.file-row:first-of-type{border-top:none;}
.file-row a{color:var(--teal-dark); font-weight:700; text-decoration:none; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.ai-badge{font-size:12px; flex-shrink:0;}
.file-row button{
  border:none; background:none; color:var(--coral-dark); cursor:pointer; font-size:14px; font-family:inherit;
}

/* per-traveler accordion */
.travelers{margin-top:6px;}
.travelers h2{font-size:14px; font-weight:900; color:var(--ink-soft); letter-spacing:.5px; margin-bottom:10px;}
.trav{border:2px solid var(--line); border-radius:15px; margin-bottom:9px; background:#fff; overflow:hidden;}
.trav-head{
  display:flex; align-items:center; gap:10px; padding:11px 14px; cursor:pointer; -webkit-tap-highlight-color:transparent;
}
.trav-head:focus-visible{outline:3px solid var(--teal); outline-offset:-3px;}
.trav-emoji{font-size:20px; flex:0 0 auto;}
.trav-name{font-weight:800; font-size:14px; flex:1 1 auto;}
.badges{display:flex; gap:5px; flex:0 0 auto; flex-wrap:wrap; justify-content:flex-end;}
.badge{font-size:11px; font-weight:800; padding:2px 8px; border-radius:999px; white-space:nowrap;}
.badge.done{background:#EAF6EF; color:var(--ok);}
.badge.pending{background:#FBEED2; color:#C98A1B;}
.chev{font-size:12px; color:var(--ink-soft); transition:transform .18s ease; flex:0 0 auto;}
.trav.open .chev{transform:rotate(180deg);}
.trav-body{max-height:0; overflow:hidden; transition:max-height .22s ease;}
.trav.open .trav-body{border-top:2px solid var(--line);}
.trav-body-inner{padding:12px 14px 14px;}

.setup-hint{
  background:var(--sand); border:2px dashed var(--coral); border-radius:12px; padding:12px 14px;
  font-size:12.5px; line-height:1.8;
}
.setup-hint ol{margin:8px 0 0; padding-left:20px;}

/* notes */
.edit-toggle{
  float:right; font-size:12px; font-weight:800; color:var(--teal-dark);
  background:none; border:2px solid var(--line); border-radius:999px;
  padding:3px 12px; cursor:pointer; font-family:inherit;
}
.edit-toggle.on{color:#fff; background:var(--teal); border-color:var(--teal-dark);}
.cat-add{
  float:right; font-size:11.5px; font-weight:800; color:var(--teal-dark);
  background:none; border:2px solid var(--line); border-radius:999px;
  padding:2px 10px; cursor:pointer; font-family:inherit;
}
.tip-list{margin:0; padding-left:20px; font-size:13.5px; line-height:1.8;}
.dress-box{
  background:var(--sand); border:2px dashed var(--coral); border-radius:12px; padding:12px 14px;
  font-size:13.5px; line-height:1.7; margin-top:10px;
}
.emg-row{
  display:flex; justify-content:space-between; align-items:center; padding:10px 14px;
  border:2px solid var(--line); border-radius:12px; margin-bottom:8px; background:#fff;
}
.emg-row .num{font-weight:900; font-size:16px; color:var(--coral-dark);}

.empty-hint{font-size:12.5px; color:var(--ink-soft); font-style:italic;}

/* theme picker */
.theme-picker{display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:9px;}
.theme-swatch{
  display:flex; align-items:center; gap:9px; padding:9px 11px; border-radius:13px;
  border:2px solid var(--line); background:#fff; cursor:pointer; text-align:left; font-family:inherit;
}
.theme-swatch .dot{
  width:24px; height:24px; border-radius:50%; flex:0 0 auto; font-size:13px;
  display:flex; align-items:center; justify-content:center; box-shadow:inset 0 0 0 2px rgba(255,255,255,.5);
}
.theme-swatch .label{font-size:12px; font-weight:800; line-height:1.3;}
.theme-swatch .label small{display:block; font-weight:600; color:var(--ink-soft); font-size:10px; margin-top:1px;}
.theme-swatch.active{box-shadow:4px 4px 0 rgba(42,45,47,.12);}
.theme-swatch.active .dot{box-shadow:inset 0 0 0 2px rgba(255,255,255,.85), 0 0 0 2px var(--teal-dark);}

@media (max-width:480px){
  nav.tabs button{padding:12px 10px; font-size:12.5px;}
  .conv-row input{font-size:17px;}
}
