/* =====================================================================
   Balkan Country-Collector — styles
   Design: clean modern travel dashboard · mobile-first · light/dark · print
   ===================================================================== */

/* ----------------------------------------------------------- tokens -- */
:root {
  --bg:        #edf1f8;
  --bg-tint:   radial-gradient(1100px 680px at 100% -6%, #d9e8fb 0%, transparent 56%),
               radial-gradient(950px 620px at -8% 2%, #e9e2fb 0%, transparent 52%);
  --surface:   #ffffff;
  --surface-2: #f4f7fc;
  --surface-3: #e9eff8;
  --text:      #172032;
  --text-soft: #586981;
  --border:    #e6ecf5;
  --border-2:  #d4ddec;

  --primary:   #0e7490;
  --primary-2: #0891b2;
  --primary-ink:#ffffff;
  --accent:    #ef6c2e;
  --ring:      0 0 0 3px color-mix(in srgb, var(--primary) 34%, transparent);

  --low-bg:  #e7f6ec; --low-fg:  #1a7f43; --low-bd:#b7e3c4;
  --med-bg:  #fef3e2; --med-fg:  #b46708; --med-bd:#f6d9a8;
  --high-bg: #fdeaea; --high-fg: #c0392b; --high-bd:#f4c2bd;
  --info-bg: #e8f1fb; --info-fg: #1667b8; --info-bd:#c3ddf6;

  --hero-grad: linear-gradient(135deg,#0ea5e9 0%,#0369a1 46%,#6d28d9 100%);
  --shadow-sm: 0 1px 2px rgba(20,30,55,.05), 0 2px 5px rgba(20,30,55,.05);
  --shadow-md: 0 8px 22px rgba(20,30,55,.09), 0 3px 8px rgba(20,30,55,.05);
  --shadow-lg: 0 20px 50px rgba(20,30,55,.16), 0 6px 16px rgba(20,30,55,.07);
  --shadow-xl: 0 32px 74px rgba(20,30,55,.22);

  --radius:   16px;
  --radius-sm:12px;
  --radius-lg:24px;
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

html[data-theme="dark"] {
  --bg:        #080d18;
  --bg-tint:   radial-gradient(1100px 680px at 100% -6%, rgba(56,189,248,.10) 0%, transparent 56%),
               radial-gradient(950px 620px at -8% 2%, rgba(124,58,237,.16) 0%, transparent 52%);
  --surface:   #111a2b;
  --surface-2: #17223a;
  --surface-3: #1e2b46;
  --text:      #e8eef8;
  --text-soft: #97a8c2;
  --border:    #243250;
  --border-2:  #33456b;

  --primary:   #38bdf8;
  --primary-2: #22d3ee;
  --primary-ink:#04212e;
  --accent:    #fb8a4c;
  --ring:      0 0 0 3px color-mix(in srgb, var(--primary) 40%, transparent);

  --low-bg:#122c1e; --low-fg:#5fd88a; --low-bd:#1f5236;
  --med-bg:#2f2410; --med-fg:#f2b45c; --med-bd:#5a4318;
  --high-bg:#331616; --high-fg:#f4837a; --high-bd:#5e2a28;
  --info-bg:#122238; --info-fg:#6cb6f5; --info-bd:#234869;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --shadow-md: 0 8px 22px rgba(0,0,0,.5);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.6);
  --shadow-xl: 0 32px 74px rgba(0,0,0,.66);
}

/* ------------------------------------------------------------ base -- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-tint), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,h2,h3,h4 { line-height: 1.18; margin: 0 0 .4em; font-weight: 780; letter-spacing:-.021em; }
h2 { font-size: clamp(1.4rem, 3.4vw, 1.95rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 .8em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: .8rem; }

/* keyboard focus — visible ring for a11y (not shown on mouse click) */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 7px; }
.num, .stat .num, .cost-total-bar .big, .tier-btn .ttotal { font-variant-numeric: tabular-nums; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--primary); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* --------------------------------------------------------- top bar -- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: .8rem;
  padding: .6rem 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--hero-grad); color: #fff; font-size: 1.1rem; box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1rem; }
.brand-text small { color: var(--text-soft); }
.topbar-actions { margin-left: auto; display: flex; gap: .4rem; }
.btn-icon {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 1.05rem;
  display: grid; place-items: center; transition: transform .12s, background .2s;
}
.btn-icon:hover { transform: translateY(-1px); background: var(--surface-3); }

.version-switch {
  display: inline-flex; align-items: center; gap: .4rem; height: 40px; padding: 0 .5rem 0 .7rem;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px;
}
.version-switch .vs-label { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); }
.version-switch select {
  border: 0; background: transparent; color: var(--text); font-size: .85rem; font-weight: 700;
  font-family: var(--font); cursor: pointer; max-width: 44vw;
}
.version-switch select:focus { outline: none; }
.version-note {
  border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  padding: .85rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 1rem;
}
.version-note .vn-head { display:flex; align-items:center; gap:.5rem; font-weight:800; margin-bottom:.2rem; }
.version-note .vn-chip { background: var(--accent); color:#fff; border-radius:999px; padding:.1rem .55rem; font-size:.72rem; }

.nav-toggle {
  display: none; flex-direction: column; gap: 4px; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); cursor: pointer;
}
.nav-toggle span { height: 2px; width: 20px; margin: 0 auto; background: var(--text); border-radius: 2px; transition: .25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1){ transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2){ opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3){ transform: translateY(-6px) rotate(-45deg); }

/* ----------------------------------------------------------- tabs -- */
.tabs {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; gap: .3rem; padding: 0 .8rem .55rem;
  overflow-x: auto; scrollbar-width: thin;
}
.tabs::-webkit-scrollbar { height: 6px; }
.tabs::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
.tab {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: .38rem;
  border: 1px solid transparent; background: transparent;
  color: var(--text-soft); padding: .45rem .85rem; border-radius: 999px;
  font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: color .15s, background .15s, box-shadow .15s, transform .1s;
}
.tab .tab-ico { font-size: 1em; line-height: 1; filter: grayscale(.2); }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab:active { transform: translateY(.5px); }
.tab.is-active {
  color: var(--primary-ink);
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  box-shadow: var(--shadow-sm);
}
.tab.is-active .tab-ico { filter: none; }

/* --------------------------------------------------------- panels -- */
main { max-width: var(--maxw); margin: 0 auto; padding: 1.2rem 1rem 4rem; }
.panel { display: none; animation: fade .25s ease; }
.panel.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-head { margin-bottom: 1rem; }
.section-sub { color: var(--text-soft); max-width: 62ch; margin: 0; }
.day-controls, .map-switch { display: flex; gap: .5rem; align-items: center; margin: .3rem 0 1rem; flex-wrap: wrap; }
.mini-btn {
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  padding: .4rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.mini-btn:hover { background: var(--surface-2); }
.mini-btn.is-active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

/* ---------------------------------------------------------- hero -- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  background: var(--hero-grad); color: #fff; padding: clamp(1.4rem,4vw,2.6rem);
  box-shadow: var(--shadow-lg); margin-bottom: 1.4rem;
}
.hero::after {
  content: ""; position: absolute; inset: 0; opacity: .13; pointer-events: none;
  background-image: radial-gradient(circle at 82% 18%, #fff 0 2px, transparent 2px),
                    radial-gradient(circle at 14% 74%, #fff 0 2px, transparent 2px);
  background-size: 28px 28px;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.14), transparent 42%);
}
.hero-tag {
  display: inline-block; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
  padding: .25rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; margin-bottom: .7rem;
}
.hero h1 { font-size: clamp(1.7rem, 5vw, 2.9rem); margin: 0 0 .3rem; color: #fff; }
.hero .hero-sub { font-size: clamp(1rem,2.4vw,1.2rem); opacity: .95; max-width: 60ch; margin-bottom: .3rem; }
.hero .hero-meta { opacity: .9; font-size: .92rem; }
.hero-flags { font-size: 1.5rem; letter-spacing: .12rem; margin: .9rem 0 0; position: relative; z-index: 1; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: .8rem; margin-top: 1.3rem;
  position: relative; z-index: 1;
}
.stat {
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.24);
  border-radius: var(--radius); padding: .85rem .95rem;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .16s ease, background .16s ease;
}
.stat:hover { transform: translateY(-2px); background: rgba(255,255,255,.2); }
.stat .num { font-size: 1.75rem; font-weight: 850; line-height: 1; letter-spacing: -.01em; }
.stat .lbl { font-size: .78rem; opacity: .92; margin-top: .25rem; }

/* generic surface card blocks used across sections */
.block {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); margin-bottom: 1rem;
}
.block h3 { margin-top: 0; }
.lede { font-size: 1.02rem; }
.callout {
  border-left: 4px solid var(--primary); background: var(--surface-2);
  padding: .85rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 1rem;
}
.callout.good  { border-color: var(--low-fg);  background: var(--low-bg); }
.callout.warn  { border-color: var(--med-fg);  background: var(--med-bg); }
.callout.bad   { border-color: var(--high-fg); background: var(--high-bg); }
.callout.info  { border-color: var(--info-fg); background: var(--info-bg); }
.callout strong { display:block; margin-bottom:.15rem; }

/* -------------------------------------------------------- badges -- */
.badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700;
  padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text-soft); white-space: nowrap;
}
.badge.b-book   { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.badge.b-risk   { background: var(--high-bg); color: var(--high-fg); border-color: var(--high-bd); }
.badge.b-border { background: var(--med-bg); color: var(--med-fg); border-color: var(--med-bd); }
.badge.b-buffer { background: var(--low-bg); color: var(--low-fg); border-color: var(--low-bd); }
.badge.b-flight { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.badge.b-heat   { background: var(--med-bg); color: var(--med-fg); border-color: var(--med-bd); }
.badge.b-star   { background: linear-gradient(135deg,#7c3aed,#0369a1); color:#fff; border:none; }

.chip {
  display: inline-block; font-size: .72rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-soft);
}
.chip-low  { background: var(--low-bg);  color: var(--low-fg);  border-color: var(--low-bd); }
.chip-medium{ background: var(--med-bg); color: var(--med-fg);  border-color: var(--med-bd); }
.chip-high { background: var(--high-bg); color: var(--high-fg); border-color: var(--high-bd); }
.chip-new  { background: linear-gradient(135deg,#0ea5e9,#6d28d9); color:#fff; border:none; }

/* ------------------------------------------------------ timeline -- */
.timeline { position: relative; }
.timeline::before {
  content:""; position:absolute; left: 21px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--primary), var(--accent)); opacity: .4;
}
.day-card {
  position: relative; margin: 0 0 .8rem 0; padding-left: 3.2rem;
}
.day-node {
  position: absolute; left: 6px; top: 4px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: .82rem;
  background: var(--surface); color: var(--primary); border: 2px solid var(--primary); z-index: 1;
}
.day-card.risk-high  .day-node { border-color: var(--high-fg); color: var(--high-fg); }
.day-card.risk-medium .day-node { border-color: var(--med-fg); color: var(--med-fg); }
.day-inner {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.day-head {
  width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer; color: var(--text);
  display: flex; align-items: flex-start; gap: .7rem; padding: .85rem 1rem;
}
.day-head:hover { background: var(--surface-2); }
.day-date { flex: 0 0 auto; font-weight: 800; font-size: .82rem; color: var(--text-soft); min-width: 3.3rem; }
.day-title { font-weight: 750; flex: 1; }
.day-title .day-counts { display:block; font-weight:600; font-size:.8rem; color: var(--text-soft); margin-top:.15rem; }
.day-caret { flex: 0 0 auto; transition: transform .2s; color: var(--text-soft); }
.day-card.is-open .day-caret { transform: rotate(90deg); }
.day-body { display: none; padding: 0 1rem 1rem; border-top: 1px solid var(--border); }
.day-card.is-open .day-body { display: block; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(210px,1fr)); gap: .7rem; margin: .8rem 0; }
.plan-slot { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .8rem; }
.plan-slot .k { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--primary-2); }
.plan-slot .v { font-size: .92rem; margin-top: .2rem; }

.day-facts { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: .55rem; margin-top: .6rem; }
.fact { font-size: .88rem; }
.fact .k { font-weight: 750; color: var(--text-soft); }
.fact.transfer .k { color: var(--primary-2); }
.fact.backup   { grid-column: 1 / -1; background: var(--info-bg); border:1px solid var(--info-bd); padding:.5rem .7rem; border-radius: var(--radius-sm); }
.fact.skip     { grid-column: 1 / -1; }

/* modular day segments: commute · city · overnight */
.day-body > .badges { margin-bottom: .5rem; }
.seg { border-left: 3px solid var(--border-2); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: .6rem .85rem; margin: .55rem 0; }
.seg-h { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); margin-bottom: .4rem; }
.seg-transit { border-left-color: #1d6fb8; }
.seg-city    { border-left-color: var(--primary); }
.seg-sleep   { border-left-color: #1a9e5b; }
.seg-rest    { border-left-color: #8b5cf6; }
.seg-rest .seg-h { margin: 0; color: #8b5cf6; }
.leg-row { display: flex; align-items: center; gap: .6rem; padding: .42rem 0; border-bottom: 1px dashed var(--border); }
.leg-row:last-of-type { border-bottom: 0; }
.leg-ico { font-size: 1.25rem; flex: 0 0 auto; width: 1.7rem; text-align: center; }
.leg-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.leg-main .leg-sub { font-size: .8rem; color: var(--text-soft); }
.leg-meta { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; font-size: .82rem; text-align: right; }
.seg-foot { font-size: .82rem; color: var(--text-soft); margin-top: .5rem; }
.linklike { border: 0; background: none; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.linklike:hover { text-decoration: underline; }
.tl { display: flex; gap: .6rem; padding: .3rem 0; align-items: baseline; }
.tl-k { flex: 0 0 5.6rem; font-weight: 700; font-size: .78rem; color: var(--primary-2); }
.tl-v { flex: 1; font-size: .92rem; }
.seg-city .seg-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin-top: .5rem; padding-top: .45rem; border-top: 1px dashed var(--border); font-size: .88rem; }
.seg-sleep .seg-body { font-size: .92rem; }
.day-notes { margin: .5rem 0 .1rem; }
.day-notes summary { cursor: pointer; font-size: .8rem; font-weight: 700; color: var(--text-soft); padding: .3rem 0; list-style: none; }
.day-notes summary::-webkit-details-marker { display: none; }
.day-notes summary::before { content: "▸ "; }
.day-notes[open] summary::before { content: "▾ "; }
.day-notes .fact { margin-top: .45rem; font-size: .88rem; }
@media (max-width: 520px) { .tl { flex-direction: column; gap: .1rem; } .tl-k { flex: none; } .leg-meta { font-size: .76rem; } }

/* ---------------------------------------------------------- cards -- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(320px,1fr)); gap: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.1rem 1.15rem; display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.card-title { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.card-title .flag { font-size: 1.4rem; }
.card-title h3 { margin: 0; }
.card .meta-row { font-size: .82rem; color: var(--text-soft); margin-bottom: .5rem; }
.card ul { margin: .2rem 0 .7rem; padding-left: 1.05rem; }
.card li { margin-bottom: .28rem; font-size: .9rem; }
.kv { margin: .3rem 0; font-size: .9rem; }
.kv .k { font-weight: 750; color: var(--text-soft); display:block; font-size: .74rem; text-transform: uppercase; letter-spacing:.03em; }
.card .price-pill {
  align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 999px; padding: .2rem .6rem; font-size: .78rem; font-weight: 700; margin-bottom: .5rem;
}
.subhead { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--primary-2); margin: .6rem 0 .2rem; }
.tag-line { display:flex; flex-wrap:wrap; gap:.3rem; margin-top:auto; padding-top:.6rem; }

/* ---------------------------------------------------------- table -- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--surface); }
table.grid { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 640px; }
table.grid th, table.grid td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.grid thead th { background: var(--surface-3); font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); position: sticky; top: 0; }
table.grid tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
table.grid tbody tr:hover td { background: var(--surface-2); }
table.grid tr:last-child td { border-bottom: 0; }
.risk-dot { display:inline-block; width:.7rem; height:.7rem; border-radius:50%; margin-right:.35rem; vertical-align:middle; }
.risk-dot.low{background:var(--low-fg);} .risk-dot.medium{background:var(--med-fg);} .risk-dot.high{background:var(--high-fg);}

/* transfer accordion */
.xfer {
  background: var(--surface); border: 1px solid var(--border); border-left-width: 5px; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: .7rem; overflow: hidden;
}
.xfer.low  { border-left-color: var(--low-fg); }
.xfer.medium{ border-left-color: var(--med-fg); }
.xfer.high { border-left-color: var(--high-fg); }
.xfer-head { width:100%; border:0; background:transparent; color:var(--text); cursor:pointer; display:flex; align-items:center; gap:.7rem; padding:.8rem 1rem; text-align:left; }
.xfer-head:hover { background: var(--surface-2); }
.xfer-route { font-weight: 750; flex: 1; }
.xfer-route small { display:block; font-weight:600; color: var(--text-soft); }
.xfer-mode { font-size: .82rem; color: var(--text-soft); flex: 1.2; }
.xfer-caret { color: var(--text-soft); transition: transform .2s; }
.xfer.is-open .xfer-caret { transform: rotate(90deg); }
.xfer-body { display:none; padding: 0 1rem 1rem; border-top: 1px solid var(--border); }
.xfer.is-open .xfer-body { display:block; }
.xfer-body .day-facts { margin-top: .8rem; }
@media (max-width: 620px){ .xfer-mode { display:none; } }

/* --------------------------------------------------- leaflet map -- */
.map-cities { display: flex; gap: .4rem; flex-wrap: wrap; margin: .2rem 0 .6rem; }
.map-city-btn {
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: .4rem .8rem; font-size: .82rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.map-city-btn:hover { background: var(--surface-2); }
.map-city-btn.is-active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

.map-legend { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 .8rem; align-items: center; }
.map-legend .leg-label { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); margin-right: .2rem; }
.leg-chip {
  display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border-2);
  background: var(--surface); border-radius: 999px; padding: .28rem .65rem; font-size: .8rem; font-weight: 700; cursor: pointer; user-select: none;
}
.leg-chip .dot { width: .7rem; height: .7rem; border-radius: 50%; flex: 0 0 auto; }
.leg-chip.off { opacity: .38; text-decoration: line-through; }
.map-legend[hidden] { display: none; }

/* leaflet div-icon pins (city detail) */
.map-pin {
  width: 28px; height: 28px; border-radius: 50%; background: var(--surface);
  border: 3px solid #888; box-shadow: 0 1px 5px rgba(0,0,0,.45);
  display: grid; place-items: center; font-size: 14px; line-height: 1;
}
.map-pin.cat-transit { border-color: #1d6fb8; }
.map-pin.cat-stay    { border-color: #1a9e5b; }
.map-pin.cat-sight   { border-color: #e2603b; }
.map-pin.cat-view    { border-color: #8b5cf6; }
.dot-transit { background: #1d6fb8; } .dot-stay { background: #1a9e5b; }
.dot-sight   { background: #e2603b; } .dot-view { background: #8b5cf6; }

.leaflet-map { height: 560px; border-radius: var(--radius); box-shadow: var(--shadow-md); border: 1px solid var(--border); z-index: 0; }
.map-note { color: var(--text-soft); font-size: .82rem; margin-top: .6rem; }
.leaflet-popup-content { font-family: var(--font); }
.map-pop b { color: var(--primary-2); }

/* route diagram fallback */
.route-diagram { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; }
.route-step {
  display:flex; align-items:center; gap:.5rem; background: var(--surface); border:1px solid var(--border);
  border-radius: 999px; padding:.45rem .8rem; box-shadow: var(--shadow-sm); font-size:.86rem; font-weight:600;
}
.route-step .flag { font-size: 1.1rem; }
.route-step.stay { border-color: var(--primary); }
.route-arrow { align-self:center; color: var(--text-soft); font-weight:800; }

/* -------------------------------------------------- money / visa -- */
.legend { display:flex; gap:1rem; flex-wrap:wrap; font-size:.82rem; color:var(--text-soft); margin:.4rem 0 1rem; }

/* --------------------------------------------------- costs panel -- */
.tier-switch { display:flex; gap:.5rem; flex-wrap:wrap; margin-bottom: 1rem; }
.tier-btn {
  flex: 1 1 180px; text-align:left; border:1px solid var(--border-2); background: var(--surface); color:var(--text);
  border-radius: var(--radius); padding: .8rem 1rem; cursor:pointer; transition:.15s;
}
.tier-btn:hover { background: var(--surface-2); }
.tier-btn.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.tier-btn .tname { font-weight: 800; }
.tier-btn .tblurb { font-size: .8rem; color: var(--text-soft); }
.tier-btn .ttotal { font-size: 1.25rem; font-weight: 800; color: var(--primary-2); margin-top:.2rem; }
.cost-total-bar {
  display:flex; justify-content:space-between; align-items:baseline; flex-wrap:wrap; gap:.5rem;
  background: var(--hero-grad); color:#fff; border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom:1rem; box-shadow: var(--shadow-md);
}
.cost-total-bar .big { font-size: 1.9rem; font-weight: 850; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------- packing -- */
.pack-progress { font-size: .85rem; color: var(--text-soft); font-weight: 700; }
.check-item { display:flex; align-items:flex-start; gap:.55rem; font-size:.9rem; margin-bottom:.35rem; cursor:pointer; }
.check-item input { margin-top: .2rem; width: 16px; height: 16px; accent-color: var(--primary); flex:0 0 auto; }
.check-item.done span { text-decoration: line-through; color: var(--text-soft); }
.meta-cards { display:grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap:.7rem; margin-bottom:1rem; }

/* -------------------------------------------------------- booking -- */
.booking-lane { margin-bottom: 1rem; }
.booking-lane .when { display:flex; align-items:center; gap:.5rem; font-weight:800; margin-bottom:.5rem; }
.booking-lane .when .dot { width:.75rem; height:.75rem; border-radius:50%; background: var(--primary); }
.booking-lane:nth-child(1) .when .dot { background: var(--high-fg); }
.booking-lane:nth-child(2) .when .dot { background: var(--med-fg); }
.booking-lane:nth-child(3) .when .dot { background: var(--primary); }
.booking-lane:nth-child(4) .when .dot { background: var(--info-fg); }
.booking-lane:nth-child(5) .when .dot { background: var(--low-fg); }

/* -------------------------------------------------------- sources -- */
.source-group { margin-bottom: 1rem; }
.source-group h3 { font-size: 1rem; }
.source-links { display:flex; flex-wrap:wrap; gap:.5rem; }
.source-links a {
  font-size:.84rem; background: var(--surface-2); border:1px solid var(--border-2); border-radius:999px;
  padding:.3rem .7rem; color: var(--primary); font-weight:600;
}
.source-links a:hover { background: var(--surface-3); text-decoration:none; }

/* -------------------------------------------------------- summary -- */
.summary-grid { display:grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap:1rem; }
.summary-grid ol, .summary-grid ul { padding-left: 1.2rem; margin:.3rem 0; }
.summary-grid li { margin-bottom:.3rem; font-size:.92rem; }
.verdict-box { background: var(--hero-grad); color:#fff; border-radius: var(--radius); padding:1.2rem 1.3rem; box-shadow: var(--shadow-md); margin-bottom:1rem; }
.verdict-box h3 { color:#fff; }

/* -------------------------------------------------------- footer -- */
.site-footer { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1rem 3rem; color: var(--text-soft); font-size: .82rem; border-top: 1px solid var(--border); }
.footer-fine { opacity: .8; }

.to-top {
  position: fixed; right: 16px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text); cursor: pointer;
  box-shadow: var(--shadow-md); font-size: 1.1rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 90;
}
.to-top.show { opacity: 1; pointer-events: auto; }

/* --------------------------------------------------- responsive -- */
@media (max-width: 780px) {
  .nav-toggle { display: flex; }
  .brand-text small { display: none; }
  .version-switch .vs-label { display: none; }
  .version-switch { padding: 0 .4rem; }
  .version-switch select { max-width: 34vw; }
  .topbar-inner { gap: .5rem; }
  .tabs {
    position: fixed; inset: 57px 0 auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem;
    background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border); max-height: 78vh; overflow-y: auto;
    padding: .7rem .7rem 1.1rem; box-shadow: var(--shadow-lg); transform: translateY(-120%); transition: transform .25s; z-index: 99;
  }
  .tabs.open { transform: translateY(0); }
  .tab { justify-content: flex-start; border-radius: 12px; padding: .7rem .8rem; width: 100%; font-size: .92rem; }
  .tab:not(.is-active) { background: var(--surface-2); }
  .leaflet-map { height: 60vh; }
}

/* ------------------------------------------------------- print -- */
@media print {
  .topbar, .to-top, .day-controls, .map-switch, .tier-switch, #resetPacking, .nav-toggle, .topbar-actions { display: none !important; }
  .panel { display: block !important; page-break-inside: auto; margin-bottom: 1.4rem; }
  .day-body, .xfer-body, .day-notes > * { display: block !important; }
  .day-card, .xfer, .card, .block, .table-wrap { page-break-inside: avoid; box-shadow: none; }
  body { background: #fff; color: #000; }
  .hero, .cost-total-bar, .verdict-box, .brand-mark { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: #000; text-decoration: underline; }
  .leaflet-map { display: none; }
  #routeDiagram { display: flex !important; }
  main { max-width: none; }
  .section-head { border-bottom: 2px solid #000; }
}

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

/* ---------------------------------------------- unlock gate -- */
/* Until the correct password is entered, the whole app is hidden and only the
   lock screen shows. The itinerary data never even loads without it. */
body.locked .topbar,
body.locked #main,
body.locked .site-footer,
body.locked .to-top { display: none !important; }

#lockScreen { display: none; }
body.locked #lockScreen {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: radial-gradient(1200px 600px at 20% -10%, #0ea5e9 0%, transparent 55%),
              radial-gradient(1000px 700px at 100% 110%, #6d28d9 0%, transparent 55%),
              linear-gradient(160deg, #0b1220 0%, #0a0f1c 100%);
  color: #eef4ff;
}
.lock-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  background: rgba(18, 27, 44, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 2rem 1.7rem 1.7rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.lock-mark {
  width: 58px; height: 58px; margin: 0 auto 1rem;
  display: grid; place-items: center;
  font-size: 1.7rem; color: #fff;
  border-radius: 16px;
  background: linear-gradient(135deg, #0ea5e9, #6d28d9);
  box-shadow: 0 10px 30px rgba(109, 40, 217, 0.5);
}
.lock-card h1 { font-size: 1.35rem; margin: 0 0 .3rem; letter-spacing: -.01em; }
.lock-sub { font-size: .92rem; color: #aebbd4; margin: 0 0 1.3rem; line-height: 1.45; }
#lockPw {
  width: 100%; box-sizing: border-box;
  padding: .8rem .9rem; font-size: 1rem;
  color: #fff; background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 12px;
  outline: none; transition: border-color .15s, background .15s;
}
#lockPw::placeholder { color: #8091ac; }
#lockPw:focus { border-color: #38bdf8; background: rgba(255, 255, 255, 0.1); }
.lock-remember {
  display: flex; align-items: center; gap: .5rem;
  font-size: .84rem; color: #aebbd4;
  margin: .8rem .1rem 1.1rem; text-align: left; cursor: pointer;
}
.lock-remember input { width: 16px; height: 16px; accent-color: #38bdf8; }
#lockBtn {
  width: 100%; padding: .8rem 1rem;
  font-size: 1rem; font-weight: 700; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, #0ea5e9, #6d28d9);
  border: 0; border-radius: 12px;
  transition: filter .15s, transform .05s;
}
#lockBtn:hover { filter: brightness(1.08); }
#lockBtn:active { transform: translateY(1px); }
#lockBtn:disabled { opacity: .7; cursor: default; }
.lock-error {
  display: none; margin: .9rem 0 0;
  font-size: .86rem; font-weight: 600; color: #fca5a5;
}
.lock-fine {
  margin: 1.3rem 0 0; padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: .74rem; line-height: 1.5; color: #7e8daa;
}

/* ---------------------------------------------- booking checklist -- */
.book-legend { display: flex; flex-wrap: wrap; gap: .4rem; margin: .7rem 0 .4rem; }
.bchip {
  font-size: .72rem; font-weight: 700; padding: .18rem .55rem;
  border-radius: 999px; white-space: nowrap; line-height: 1.35;
}
.bchip.u-done   { background: color-mix(in srgb, #16a34a 16%, var(--surface)); color: #15803d; }
.bchip.u-now    { background: color-mix(in srgb, #dc2626 15%, var(--surface)); color: #dc2626; }
.bchip.u-soon   { background: color-mix(in srgb, #d97706 18%, var(--surface)); color: #b45309; }
.bchip.u-later  { background: color-mix(in srgb, #0284c7 15%, var(--surface)); color: #0369a1; }
.bchip.u-onsite { background: color-mix(in srgb, #6b7280 16%, var(--surface)); color: #6b7280; }
[data-theme="dark"] .bchip.u-done  { color: #4ade80; }
[data-theme="dark"] .bchip.u-soon  { color: #fbbf24; }
[data-theme="dark"] .bchip.u-later { color: #38bdf8; }
[data-theme="dark"] .bchip.u-onsite{ color: #9ca3af; }

.book-group { margin-bottom: 1.3rem; }
.book-group > h3 { margin: .3rem 0 .5rem; font-size: 1.05rem; }
.book-gnote { font-size: .84rem; color: var(--text-soft); margin: 0 0 .6rem; }

.book-item {
  display: flex; gap: .6rem; align-items: flex-start;
  padding: .6rem .7rem; margin-bottom: .5rem;
  background: var(--surface);
  border: 1px solid var(--border); border-left-width: 4px;
  border-radius: 11px; cursor: pointer; transition: background .12s;
}
.book-item:hover { background: var(--surface-2); }
.book-item.u-now    { border-left-color: #dc2626; }
.book-item.u-soon   { border-left-color: #d97706; }
.book-item.u-later  { border-left-color: #0284c7; }
.book-item.u-onsite { border-left-color: #9ca3af; }
.book-item.u-done   { border-left-color: #16a34a; }
.book-item input {
  margin: .15rem 0 0; width: 18px; height: 18px; flex: 0 0 auto;
  accent-color: #16a34a; cursor: pointer;
}
.book-item.done, .book-item.u-done { opacity: .62; }
.book-item.done .bi-head strong, .book-item.u-done .bi-head strong { text-decoration: line-through; }
.bi-body { display: flex; flex-direction: column; gap: .22rem; min-width: 0; }
.bi-head { display: flex; flex-wrap: wrap; gap: .35rem .55rem; align-items: baseline; }
.bi-head strong { font-size: .97rem; }
.bi-dates { font-size: .87rem; font-weight: 700; color: var(--text); }
.bi-meta { font-size: .85rem; color: var(--text-soft); }
.bi-mode { font-weight: 600; color: var(--text); }
.bi-book { font-size: .85rem; }
.bi-book a { font-weight: 600; }
.bi-note { font-size: .82rem; color: var(--text-soft); font-style: italic; }
.book-seq { margin-top: 1.6rem; border-top: 2px solid var(--border); padding-top: 1rem; }

@media print {
  .book-item { break-inside: avoid; box-shadow: none; }
  #resetBooking, .book-legend { display: none !important; }
  .book-item input { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
