* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--fs-body)/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  padding:
    calc(var(--tg-content-safe-area-inset-top, 0px) + env(safe-area-inset-top, 0px)) 0
    calc(var(--tabs-h) + var(--tg-safe-area-inset-bottom, 0px) + env(safe-area-inset-bottom, 0px) + 96px);
  min-height: 100vh;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.time, .num { font-variant-numeric: tabular-nums; }
.code { font-family: var(--font-code); font-variant-numeric: slashed-zero tabular-nums; font-size: var(--fs-17); }
.signal { color: var(--signal); }
.alarm { color: var(--alarm); }
.muted { color: var(--graphite); }
[lang="zh-Hans"] { word-break: keep-all; line-break: strict; }

/* masthead: city in Latin script, the local script as display type */
.mast { padding: 16px var(--gutter) 14px; }
.mast-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.city { margin: 0; font-size: var(--fs-30); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.mast .date { font-size: var(--fs-14); color: var(--graphite); }
.zh-display { font-family: var(--font-zh-display); font-size: var(--fs-32); line-height: 1.2; color: var(--signal); }
.mast .mode { font-size: var(--fs-13); color: var(--graphite); }
.mast h1.page { margin: 0; font-size: var(--fs-26); font-weight: 700; letter-spacing: -0.02em; }
.mast .kicker { display: block; font-size: var(--fs-13); color: var(--graphite); margin-bottom: 2px; }

/* bottom tabs: Planer, Heute, Journal, Belege */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr);
        padding: 7px 0 calc(6px + var(--tg-safe-area-inset-bottom, 0px) + env(safe-area-inset-bottom, 0px));
        background: var(--surface); border-top: 1px solid var(--line); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: var(--fs-11);
          font-weight: 500; text-decoration: none; color: var(--graphite); }
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.6;
            stroke-linejoin: round; stroke-linecap: round; }
.tabs a[aria-current="page"] { color: var(--signal); }

main { padding: 0 var(--gutter); }
.label { font-size: var(--fs-13); color: var(--graphite); }
.empty { color: var(--graphite); padding: 24px 0; }
.note { font-size: var(--fs-13); color: var(--graphite); margin: 8px 0 0; }
h2.section { font-size: var(--fs-13); font-weight: 600; color: var(--graphite); margin: 22px 0 6px; }

/* planner: map card, tiles in route order, stop page, place search */
.map-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
            overflow: hidden; margin-bottom: 12px; }
.map-box { width: 100%; aspect-ratio: 10 / 6; }
.map-svg { display: block; width: 100%; height: 100%; }
.map-off { padding: 24px 16px; margin: 0; }
.map-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px 0 14px; }
.map-toggle { display: flex; padding: 3px; gap: 2px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; }
.map-toggle button { border: 0; background: none; border-radius: 999px; padding: 4px 11px; font-size: var(--fs-12);
                     font-weight: 600; color: var(--graphite); cursor: pointer; }
.map-toggle button[aria-pressed="true"] { background: var(--signal); color: var(--on-signal); }
.map-svg .sphere { fill: var(--paper); stroke: var(--line); }
.map-svg .land { fill: none; stroke: var(--dot); stroke-linecap: round; }
.map-svg .leg { fill: none; stroke: var(--signal); stroke-width: 1.8; stroke-linecap: round; }
.map-svg .leg.idea { stroke-dasharray: 3 4; }
.map-svg .stop { fill: var(--signal); stroke: var(--surface); stroke-width: 2.5; }
.map-svg .stop.idea { fill: var(--surface); stroke: var(--signal); stroke-width: 1.6; }
.map-svg .stop.noted, .map-svg .lbl.noted { opacity: 0.7; }
.map-svg .stop.home { fill: var(--ink); stroke-width: 1.5; }
.map-svg .pulse { fill: var(--signal); opacity: 0.12; }
.map-svg .lbl { font-size: var(--fs-11); font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--halo);
                stroke-width: 3px; stroke-linejoin: round; }
.map-svg .edge { font-size: var(--fs-11); font-weight: 600; fill: var(--graphite); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.tile { display: flex; flex-direction: column; min-height: 96px; padding: 11px 14px 12px; border-radius: var(--r-tile);
        background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.tile-zh { font-family: var(--font-zh-display); font-size: var(--fs-26); line-height: 1.15; letter-spacing: 2px; color: var(--signal); }
.tile-latin { font-size: var(--fs-20); font-weight: 700; color: var(--signal); }
.tile b { margin-top: auto; font-size: var(--fs-body); font-weight: 600; }
.tile small { font-size: var(--fs-12); color: var(--graphite); }
.tile small.alarm { color: var(--alarm); }
.tile.idea { background: transparent; border: 1.5px dashed var(--dot); }
.tile.idea .tile-zh, .tile.idea .tile-latin { color: var(--graphite); }
.tile.add { background: var(--signal-soft); border: 0; color: var(--signal); }
.tile.add .plus { font-size: var(--fs-30); font-weight: 300; line-height: 1; }
.tile.add small { color: var(--signal); opacity: 0.8; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0;
                 border-bottom: 1px solid var(--line); }
.plain-list a { text-decoration: none; }
.zh-sm { font-size: var(--fs-body); }
.stop-sheet { padding-top: 4px; }
.booked-line { margin: 0 0 6px; font-weight: 600; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0;
         border-bottom: 1px solid var(--line); }
.field.column { flex-direction: column; align-items: stretch; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
                  font-size: var(--fs-20); color: var(--signal); cursor: pointer; }
.stepper .num { min-width: 40px; text-align: center; font-size: var(--fs-20); font-weight: 700; }
.seg2 { display: flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.seg2 button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; color: var(--graphite); font-weight: 600; cursor: pointer; }
.seg2 button[aria-pressed="true"] { background: var(--signal); color: var(--on-signal); }
textarea.short { min-height: 84px; font: 400 var(--fs-body)/1.45 var(--font-ui); margin-top: 8px; }
.stop-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 14px;
       font-weight: 600; color: var(--ink); cursor: pointer; }
.btn.danger { color: var(--alarm); }
.search { width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
          color: var(--ink); font: 400 var(--fs-17) var(--font-ui); }
.results { list-style: none; padding: 0; margin: 8px 0 0; }
.results button { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 12px 0;
                  border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); cursor: pointer; }
.results .zh-md { font-family: var(--font-zh-display); color: var(--signal); min-width: 56px; }
.results b { display: block; font-weight: 600; }
.results small { color: var(--graphite); font-size: var(--fs-13); }

/* Heute: the region around "here" with local and home time */
.here-map { position: relative; background: var(--surface); border-bottom: 1px solid var(--line); margin-bottom: 0; }
.map-chip { position: absolute; top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
            padding: 6px 12px; font-size: var(--fs-13); box-shadow: 0 2px 8px var(--shadow); }
.map-chip.left { left: 14px; }
.map-chip.right { right: 14px; }
.next.overlap { margin-top: -40px; position: relative; box-shadow: 0 10px 30px var(--shadow); }
.overlap-gap { height: 12px; }

/* "Als Nächstes": the departure board's one large field */
.next { background: var(--next-bg); color: var(--next-ink); border-radius: var(--r-card); padding: 18px;
        margin-bottom: 20px; border: 1px solid var(--next-line); }
.next .label, .next .captions, .next .cols dt, .next .note, .next .muted { color: inherit; opacity: 0.8; }
.next .signal { color: var(--next-accent); }
.next-head { display: flex; justify-content: space-between; align-items: baseline; }
.next-head .rel { font-size: var(--fs-14); font-weight: 600; }
.next-main { display: flex; justify-content: space-between; align-items: baseline; margin: 2px 0 6px; }
.time.big { font-size: var(--fs-44); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.next-title { font-size: var(--fs-20); font-weight: 600; margin: 0 0 6px; }
.route { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.route .track { height: 1px; background: var(--next-line); }
.zh-md { font-size: var(--fs-24); }
.captions { font-size: var(--fs-14); color: var(--graphite); margin-top: 2px; }
.captions span:last-child { text-align: right; grid-column: 3; }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); margin: 14px 0 0; padding: 12px 0 0;
        border-top: 1px solid var(--next-line); }
.cols dt { font-size: var(--fs-12); color: var(--graphite); }
.cols dd { margin: 2px 0 0; font-size: var(--fs-20); font-weight: 500; font-variant-numeric: tabular-nums; }
.leave { margin: 12px 0 0; font-weight: 600; }
.card-actions { display: flex; gap: 10px; margin-top: 14px; }
.next .card-actions .text-btn { flex: 1; text-align: center; padding: 12px 0; border-radius: 13px;
                                 background: var(--next-btn); color: var(--next-ink); font-size: var(--fs-body); }
.next .card-actions .text-btn:first-child { background: var(--next-accent); color: var(--next-bg); }
.text-btn { background: none; border: 0; padding: 6px 0; color: var(--signal); font-weight: 600;
            cursor: pointer; text-decoration: none; font-size: var(--fs-body); }

/* board rows: time | what | status, fixed columns */
.board { list-style: none; margin: 0 0 20px; padding: 0; }
.row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: baseline;
       padding: 12px 0; border-bottom: 1px solid var(--line); }
.row .time { font-size: var(--fs-body); font-weight: 600; }
.row .what { min-width: 0; }
.row .what small { display: block; font-size: var(--fs-13); color: var(--graphite); margin-top: 2px; }
.row .state { font-size: var(--fs-13); color: var(--graphite); }
.row.done .state { color: var(--ok); }
.row.past { color: var(--graphite); }
.row.past .time { font-weight: 400; }
.row.free .what { color: var(--graphite); font-style: italic; }
.gap { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 6px 0;
       font-size: var(--fs-14); color: var(--graphite); border-bottom: 1px solid var(--line); }
.gap.alarm { color: var(--alarm); }
.row-actions { grid-column: 2 / 4; display: flex; gap: 18px; }
.row-actions .text-btn { font-size: var(--fs-14); padding: 2px 0; }

/* days */
.days { list-style: none; padding: 0; margin: 0; }
.days a { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 14px 0;
          border-bottom: 1px solid var(--line); text-decoration: none; align-items: baseline; }
.days .day-no { font-size: var(--fs-14); color: var(--graphite); }
.days .day-city { font-weight: 600; }
.days .day-city span { margin-left: 8px; font-weight: 400; }
.days .day-meta { font-size: var(--fs-14); color: var(--graphite); }
.days .today .day-no { color: var(--signal); font-weight: 600; }

/* journal */
.seg { display: flex; gap: 18px; margin: 0 0 12px; }
.seg button { background: none; border: 0; padding: 4px 0; color: var(--graphite); cursor: pointer;
              border-bottom: 2px solid transparent; font-size: var(--fs-body); }
.seg button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--signal); }
textarea { width: 100%; min-height: 150px; resize: vertical; border: 1px solid var(--line);
           border-radius: var(--r-tile); background: var(--surface); color: var(--ink);
           font: 400 var(--fs-20)/1.45 var(--font-journal); padding: 14px; }
textarea.sealed { font-family: var(--font-ui); font-size: var(--fs-17); }
.entries { list-style: none; padding: 0; margin: 20px 0 0; }
.entry { padding: 14px 0; border-bottom: 1px solid var(--line); }
.entry .postcard { font-family: var(--font-journal); font-size: var(--fs-20); line-height: 1.45; margin: 4px 0 0; }
.entry p { margin: 4px 0 0; }

/* receipts */
.receipts { list-style: none; padding: 0; margin: 0; }
.receipt { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 0;
           border-bottom: 1px solid var(--line); }
.receipt .amount { font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; }
.chips { grid-column: 1 / 3; display: flex; gap: 8px; }
.chip { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 4px 12px;
        font-size: var(--fs-14); color: var(--graphite); cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--signal); background: var(--signal-soft); color: var(--signal); }
.upload { display: block; margin: 0 0 16px; }
.upload input { display: none; }

/* status */
.checks { list-style: none; padding: 0; margin: 0 0 20px; }
.checks li { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.checks .ok { color: var(--ok); }
.checks .bad { color: var(--alarm); }

/* confirmation */
.confirm { padding: 48px 0; }
.confirm .big { font-size: var(--fs-30); font-weight: 700; margin: 0 0 8px; }

/* taxi card: a sign for the driver, black on white, no brand colour */
body.taxi-mode { background: var(--sign-paper); color: var(--sign-ink); }
body.taxi-mode .tabs, body.taxi-mode #top { display: none; }
.taxi { padding: 24px var(--gutter); }
.taxi-ask { font-size: var(--fs-24); margin: 0 0 12px; }
/* sizes are fitted to the screen width by fitText(); these are the targets */
.taxi-name { font-size: 72px; font-weight: 600; line-height: 1.1; margin: 0 0 16px; word-break: normal; overflow-wrap: anywhere; }
.taxi-addr { font-size: 48px; line-height: 1.2; margin: 0 0 16px; }
.taxi-addr span { display: block; white-space: nowrap; }
.taxi-phone { font-size: 40px; font-weight: 500; margin: 0 0 20px; white-space: nowrap; }
.taxi-latin { font-size: var(--fs-17); margin: 0; }
.taxi-warn { font-size: var(--fs-14); margin: 8px 0 0; }
.taxi-back { margin-top: 24px; background: none; border: 1px solid var(--sign-ink); color: var(--sign-ink);
             border-radius: 999px; padding: 8px 18px; font-size: var(--fs-17); }
@media (orientation: landscape) {
  .taxi-addr span { display: inline; margin-right: 0.4em; }
}

/* fallback action bar outside Telegram (preview only); in Telegram the MainButton is used */
.bar { position: fixed; left: 0; right: 0; z-index: 9; padding: 10px var(--gutter);
       bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px)); background: var(--paper); }
.bar button { width: 100%; border: 0; border-radius: 14px; padding: 15px; background: var(--signal);
              color: var(--on-signal); font-weight: 600; font-size: var(--fs-body); }
body.taxi-mode .bar { bottom: 0; }
.bar[hidden] { display: none; }

.view-enter { animation: enter var(--dur) var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view-enter { animation: none; } }
