/* ไปกัน! — TIME tab (prefix .tm-) · design v2: white cards, iOS grouped rows, clean rail, tabular numbers.
   Type: one family via --font-body/--font-display (400 body, 700 titles/labels), numbers via --font-num.
   Layout is driven by container queries on .tm-root / .tm-day so it fits both a full-width
   phone panel and the narrow (~340–440px) side panel of the iPad split view.
   Colors: tokens only. */

.tm-root {
  display: flex; flex-direction: column; gap: var(--sp-4);
  min-width: 0;
  container: tm / inline-size;
}
.tm-root h2, .tm-root h3 { min-width: 0; }
.tm-root p { margin: 0; }
.tm-root .badge { min-width: 0; }
.tm-root .badge > span { overflow-wrap: anywhere; white-space: normal; }
.tm-root .badge svg { flex: 0 0 auto; }

/* ---------------- summary: header card = the shared v3 map card (css/base.css .hero, data-hero="time") ---------------- */
.tm-sum { display: flex; flex-direction: column; gap: var(--sp-4); }
.tm-sum-head { min-width: 0; }
.tm-sum-titles { min-width: 0; }
.tm-sum-title { font-size: var(--fs-xl); }
.tm-verdict { margin-top: 6px; padding: 5px 12px 5px 10px; font-size: var(--fs-sm); gap: 6px; }
.tm-verdict svg { width: 16px; height: 16px; }

.tm-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
@container tm (min-width: 560px) { .tm-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); } }
.tm-stat {
  display: flex; flex-direction: column; gap: 6px;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  min-width: 0;
}
.tm-stat-label { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-xs); font-weight: 700; color: var(--hero-on); }
.tm-stat-label svg { color: var(--hero-on); flex: 0 0 auto; }
.tm-stat-label > span { min-width: 0; overflow-wrap: anywhere; }
.tm-stat-val { display: block; line-height: 1.2; color: var(--hero-on); overflow-wrap: anywhere; }
.tm-stat-val b { font-family: var(--font-num); font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.tm-stat-val small { font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 700; color: var(--hero-on-2); margin-left: 3px; }
@container tm (max-width: 340px) { .tm-stat-val b { font-size: 1.2rem; } }
.tm-sum-fuel {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  padding-top: var(--sp-3); border-top: 1px solid var(--hero-line);
  font-size: var(--fs-xs); color: var(--hero-on-2); line-height: 1.5;
}
.tm-sum-fuel svg { color: var(--hero-warn); margin-top: 1px; flex: 0 0 auto; }
.tm-sum-fuel > span { min-width: 0; overflow-wrap: anywhere; }
.tm-sum-fuel b { color: var(--hero-on); font-weight: 700; }

/* ---------------- riding style: grouped rows ---------------- */
.tm-ride { padding: 0; overflow: hidden; }
.tm-ride-sum {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 64px; padding: var(--sp-3) var(--sp-4);
  list-style: none; cursor: pointer;
  min-width: 0;
  transition: background var(--dur);
}
.tm-ride-sum::-webkit-details-marker { display: none; }
.tm-ride-sum::marker { content: ""; }
.tm-ride-sum:active { background: var(--surface-2); }
.tm-ride-sum:focus-visible { border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: inset var(--focus-ring); }
.tm-ride:not([open]) .tm-ride-sum:focus-visible { border-radius: var(--r-lg); }
.tm-ride-titles { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.tm-ride-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-md); }
.tm-ride-now { font-size: var(--fs-xs); color: var(--ink-2); overflow-wrap: anywhere; }
.tm-chev { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-sunk); color: var(--ink-2); transition: transform var(--dur) var(--ease); }
.tm-ride[open] .tm-chev { transform: rotate(180deg); }
.tm-ride[open] .tm-ride-now { display: none; }
.tm-ride-body { display: flex; flex-direction: column; border-top: 1px solid var(--line); min-width: 0; }

.tm-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  min-width: 0;
}
.tm-row + .tm-row { border-top: 1px solid var(--line); }
.tm-row-col { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
.tm-row-cap { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); }
.tm-row-lbl { display: flex; align-items: center; gap: var(--sp-3); flex: 1 1 auto; min-width: 0; }
.tm-row-lbl b { display: block; font-weight: 700; line-height: 1.35; }
.tm-row-lbl small { display: block; font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.35; overflow-wrap: anywhere; }

.tm-seg { width: 100%; }
.tm-seg button { flex: 1 1 0; min-height: 44px; }
.tm-seg button > span { overflow: hidden; text-overflow: ellipsis; }
.tm-seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.tm-seg button[aria-checked="true"] svg { color: var(--primary); }
@container tm (max-width: 380px) { .tm-seg button svg { display: none; } .tm-seg button { padding: 6px 8px; } }

.tm-slider { gap: 2px; }
.tm-slider-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px var(--sp-3); min-width: 0; }
.tm-slider-val { font-size: var(--fs-sm); font-weight: 700; color: var(--primary); overflow-wrap: anywhere; min-width: 0; }
.tm-slider-x { color: var(--ink-3); font-weight: 400; }
.tm-slider-ends { display: flex; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--ink-3); }
.tm-range {
  --p: .5;
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 44px; margin: 0; padding: 0;
  background: transparent; cursor: pointer;
  border-radius: var(--r-pill);
}
.tm-range:focus-visible { box-shadow: none; }
.tm-range::-webkit-slider-runnable-track {
  height: 6px; border-radius: var(--r-pill);
  background: var(--grad-brand) 0 0 / calc(13px + (100% - 26px) * var(--p)) 100% no-repeat, var(--line-strong);
}
.tm-range::-moz-range-track { height: 6px; border-radius: var(--r-pill); background: var(--line-strong); }
.tm-range::-moz-range-progress { height: 6px; border-radius: var(--r-pill); background: var(--grad-brand); }
.tm-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; margin-top: -11px;
  border: 0; border-radius: 50%;
  background: var(--ink-inverse);
  box-shadow: 0 0 0 .5px var(--line-strong), var(--shadow-2);
  transition: transform 120ms var(--ease);
}
.tm-range::-moz-range-thumb {
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: var(--ink-inverse);
  box-shadow: 0 0 0 .5px var(--line-strong), var(--shadow-2);
}
.tm-range:active::-webkit-slider-thumb { transform: scale(1.08); }
.tm-range:focus-visible::-webkit-slider-thumb { box-shadow: var(--focus-ring), var(--shadow-2); }
.tm-range:focus-visible::-moz-range-thumb { box-shadow: var(--focus-ring); }

.tm-breaks { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.tm-switch { width: 100%; min-height: 48px; justify-content: space-between; gap: var(--sp-3); }
/* "พักทุก / ครั้งละ": sub-rows of the switch, inset to the text column like iOS grouped lists */
.tm-break-opts { display: flex; flex-direction: column; min-width: 0; margin-left: calc(var(--sp-4) + 34px + var(--sp-3)); }
.tm-break-opts[hidden] { display: none; }
.tm-break-opts > .tm-pick { padding-left: 0; border-top: 1px solid var(--line); flex-wrap: nowrap; min-height: 52px; padding-top: 6px; padding-bottom: 6px; cursor: pointer; }
.tm-pick-lbl { flex: 1 1 auto; min-width: 0; font-weight: 400; color: var(--ink); overflow-wrap: anywhere; }
.tm-select {
  flex: 0 0 auto; width: auto; min-width: 0; min-height: 40px; padding: 6px 8px 6px 12px;
  font-size: 16px; font-weight: 700; color: var(--primary); text-align: right;
  background-color: var(--surface-sunk);
}
.tm-ride-note { padding: var(--sp-3) var(--sp-4) var(--sp-4); border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-3); overflow-wrap: anywhere; }

/* ---------------- day card ---------------- */
.tm-day {
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-3);
  container: tmday / inline-size;
}
@container tm (min-width: 400px) { .tm-day { padding: var(--sp-4); } }
@container tm (min-width: 560px) { .tm-day { padding: var(--sp-5); } }
.tm-day.is-today { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-1); }

.tm-day-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); min-width: 0; padding: 0 var(--sp-1); }
.tm-day-titles { flex: 1 1 12em; min-width: 0; }
.tm-day-eyebrow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.tm-day-eyebrow .badge { text-transform: none; letter-spacing: 0; }
.tm-day-title { position: relative; font-size: var(--fs-lg); margin-top: 4px; line-height: 1.35; overflow-wrap: anywhere; }
.tm-arrow { color: var(--ink-3); font-weight: 400; }
.tm-day-meta {
  display: flex; flex-wrap: wrap; gap: 4px var(--sp-4);
  margin: -4px 0 0; padding: 0 var(--sp-1); list-style: none;
  font-size: var(--fs-sm); color: var(--ink-2);
}
.tm-day-meta li { position: relative; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tm-day-meta svg { color: var(--ink-3); }
.tm-day-meta .is-sunrise svg { color: var(--sun); }
.tm-day-meta .is-sunset svg { color: var(--indigo); }

/* day weather (daily forecast at the destination) */
.tm-wx {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  flex: 0 0 auto; max-width: 100%;
  min-height: 48px; padding: 6px 12px 6px 8px;
  border: 0; border-radius: var(--r-md);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink); font: inherit;
}
.tm-wx .e3d, .tm-wx .emoji { width: 32px; height: 32px; font-size: 26px; }
.tm-wx-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tm-wx-t { white-space: nowrap; }
.tm-wx-t b { font-size: var(--fs-lg); font-weight: 700; }
.tm-wx-t span { font-size: var(--fs-sm); color: var(--ink-3); font-weight: 400; }
.tm-wx-rain { display: inline-flex; align-items: center; gap: 3px; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-3); }
.tm-wx-rain.is-rainy { color: var(--sky); }
.tm-wx.is-muted {
  min-height: 34px; padding: 6px 12px; gap: 6px;
  border-radius: var(--r-pill); box-shadow: none; background: var(--surface-sunk);
  color: var(--ink-2); font-size: var(--fs-xs); font-weight: 700;
}
.tm-wx.is-muted > span { min-width: 0; overflow-wrap: anywhere; }
.tm-wx.is-btn { min-height: 44px; cursor: pointer; }
.tm-wx.is-btn:active { transform: scale(.97); }
.tm-wx.is-loading { width: 104px; height: 48px; box-shadow: none; }
.tm-wx-tips > div, .tm-wx-tips b { overflow-wrap: anywhere; }
.tm-wx-tips b { font-weight: 700; }

/* depart time — an iOS grouped row */
.tm-depart {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  min-width: 0;
}
.tm-depart-txt { display: flex; align-items: center; gap: var(--sp-3); flex: 1 1 10em; min-width: 0; }
.tm-depart-label { display: block; font-weight: 700; line-height: 1.3; }
.tm-depart-sub { font-size: var(--fs-xs); color: var(--ink-2); overflow-wrap: anywhere; }
.tm-depart-sub b { color: var(--ink); font-weight: 700; }
.tm-depart-ctl { display: flex; align-items: center; gap: 6px; margin-left: auto; min-width: 0; max-width: 100%; }
@container tmday (max-width: 420px) {
  .tm-depart-ctl { flex: 1 1 100%; }
  .tm-dep-input { flex: 1 1 auto; }
}
.tm-depart .tm-nudge {
  width: 44px; min-width: 44px; height: 44px; min-height: 44px; flex: 0 0 auto;
  --btn-bg: var(--surface); --btn-ink: var(--ink-2);
  box-shadow: none;
  font-family: var(--font-num); font-size: var(--fs-sm); font-weight: 700;
}
.tm-tinput {
  width: 8.4em; min-width: 0; min-height: 44px;
  padding: 6px 10px;
  background: var(--surface); border-color: var(--line);
  font-family: var(--font-num); font-weight: 700; text-align: center;
  font-variant-numeric: tabular-nums;
}
.tm-dep-input { font-size: 1.15rem; }

/* ---------------- vertical timeline ---------------- */
.tm-tl {
  --tm-tw: 50px;      /* time column */
  --tm-rw: 34px;      /* rail column */
  --tm-node: 34px;    /* kind tile */
  list-style: none; margin: 0; padding: 0 var(--sp-1) 0 0;
  display: flex; flex-direction: column;
  min-width: 0;
}
@container tmday (min-width: 400px) { .tm-tl { --tm-tw: 58px; --tm-rw: 40px; --tm-node: 40px; } }
.tm-item {
  display: grid;
  grid-template-columns: var(--tm-tw) var(--tm-rw) minmax(0, 1fr);
  column-gap: 10px;
  min-width: 0;
}
.tm-time {
  display: flex; flex-direction: column; align-items: flex-end;
  text-align: right; min-width: 0;
  padding-top: 4px;
}
.tm-clock { font-family: var(--font-num); font-weight: 700; font-size: 1.05rem; line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
@container tmday (min-width: 400px) { .tm-clock { font-size: 1.2rem; } }
.tm-plus { font-size: 0.68rem; font-weight: 700; color: var(--berry); white-space: nowrap; }
.tm-clock-sub { font-size: var(--fs-xs); line-height: 1.3; color: var(--ink-3); overflow-wrap: anywhere; }
.tm-clock-sub .num { display: block; font-family: var(--font-num); color: var(--ink-2); }

.tm-rail { position: relative; display: flex; justify-content: center; align-items: flex-start; }
.tm-rail::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px;
  transform: translateX(-50%);
  background: var(--line-strong); border-radius: 2px;
}
.tm-stop.is-start .tm-rail::before, .tm-tl > .tm-item:first-child .tm-rail::before { top: calc(var(--tm-node) / 2); }
.tm-stop.is-end .tm-rail::before, .tm-tl > .tm-item:last-child .tm-rail::before { bottom: auto; height: calc(var(--tm-node) / 2); }
/* riding = dashed, at a stop = solid */
.tm-leg .tm-rail::before { background: repeating-linear-gradient(to bottom, var(--line-strong) 0 5px, transparent 5px 10px); }
.tm-leg.is-night .tm-rail::before { background: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--grape) 60%, transparent) 0 5px, transparent 5px 10px); }
.tm-rail .ico-tile {
  position: relative; z-index: 1;
  width: var(--tm-node); height: var(--tm-node);
  border-radius: calc(var(--tm-node) * .32);
  box-shadow: 0 0 0 3px var(--surface);
}
.tm-rail .ico-tile svg { width: calc(var(--tm-node) * .5); height: calc(var(--tm-node) * .5); }
.tm-stop.is-late .tm-rail .ico-tile { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--danger); }
.tm-stop.is-hl .tm-rail .ico-tile { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--primary); }

.tm-body { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding-bottom: var(--sp-5); }
.tm-name {
  display: flex; flex-direction: column; align-items: flex-start;
  width: calc(100% + 8px); min-width: 0; min-height: 44px;
  margin: -2px 0 -4px -8px; padding: 2px 8px;
  border: 0; border-radius: var(--r-xs);
  background: transparent; color: inherit; text-align: left;
  transition: background var(--dur);
}
@media (hover: hover) { .tm-name:hover { background: var(--surface-2); } }
.tm-stop.is-hl .tm-name { background: var(--primary-soft); }
.tm-name-txt { font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; max-width: 100%; }
.tm-name-txt .emoji { font-size: .9em; }
.tm-kind { font-size: var(--fs-xs); color: var(--ink-3); }
.tm-stop.is-hl .tm-name-txt { color: var(--primary); }
.tm-badges { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }

/* per-stop controls: a small grouped box */
.tm-ctls {
  display: flex; flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  min-width: 0; max-width: 30rem;
  container: tmctl / inline-size;
}
.tm-ctl {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 6px var(--sp-3);
  min-height: 52px; padding: 6px 6px 6px var(--sp-3);
  min-width: 0;
}
.tm-ctls > * + * { border-top: 1px solid var(--line); }
.tm-ctl-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); }
.tm-ctl-label svg { color: var(--ink-3); }
.tm-ctl-label > span { overflow-wrap: anywhere; }
.tm-stepper { margin-left: auto; flex: 0 0 auto; gap: 2px; background: var(--surface-sunk); }
.tm-stepper button { width: 38px; height: 38px; color: var(--primary); }
.tm-stepper button:active { transform: scale(.92); }
@media (pointer: coarse) { .tm-stepper button { width: 44px; height: 44px; } }
.tm-stepper .val { min-width: 3.8em; display: inline-flex; align-items: baseline; justify-content: center; gap: 3px; white-space: nowrap; }
.tm-stepper .val .num { font-family: var(--font-num); font-size: var(--fs-md); font-weight: 700; }
.tm-stepper .val small { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); }
.tm-arrive-ctl { display: flex; align-items: center; gap: 2px; margin-left: auto; min-width: 0; max-width: 100%; }
.tm-arrive .tm-tinput { width: 8.8em; min-height: 40px; padding: 6px 8px; }
.tm-ab-x { color: var(--ink-3); }
.tm-ab-add {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 6px var(--sp-3);
  border: 0; background: transparent;
  color: var(--primary); font-weight: 700; font-size: var(--fs-sm); text-align: left;
  transition: background var(--dur);
}
.tm-ab-add > span { flex: 1 1 auto; min-width: 0; }
.tm-ab-add .tm-ab-plus { color: var(--ink-3); }
.tm-ab-add:active { background: var(--surface-sunk); }
.tm-ab-add:focus-visible { border-radius: 0; box-shadow: inset var(--focus-ring); }
/* narrow rows: drop the label glyph first, then stack — the stepper / time field become a full-width bar
   (never a lonely control wrapped to the right) */
@container tmctl (max-width: 272px) {
  .tm-ctl-label > svg { display: none; }
}
@container tmctl (max-width: 240px) {
  .tm-ctl { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 6px; padding: 8px var(--sp-2) var(--sp-2) var(--sp-3); }
  .tm-ctl-label { padding-top: 2px; }
  .tm-stepper { margin-left: 0; width: 100%; justify-content: space-between; }
}
@container tmctl (max-width: 320px) {
  .tm-ctl.tm-arrive { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 6px; padding: 8px var(--sp-2) var(--sp-2) var(--sp-3); }
  .tm-arrive .tm-ctl-label { padding-top: 2px; }
  .tm-arrive-ctl { margin-left: 0; width: 100%; }
  .tm-arrive .tm-tinput { flex: 1 1 auto; width: auto; }
}

/* legs */
.tm-leg-body {
  flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  padding: 6px 0 var(--sp-4);
  font-size: var(--fs-sm); color: var(--ink-2);
}
.tm-leg-main { display: inline-flex; align-items: flex-start; gap: 6px; min-width: 0; line-height: 1.5; }
.tm-leg-main > svg { color: var(--ink-3); flex: 0 0 auto; margin-top: calc((1.5em - 16px) / 2); }
.tm-leg-main > span { overflow-wrap: anywhere; min-width: 0; }
.tm-leg-kmh { color: var(--ink-3); }
.tm-nowrap { white-space: nowrap; }
.tm-leg-tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }

/* sunset marker: a thin amber line */
.tm-sun .tm-time { padding-top: 2px; }
.tm-clock-sun { font-size: var(--fs-sm); color: color-mix(in srgb, var(--sun) 72%, var(--ink)); }
.tm-sun-ico {
  position: relative; z-index: 1;
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%;
  background: var(--sun-soft); color: color-mix(in srgb, var(--sun) 80%, var(--ink));
  box-shadow: 0 0 0 3px var(--surface);
}
.tm-sun-body { gap: 2px; padding: 2px 0 var(--sp-4); }
.tm-sun-line { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; font-size: var(--fs-sm); }
.tm-sun-line b { font-weight: 700; color: color-mix(in srgb, var(--sun) 72%, var(--ink)); white-space: nowrap; }
.tm-sun-line::after { content: ""; flex: 1 1 auto; height: 1px; background: color-mix(in srgb, var(--sun) 55%, transparent); }
.tm-sun-msg { font-size: var(--fs-xs); color: var(--ink-2); overflow-wrap: anywhere; }
.tm-sun.is-after .tm-rail::before { display: none; }

/* ---------------- dwell budget + fixes ---------------- */
.tm-budget {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--grad-brand-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 14%, transparent);
  min-width: 0;
}
/* opened from the plan tab's "ดูวิธีแก้ในแท็บเวลา": a short ring so the eye lands on the right card */
.tm-budget.tm-flash { animation: tm-flash 1.6s var(--ease) both; }
@keyframes tm-flash {
  0%, 60% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 40%, transparent); border-color: color-mix(in srgb, var(--primary) 55%, transparent); }
  100% { }
}
@media (prefers-reduced-motion: reduce) { .tm-budget.tm-flash { animation: none; border-color: color-mix(in srgb, var(--primary) 55%, transparent); } }
.tm-budget-head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); min-width: 0; }
.tm-budget-head > .ico-tile { background: var(--surface); }
.tm-budget-titles { flex: 1 1 9em; min-width: 0; }
.tm-budget-cap { font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.tm-budget-cap b { color: var(--ink); font-weight: 700; }
.tm-budget-big { margin-top: 2px; line-height: 1.15; color: var(--ink); overflow-wrap: anywhere; }
.tm-budget-big b { font-family: var(--font-num); font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; }
.tm-budget-big small { font-family: var(--font-body); font-size: var(--fs-md); font-weight: 700; color: var(--ink-2); margin: 0 2px 0 4px; }
.tm-budget-sub { font-size: var(--fs-xs); color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.tm-budget-note { font-size: var(--fs-xs); color: var(--ink-2); }

.tm-bar-wrap { position: relative; padding: 4px 0; }
.tm-bar {
  position: relative; display: flex; height: 10px; overflow: hidden;
  border-radius: var(--r-pill); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.tm-bar > i { display: block; height: 100%; flex: 0 0 auto; }
.tm-bar > i + i { box-shadow: -1px 0 0 var(--surface); }
.tm-bar-target {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--ink); border-radius: 2px;
}
.b-ride { background: var(--primary); }
.b-break { background: var(--sun); }
.b-dwell { background: var(--cyan); }
.b-free { background: color-mix(in srgb, var(--mint) 45%, var(--surface)); }
.tm-bar > .b-over {
  position: absolute; top: 0; bottom: 0; right: 0;
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--danger) 70%, transparent) 0 3px, transparent 3px 6px);
}
.tm-legend { display: flex; flex-wrap: wrap; gap: 4px var(--sp-3); font-size: var(--fs-xs); color: var(--ink-2); }
.tm-legend > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.tm-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.tm-legend i.b-over { background: var(--danger); }
.tm-legend i.b-target { width: 2px; height: 10px; border-radius: 1px; background: var(--ink); }

.tm-verdict-line { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--ink); min-width: 0; }
.tm-verdict-line > svg { margin-top: 3px; color: var(--ink-3); }
.tm-verdict-line > span { min-width: 0; overflow-wrap: anywhere; }
.tm-verdict-line b { font-weight: 700; }
.tm-verdict-line.is-late > svg, .tm-verdict-line.is-late b { color: var(--danger); }
.tm-verdict-line.is-ok > svg, .tm-verdict-line.is-ok b { color: var(--ok); }
.tm-verdict-line.is-sub { color: var(--ink-2); margin-top: calc(-1 * var(--sp-2)); }

.tm-fixes {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-1);
  overflow: hidden; min-width: 0;
}
.tm-fix {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: var(--sp-2) var(--sp-3); padding: var(--sp-3); min-width: 0;
}
.tm-fix + .tm-fix { border-top: 1px solid var(--line); }
.tm-fix-txt { min-width: 0; }
.tm-fix-t { font-size: var(--fs-sm); font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.tm-fix-d { font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.45; margin-top: 2px; overflow-wrap: anywhere; }
.tm-fix-btn { min-width: 60px; min-height: 36px; padding-inline: 16px; }
/* narrow day cards: tighter paddings, the short "ใช้" pill stays trailing (iOS list accessory) */
@container tmday (max-width: 440px) {
  .tm-budget { padding: var(--sp-3); }
  .tm-fix { gap: var(--sp-2) 10px; padding: var(--sp-3) 10px var(--sp-3) var(--sp-3); }
  .tm-fix-btn { min-width: 48px; padding-inline: 12px; }
}
@container tmday (max-width: 300px) {
  .tm-fix > .ico-tile { display: none; }
  .tm-fix { grid-template-columns: minmax(0, 1fr) auto; }
}

/* ---------------- warnings / footer / empty ---------------- */
.tm-warns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.tm-warn > div { overflow-wrap: anywhere; }
.tm-warn.is-info > svg { color: var(--info); }
.tm-warn.is-warn > svg, .tm-wx-tips > svg { color: color-mix(in srgb, var(--sun) 80%, var(--ink)); }
.tm-warn.is-danger > svg { color: var(--danger); }
.tm-wx-note > svg { color: var(--info); }
.callout.warn.tm-wx-note > svg { color: color-mix(in srgb, var(--sun) 80%, var(--ink)); }
.tm-wx-note > div { overflow-wrap: anywhere; }
.tm-wx-retry { display: flex; width: fit-content; margin-top: var(--sp-2); }
.tm-foot { display: flex; align-items: flex-start; justify-content: center; gap: 6px; padding: 0 var(--sp-2); font-size: var(--fs-xs); color: var(--ink-3); text-align: center; }
.tm-foot > svg { margin-top: 2px; }
.tm-foot > span { min-width: 0; overflow-wrap: anywhere; max-width: 46em; }
.tm-empty .btn { margin-top: var(--sp-3); }
.tm-empty p { max-width: 28em; }

/* ---------------- weather chip (hourly, at our ETA) ----------------
   Rendered by weatherChipHTML() in js/features/planner/weather.js — used by the time tab, the plan tab and
   the place page, so it lives here (time.css is linked app-wide). [3D icon] 31° · ฝน… · 💧40% */
.tm-wxchip {
  display: inline-flex; align-items: center; gap: 4px;
  min-width: 0; max-width: 100%;
  min-height: 26px; padding: 2px 10px 2px 5px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk); color: var(--ink);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.4;
  white-space: nowrap; vertical-align: middle;
}
.tm-wxchip > .e3d, .tm-wxchip > .emoji { width: 18px; height: 18px; font-size: 15px; vertical-align: 0; }
.tm-wxchip > span { flex: 0 0 auto; }
.tm-wxchip-t { font-family: var(--font-num); font-weight: 700; }
.tm-wxchip > .tm-wxchip-txt { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 400; color: var(--ink-2); }
.tm-wxchip-dot { color: var(--ink-3); font-weight: 400; }
.tm-wxchip-p { display: inline-flex; align-items: center; gap: 2px; color: var(--sky); font-weight: 700; }
.tm-wxchip-p .num { font-family: var(--font-num); }
.tm-wxchip.is-wet, .tm-wxchip.is-storm { background: var(--sky-soft); }
.tm-wxchip.is-storm .tm-wxchip-txt { color: var(--ink); }
.tm-wxchip.is-skel { width: 64px; height: 26px; padding: 0; }
.tm-badges .tm-wxchip { min-height: 26px; }

/* ---------------- big weather display + hourly row (weatherHeroHTML / weatherHoursHTML) ---------------- */
.tm-wxbig { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; color: var(--ink); }
.tm-wxbig-main { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-width: 0; }
.tm-wxbig-txt { flex: 1 1 auto; min-width: 0; }
.tm-wxbig-title { font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.tm-wxbig-temp { font-family: var(--font-num); font-weight: 400; font-size: clamp(3rem, 2.4rem + 3vw, 4.25rem); line-height: 1; letter-spacing: -0.04em; margin: 4px 0 6px; }
.tm-wxbig-cond { font-size: var(--fs-md); font-weight: 400; color: var(--ink-2); overflow-wrap: anywhere; }
.tm-wxbig-ico { flex: 0 0 auto; filter: drop-shadow(0 10px 18px color-mix(in srgb, var(--primary) 22%, transparent)); }
.tm-wxbig-meta { display: flex; flex-wrap: wrap; gap: 6px var(--sp-4); font-size: var(--fs-sm); color: var(--ink-2); }
.tm-wxbig-m { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tm-wxbig-m svg { color: var(--ink-3); }
.tm-wxbig-m b { color: var(--ink); font-weight: 700; }
.tm-wxbig-m.is-rainy svg, .tm-wxbig-m.is-rainy b { color: var(--sky); }

.tm-wxhours {
  display: flex; gap: var(--sp-2); margin: 0; padding: 2px 0 4px; list-style: none;
  overflow-x: auto; scrollbar-width: none; min-width: 0;
}
.tm-wxhours::-webkit-scrollbar { display: none; }
.tm-wxhour {
  flex: 0 0 auto; width: 62px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: var(--sp-3) 4px var(--sp-2);
  border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line);
}
.tm-wxhour.is-now { background: var(--grad-brand); border-color: transparent; color: var(--ink-inverse); box-shadow: var(--shadow-btn); }
.tm-wxhour-t { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.tm-wxhour.is-now .tm-wxhour-t, .tm-wxhour.is-now .tm-wxhour-p { color: inherit; opacity: .9; }
.tm-wxhour .e3d, .tm-wxhour .emoji { width: 30px; height: 30px; font-size: 24px; }
.tm-wxhour-v { font-family: var(--font-num); font-size: var(--fs-md); font-weight: 700; }
.tm-wxhour-p { min-height: 1.2em; font-size: 0.7rem; font-weight: 700; color: var(--sky); }
