/* Font assets and the family stack are shared with the trip list. */
:root{--surface:#f2f3f2;--sheet:#fcfcfb;--ink:#23282b;--secondary:#454d51;--subtle:#495255;--blue:#315469;--rule:#cbd1cf}
body{font-family:var(--travel-font);background:var(--surface);color:var(--ink);line-height:1.58;letter-spacing:.012em}
header{padding-bottom:0;align-items:center}.brand{font-size:1.72rem;letter-spacing:.025em;font-weight:600;line-height:1.3}.brand span{display:none}
.iconbtn{min-width:44px;min-height:44px}.trip-summary{border-bottom:1px solid var(--rule);padding-bottom:14px}.trip-summary p{margin:0;font-size:1rem;line-height:1.65}.date-heading{font-size:1.08rem;font-weight:600;margin:14px 0 0}
main{padding-top:0}.datebar{justify-content:space-between;padding:2px 0 0;gap:2px}.datebar button{position:relative;flex:1;min-height:46px;padding:10px 0;font-size:1.02rem;font-weight:500;border-radius:0;letter-spacing:0}.datebar small{display:none}.datebar button.active{background:transparent;color:var(--blue)}.datebar button.active:after{content:'';position:absolute;left:15%;right:15%;bottom:3px;height:3px;border-radius:5px;background:var(--blue)}
.dayheading{padding:17px 0 10px}.dayheading h1{margin:0;font-size:1.5rem;font-weight:600;letter-spacing:.015em}.day-title{margin:1px 0 4px;font-size:1.1rem;font-weight:500}.time-note{margin:0;font-size:.875rem;color:var(--secondary)}
.day-tools{display:flex;border-bottom:1px solid var(--rule);padding-bottom:7px;gap:0}.day-tools button{display:flex;justify-content:center;align-items:center;gap:8px;min-height:44px;width:50%;color:var(--blue);font-size:1rem;font-weight:500}.day-tools button+button{position:relative}.day-tools button+button:before{content:'';position:absolute;left:0;top:12px;bottom:12px;border-left:1px solid var(--rule)}
.stops{padding:0;margin:0;list-style:none}.stop{display:grid;grid-template-columns:clamp(70px,19vw,120px) minmax(0,1fr);gap:0 14px;border-bottom:1px solid var(--rule);padding:14px 0;align-items:start}.stop-time{font-variant-numeric:tabular-nums;line-height:1.45;letter-spacing:.005em}.stop-time time{display:block;font-size:1.05rem;font-weight:600}.stop-time span{display:block;font-size:.84rem;color:var(--secondary)}
.stop h3{font-size:1.075rem;font-weight:600;line-height:1.45;margin:0}.stop-content p{margin:4px 0 0;font-size:.97rem;line-height:1.55;color:var(--secondary);overflow-wrap:anywhere}.stop-content .stop-route{font-size:.88rem;color:var(--blue)}
.place-detail{position:relative;display:flex;align-items:center;justify-content:space-between;gap:9px;width:100%;text-align:left;font:inherit;line-height:inherit;min-height:44px;padding:8px 4px 8px 0;margin:-8px 0 -7px;color:var(--ink)}.place-detail i{width:9px;height:9px;border:solid var(--blue);border-width:1.7px 1.7px 0 0;transform:rotate(45deg);flex:none}.place-detail:hover span,.place-detail:focus-visible span{color:var(--blue);text-decoration:underline}
.stop-trains{grid-column:1/-1;margin-top:6px}.train{font-size:1rem;margin:0}.train th{font-size:.84rem;color:var(--secondary);padding:8px 4px}.train td{font-size:.97rem;padding:9px 4px}.train td:first-child{width:clamp(95px,25%,160px);font-variant-numeric:tabular-nums}.train tr:last-child td{border-bottom:0}.train td small{font-size:.86rem;color:var(--secondary)}
.after-day{margin:22px 0}.dialoghead{font-weight:600}.dialoghead button{min-width:44px;min-height:44px}article{font-size:1rem;line-height:1.7}article h2,.sectiontop h2,h2{font-weight:500}article h3{font-weight:500}
button:focus-visible,a:focus-visible{outline:2px solid var(--blue);outline-offset:3px}button,select{touch-action:manipulation}nav a{font-size:.8rem;color:var(--secondary)}nav a.active{color:var(--blue)}.subtabs button{min-height:44px}input,select{font-size:1rem}
.step-when{color:var(--secondary);font-variant-numeric:tabular-nums}.step-route{color:var(--blue)}
.related-group{margin-top:20px}.related-place{display:block;width:100%;border-top:1px solid var(--rule);padding:13px 0;min-height:44px;color:var(--blue);text-align:left}

/* Keep the route, maps and bottom navigation clear of iOS screen insets. */
html { -webkit-text-size-adjust: 100%; }
header, main {
  padding-inline-start: max(28px, env(safe-area-inset-left));
  padding-inline-end: max(28px, env(safe-area-inset-right));
}
.iconbtn, .dialoghead button { display:grid; place-items:center; }
html:has(dialog[open]) { overflow:hidden; }
.doclink, .stop-content, input, select { min-width:0; }
.dialoghead button { flex:none; }
.flightline strong, .metric { font-variant-numeric:tabular-nums; }

@media (max-width: 600px) {
  :root {
    --gutter: clamp(14px, 4vw, 20px);
    --caption-size: .8125rem;
    --label-size: .875rem;
    --body-size: 1rem;
    --safe-top: env(safe-area-inset-top, 0px);
    --wash: #f1f5f7;
  }
  body { font-size:var(--body-size); line-height:1.5; letter-spacing:.005em; }
  /* The sticky calendar sits below the system status area. Mask the scrolling rows above it. */
  body::before {
    content:""; position:fixed; inset:0 0 auto; height:var(--safe-top);
    background:var(--surface); pointer-events:none; z-index:7;
  }
  header, main {
    padding-inline-start:max(var(--gutter), env(safe-area-inset-left));
    padding-inline-end:max(var(--gutter), env(safe-area-inset-right));
  }
  header { padding-top:calc(4px + var(--safe-top)); padding-bottom:0; }
  .brand { font-size:1.5rem; letter-spacing:.035em; }
  .iconbtn { margin-right:-7px; color:var(--ink); }
  main { padding-top:0; padding-bottom:calc(74px + env(safe-area-inset-bottom)); }
  h1 { font-size:1.375rem; line-height:1.35; }
  h2, .sectiontop h2 { font-size:1.125rem; line-height:1.45; font-weight:600; margin:19px 0 8px; }
  h3 { font-size:1.0625rem; line-height:1.4; }
  .trip-summary { padding:0 0 8px; }
  .trip-summary p { font-size:var(--label-size); line-height:1.5; }
  .trip-summary p+p { color:var(--subtle); }
  .date-heading { margin:8px 0 0; font-size:1rem; }
  .datebar {
    gap:0; padding:0; top:var(--safe-top);
    scroll-margin-top:var(--safe-top);
    background:var(--surface); border-color:var(--rule);
  }
  .datebar button { min-height:44px; padding:4px 0; font-size:.9375rem; line-height:1.35; }
  .datebar button.active { font-weight:600; }
  .datebar button.active::after { left:20%; right:20%; bottom:2px; }
  .dayheading { padding:9px 0 1px; }
  .dayheading h1 { font-size:1.3125rem; line-height:1.35; }
  .day-title { margin:1px 0 2px; font-size:1.0625rem; line-height:1.4; text-wrap:pretty; }
  .time-note { color:var(--subtle); font-size:var(--caption-size); }
  .day-tools { padding:0; }
  .day-tools button { min-height:44px; gap:6px; font-size:.9375rem; }
  .day-tools .svg { width:19px; height:19px; }
  .stop { grid-template-columns:4.25rem minmax(0,1fr); gap:0 10px; padding:9px 0; }
  .stop-time { min-width:0; line-height:1.35; overflow-wrap:anywhere; }
  .stop-time time { font-size:1.0625rem; font-weight:600; }
  .stop-time span { font-size:var(--caption-size); color:var(--subtle); margin-top:2px; }
  .stop h3 { font-size:1rem; line-height:1.4; }
  .place-detail { margin:-9px 0; padding:9px 3px 9px 0; gap:8px; }
  .place-detail i { width:8px; height:8px; margin-right:2px; }
  .stop-content p { color:var(--subtle); font-size:.9375rem; line-height:1.45; margin:2px 0 0; }
  .stop-content .stop-route { font-size:var(--label-size); line-height:1.4; color:var(--blue); }
  .stop-trains { margin-top:8px; }
  .train, article .train {
    display:table; border-collapse:separate; border-spacing:0; table-layout:fixed;
    width:100%; margin:0; background:var(--wash); border-radius:10px;
  }
  .train th, .train td, article .train td { min-width:0; padding:6px 12px; overflow-wrap:anywhere; }
  .train th { font-size:var(--label-size); color:var(--subtle); line-height:1.4; padding-top:8px; }
  .train th:first-child { width:6.25rem; }
  .train td, article .train td { font-size:.9375rem; line-height:1.45; padding-block:7px; }
  .train td:first-child { width:auto; }
  .train td time { font-weight:600; }
  .train td small { font-size:var(--label-size); color:var(--subtle); margin-top:2px; }
  article .train { margin:14px 0; }
  .sectiontop { margin:17px 0 0; }
  .sectiontop h2 { margin:0; }
  .sectiontop .svg { width:19px; color:var(--blue); }
  .flight { padding:10px 0 12px; }
  .flighthead { font-size:var(--label-size); margin-bottom:6px; gap:8px; }
  .flightline { grid-template-columns:minmax(0,1fr) 44px minmax(0,1fr); }
  .flightline strong { font-size:1.625rem; line-height:1.25; font-weight:500; }
  .flightline small, .hotel small { font-size:var(--caption-size); line-height:1.5; color:var(--subtle); }
  .hotel { grid-template-columns:4.75rem minmax(0,1fr) 12px; gap:10px; padding:10px 0; }
  .hotel h3 { margin:0 0 2px; font-size:1.0625rem; font-weight:500; }
  .hotel>span { font-size:var(--label-size); color:var(--subtle); }
  .quickgrid { gap:8px; }
  .quickgrid button { font-size:1rem; min-height:48px; padding:11px 12px; gap:8px; }
  .hero { padding:10px 0 8px; }
  .hero h1 { margin:0; }
  .hero p { margin:5px 0 0; font-size:1rem; color:var(--subtle); }
  .mapgrid { grid-template-columns:minmax(0,1fr); gap:12px; }
  .maptile img { display:block; height:auto; max-height:210px; }
  .maptile span { padding:9px 12px; font-size:var(--label-size); text-align:left; }
  .listrow { min-height:44px; padding:10px 0; font-size:var(--body-size); overflow-wrap:anywhere; }
  .listrow small, .muted, label { color:var(--subtle); }
  .listrow small, label, .barrow { font-size:var(--label-size); }
  .listrow button { flex:none; min-width:44px; min-height:44px; }
  .note { margin:12px 0; padding:11px 13px; color:var(--subtle); font-size:var(--label-size); line-height:1.55; }
  .subtabs { justify-content:space-between; gap:8px; margin:16px 0; }
  .subtabs button { min-width:44px; font-size:1rem; padding:8px 0; }
  .formgrid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px 12px; }
  .formgrid label { min-width:0; }
  input, select { font-size:max(16px,1rem); min-height:48px; margin-top:4px; padding:9px 10px; }
  .barrow { grid-template-columns:3.3rem minmax(16px,1fr) auto; gap:9px; }
  .barrow span:last-child { font-variant-numeric:tabular-nums; }
  .pill { min-height:44px; font-size:1rem; }
  nav {
    background:var(--surface);
    display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:0;
    padding:3px var(--gutter) calc(3px + env(safe-area-inset-bottom));
  }
  nav a { min-height:48px; min-width:0; justify-content:center; gap:1px; font-size:var(--caption-size); line-height:1.35; }
  nav .svg { width:20px; height:20px; }
  nav a.active { font-weight:600; }
  dialog {
    position:fixed; inset:auto 0 0; margin:0; width:100%; max-width:none;
    max-height:calc(100dvh - env(safe-area-inset-top) - 12px);
    border-radius:16px 16px 0 0; overflow:hidden; color:var(--ink);
  }
  dialog[open] { display:flex; flex-direction:column; }
  .dialoghead { flex:none; gap:12px; padding:5px var(--gutter); font-size:1.125rem; line-height:1.4; }
  #dialogtitle { overflow-wrap:anywhere; }
  .dialoghead button { margin-right:-6px; color:var(--blue); }
  #dialogbody {
    min-height:0; overflow-y:auto; overscroll-behavior:contain;
    padding:15px var(--gutter) calc(18px + env(safe-area-inset-bottom));
    font-size:var(--body-size); line-height:1.55;
  }
  article p, article li { font-size:var(--body-size); line-height:inherit; }
  article h2 { font-size:1.125rem; }
  article h3 { font-size:1.0625rem; }
  article table:not(.train) { max-width:100%; font-size:var(--label-size); }
  article table:not(.train) td { padding:8px; min-width:6rem; }
  article ul, article ol { padding-inline-start:1.45em; }
  article img { display:block; margin-inline:auto; }
  article summary, .related-place { padding-block:10px; min-height:44px; }
  article a { color:var(--blue); text-decoration:underline; text-underline-offset:3px; }
  .after-day { margin:14px 0 0; }
  #toast { bottom:calc(74px + env(safe-area-inset-bottom)); }
}
@media (max-width: 359px) {
  .stop { grid-template-columns:3.9rem minmax(0,1fr); gap:8px; }
  .datebar { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
  .datebar:not(:has([data-day="all"])) { display:flex; }
  .datebar button { min-height:44px; }
  .subtabs { gap:5px; }
}

/* Ink stays dark for small type. Tints are reserved for navigation and compact indicators. */
:root {
  --slate:#315469; --plum:#604967; --clay:#803e2d; --ochre:#6c501d;
  --berry:#75445d; --walnut:#68492f; --teal:#285c56;
}
[data-kind="travel"] { --accent:var(--slate); --tint:#edf3f6; }
[data-kind="stay"] { --accent:var(--plum); --tint:#f4eff6; }
[data-kind="food"] { --accent:var(--clay); --tint:#f9efeb; }
[data-kind="sight"] { --accent:var(--ochre); --tint:#f8f3e9; }
[data-kind="shop"] { --accent:var(--berry); --tint:#f8f0f3; }
[data-kind="money"], [data-view="expenses"] { --accent:var(--walnut); --tint:#f6f1ec; }
[data-kind="guide"] { --accent:#655e56; --tint:#f3f1ee; }
.home-section, .sectiontop[data-kind] h2 { color:var(--accent); }
.flighthead>span:first-child, .flight .airline, .hotel h3, .hotel>span:last-child { color:var(--accent); }
.quickgrid button[data-kind] { background:var(--tint); color:var(--accent); }
.day-tools button[data-kind] { color:var(--accent); }
.stop h3, .stop .place-detail { color:var(--accent); }
.stop .place-detail i { border-color:var(--accent); }
.stop .place-detail:focus-visible span, .stop .place-detail:hover span { color:var(--accent); }
.listrow.doclink[data-kind] { color:var(--accent); }
dialog[data-kind] .dialoghead { background:var(--tint); color:var(--accent); }
dialog[data-kind] .dialoghead button { color:inherit; }
#dialogbody h2:first-child { margin-top:0; }
[data-view="expenses"] .metric, [data-view="expenses"] .hero h1 { color:var(--accent); }
[data-view="expenses"] .bartrack i { background:var(--accent); }
[data-view="expenses"] .subtabs .active { color:var(--accent); border-color:var(--accent); }
#dialogbody [data-ink="yellow"] { color:var(--ochre); }
#dialogbody [data-ink="orange"], #dialogbody [data-ink="red"] { color:var(--clay); }
#dialogbody [data-ink="brown"] { color:var(--walnut); }
#dialogbody [data-ink="brown_bg"] { background:#f4f0eb; color:var(--walnut); }
#dialogbody [data-ink="blue"] { color:var(--slate); }
#dialogbody [data-ink="green"] { color:var(--teal); }
#dialogbody [data-ink="purple"] { color:var(--plum); }
#dialogbody [data-ink="pink"] { color:var(--berry); }
#dialogbody [data-ink="gray"] { color:var(--secondary); }
