/* Thaimaa 2026 — reissusovellus
   Design: "Command / Inspect" -pinta. Puhelin kädessä, aurinko paistaa,
   tieto pitää löytyä sekunnissa. Ei koristeita, ei lasimaisuutta. */

:root {
  --paper: #faf6ef;
  --surface: #ffffff;
  --surface-2: #f3ede2;
  --ink: #1b1a17;
  --ink-2: #55514a;
  --ink-3: #8b857b;
  --line: #e4dccd;
  --line-2: #d2c7b3;
  --teal: #0b5d57;
  --teal-soft: #e2efec;
  --coral: #b34a2e;
  --coral-soft: #f8e6e0;
  --gold: #8a6420;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(27, 26, 23, 0.05), 0 10px 26px -18px rgba(27, 26, 23, 0.35);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --tabbar-h: calc(58px + env(safe-area-inset-bottom, 0px));
}

[data-theme="dark"] {
  --paper: #12100e;
  --surface: #1b1917;
  --surface-2: #242120;
  --ink: #f4efe6;
  --ink-2: #c1bab0;
  --ink-3: #8c857b;
  --line: #302c29;
  --line-2: #464039;
  --teal: #5cbcae;
  --teal-soft: #14302e;
  --coral: #ea8468;
  --coral-soft: #38201a;
  --gold: #d3a95c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 26px -18px rgba(0, 0, 0, 0.9);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(var(--tabbar-h) + 8px);
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--teal); }

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-top, 0px) * 0);
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__title {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex: 1;
  min-width: 0;
}

.topbar__sub {
  display: block;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.pill {
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink-2);
}

.pill--live { background: var(--teal); border-color: var(--teal); color: #fff; }
[data-theme="dark"] .pill--live { color: #0b1a19; }

.iconbtn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--surface);
  cursor: pointer;
}
.iconbtn:active { transform: scale(0.96); }

/* ---------- layout ---------- */

.wrap { max-width: 620px; margin: 0 auto; padding: 0 16px; }

.view { display: none; padding-bottom: 24px; }
.view.is-active { display: block; animation: fade 0.18s ease-out; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section { margin-top: 26px; }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section__title {
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: -0.01em;
}

.eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 10px; }

.card__title { font-size: 16.5px; font-weight: 650; }
.card__meta { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }

.demo-note {
  margin: 14px 0 0;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-2);
}

/* ---------- hero / countdown ---------- */

.hero {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: var(--shadow);
}

.hero__label {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--teal);
}

.countdown {
  font-family: var(--display);
  font-size: 58px;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 6px 0 2px;
}

.countdown small { font-size: 20px; font-family: var(--sans); font-weight: 500; color: var(--ink-2); margin-left: 6px; letter-spacing: 0; }

.hero__grid {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.kv__k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); font-weight: 600; }
.kv__v { font-size: 15px; font-weight: 600; margin-top: 2px; }

/* ---------- tiles ---------- */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tile {
  text-align: left;
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.tile:active { transform: scale(0.985); }
.tile__t { font-weight: 650; font-size: 15px; }
.tile__s { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.tile--alert { background: var(--coral-soft); border-color: color-mix(in srgb, var(--coral) 35%, var(--line)); }
.tile--alert .tile__t { color: var(--coral); }

/* ---------- next-up card ---------- */

.nextup {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}
[data-theme="dark"] .nextup { color: #08201e; }

.nextup__time { font-family: var(--mono); font-size: 13px; opacity: 0.85; }
.nextup__t { font-weight: 650; font-size: 17px; letter-spacing: -0.01em; }
.nextup__s { font-size: 13.5px; opacity: 0.9; }
.nextup__in { margin-left: auto; text-align: right; font-size: 13px; opacity: 0.95; font-weight: 600; }
.nextup__in span { display: block; font-family: var(--display); font-size: 24px; letter-spacing: -0.02em; }

/* ---------- segments ---------- */

.segments { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.segment {
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-width: 128px;
}
.segment--now { border-color: var(--teal); background: var(--teal-soft); }
.segment__city { font-weight: 650; font-size: 14.5px; }
.segment__dates { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

/* ---------- rows / agenda ---------- */

.row {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.row:last-child { border-bottom: 0; }
.row__time { font-family: var(--mono); font-size: 13.5px; color: var(--ink-2); flex: 0 0 52px; padding-top: 2px; }
.row__b { min-width: 0; }
.row__t { font-size: 15px; font-weight: 600; }
.row__s { font-size: 13.5px; color: var(--ink-2); }
.row--done { opacity: 0.5; }

.empty { font-size: 14px; color: var(--ink-3); padding: 8px 0; }

/* ---------- flights ---------- */

.flight { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 15px; box-shadow: var(--shadow); margin-bottom: 12px; }

.flight__head { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.flight__head .spacer { flex: 1; }

.route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 14px 0 4px; }
.route__end { min-width: 0; }
.route__end--to { text-align: right; }
.route__code { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.route__city { font-size: 12.5px; color: var(--ink-2); }
.route__time { font-family: var(--mono); font-size: 19px; font-weight: 600; margin-top: 4px; }
.route__date { font-size: 12px; color: var(--ink-3); }

.route__tz { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

.route__line { text-align: center; color: var(--ink-3); min-width: 84px; }
.route__line svg { display: block; margin: 0 auto; }
.route__dur { font-size: 11.5px; margin-top: 2px; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }

/* ---------- refs ---------- */

.ref {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  cursor: pointer;
}
.ref:active { transform: scale(0.99); }
.ref__k { font-size: 12.5px; color: var(--ink-2); }
.ref__v { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: 0.02em; margin-left: auto; }
.ref__hint { font-size: 11.5px; color: var(--ink-3); }
.ref.is-copied { border-color: var(--teal); background: var(--teal-soft); }

/* ---------- stays ---------- */

.stay { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 15px; box-shadow: var(--shadow); margin-bottom: 12px; }
.stay__nights { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.stay__addr { font-size: 14px; color: var(--ink-2); margin-top: 10px; }

.hosp {
  margin-top: 13px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--coral-soft);
  border: 1px solid color-mix(in srgb, var(--coral) 28%, var(--line));
}
.hosp__k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700; color: var(--coral); }
.hosp__n { font-weight: 650; font-size: 15px; margin-top: 3px; }
.hosp__a { font-size: 13px; color: var(--ink-2); }
.hosp__d { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }

.btn {
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 11px;
  padding: 10px 13px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn:active { transform: scale(0.98); }
.btn--solid { background: var(--teal); border-color: var(--teal); color: #fff; }
[data-theme="dark"] .btn--solid { color: #08201e; }
.btn--danger { background: var(--coral); border-color: var(--coral); color: #fff; }
[data-theme="dark"] .btn--danger { color: #2a1009; }
.btn--wide { width: 100%; justify-content: center; }

/* ---------- itinerary ---------- */

.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.day--today { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.day__sum { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; }
.day__sum::-webkit-details-marker { display: none; }
.day__d { font-family: var(--mono); font-size: 13px; font-weight: 600; flex: 0 0 46px; color: var(--ink-2); }
.day__b { flex: 1; min-width: 0; }
.day__city { font-weight: 650; font-size: 15px; }
.day__note { font-size: 13px; color: var(--ink-2); }
.day__chev { color: var(--ink-3); transition: transform 0.15s ease; }
details[open] .day__chev { transform: rotate(90deg); }
.day__body { padding: 2px 14px 12px; border-top: 1px solid var(--line); }

/* ---------- ideas ---------- */

.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 8px; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.idea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; margin-bottom: 9px; }
.idea__head { display: flex; align-items: baseline; gap: 8px; }
.idea__n { font-weight: 650; font-size: 15.5px; flex: 1; min-width: 0; }
.tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gold); white-space: nowrap; }
.idea__s { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; }
.idea__m { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex;
}

.tab {
  flex: 1;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  padding: 6px 2px;
}
.tab.is-on { color: var(--teal); }
.tab svg { width: 21px; height: 21px; }

/* ---------- sheets ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.sheet.is-open { display: flex; }
.sheet__scrim { position: absolute; inset: 0; background: rgba(15, 14, 12, 0.42); }
.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet__grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 8px auto 12px; }
.sheet__title { font-family: var(--display); font-size: 20px; margin-bottom: 4px; }

/* driver / emergency fullscreen */
.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: #fff;
  color: #000;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px calc(18px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}
.fullscreen.is-open { display: block; }
.fullscreen__k { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #555; }
.fullscreen__big { font-size: 34px; font-weight: 700; line-height: 1.15; margin: 10px 0 4px; letter-spacing: -0.01em; }
.fullscreen__body { font-size: 21px; line-height: 1.35; }
.fullscreen__phone { font-family: var(--mono); font-size: 26px; font-weight: 700; margin-top: 14px; }
.fullscreen__close { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; width: 46px; height: 46px; border-radius: 50%; border: 2px solid #000; background: #fff; font-size: 22px; font-weight: 700; cursor: pointer; }

.emerg__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.emerg {
  display: block;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 13px;
  background: var(--coral-soft);
  border: 1px solid color-mix(in srgb, var(--coral) 32%, var(--line));
  color: var(--ink);
}
.emerg__n { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--coral); }
.emerg__t { font-size: 13px; font-weight: 600; }

.list { margin: 6px 0 0; padding: 0; list-style: none; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list li:last-child { border-bottom: 0; }
.list b { font-weight: 650; }

.checklist { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
.checklist li { margin-bottom: 5px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px);
  transform: translate(-50%, 10px);
  background: var(--ink);
  color: var(--paper);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 300;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .countdown { font-size: 66px; }
}

@media print {
  .tabbar, .topbar { display: none; }
  .view { display: block !important; }
}
