/* ============================================================================
   Components of the design review, and the layouts for phone and tablet.
   ----------------------------------------------------------------------------
   Loads after app.css and board.css. Part 1 is component styling that applies at
   every width; part 2 is the responsive layout: phone (< 600px), tablet
   (600–1023px) and, above that, the desktop layout as it was.

   Never an inline style: the CSP drops style="" attributes.
   ========================================================================== */

/* ============================== 1 · COMPONENTS ============================== */

/* A bare 1fr (and a grid with no template at all) cannot shrink below the widest unbreakable thing
   inside it — a nested table, say — so the whole page grew past a tablet's width and clipped. */
.split, .stack { grid-template-columns: minmax(0, 1fr); }
.split > *, .stack > * { min-width: 0; }

/* the primary action sits at the end of the form */
.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--sp-5);
  margin-top: var(--sp-7);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border-soft);
}

/* lat / lon / radius are one idea */
.field-group {
  grid-column: 1 / -1;
  margin: 0;
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.field-group__legend {
  padding: 0 var(--sp-3);
  color: var(--text-muted);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
}
.field-group .field-grid { margin-top: var(--sp-4); }
.field-group > .btn { margin-top: var(--sp-5); }

.pill-note {
  display: inline-block;
  padding: 1px 9px;
  border-radius: var(--r-pill);
  background: var(--info-bg);
  color: var(--info-dark);
  font-size: var(--fs-sm);
}

/* segmented control — sections of a service, parts of an exchange, groups of findings */
.seg {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.seg__btn {
  padding: 7px 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  cursor: pointer;
}
.seg__btn:active { background: var(--surface-3, var(--surface-2)); }
.seg__btn.is-on { background: var(--surface-0); color: var(--text); font-weight: var(--fw-semibold); box-shadow: var(--shadow-sm); }
.seg__btn span { margin-left: 4px; color: var(--text-dim); font-weight: var(--fw-regular); font-variant-numeric: tabular-nums; }

/* a service's sections: tabs only on a phone */
.detail-seg { display: none; }
.only-narrow { display: none; }

/* the console's exchange */
.otab { display: none; }
.otab.is-on { display: block; }

/* the services table: numbers never wrap, text truncates */
.table td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.trunc { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the Departures tab counts must not push a label onto a second line */
.board-tabs .tabs__tab { white-space: nowrap; }

/* a day stepper: ‹ Wed 14 Oct › */
.daystep { display: inline-flex; align-items: center; gap: var(--sp-3); }
.daystep__label { min-width: 118px; font-variant-numeric: tabular-nums; }
.daystep__arrow { min-width: 34px; }

/* ---- a route as a timeline ---- */
.tl { padding: 4px 0; }
.tl .s {
  position: relative;
  display: grid;
  grid-template-columns: 54px 18px minmax(0, 1fr) auto;
  gap: 0 8px;
  min-height: 40px;
  align-items: start;
}
.tl .tm {
  padding-top: 9px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.tl .tm small { display: block; color: var(--text-dim); font-size: 11.5px; }
.tl .ln { position: relative; align-self: stretch; }
.tl .ln::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.tl .s:first-child .ln::before { top: 16px; }
.tl .s:last-child .ln::before { bottom: calc(100% - 16px); }
.tl .ln::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 11px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface-0);
  border: 2px solid var(--text-muted);
}
.tl .s.here .ln::after { background: var(--ht-gold-400); border-color: var(--ht-gold-600); }
.tl .nm { padding-top: 8px; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.tl .nm small { display: block; color: var(--text-dim); font-family: var(--font-mono); font-size: 11.5px; }
.tl .pf { padding-top: 8px; color: var(--text-muted); font-size: 13px; font-weight: var(--fw-semibold); }
.tl .s.here .nm { font-weight: 650; }
.tl .s.is-dim .nm, .tl .s.is-dim .tm { color: var(--text-dim); }
.tl .s.is-past { opacity: .55; }

/* ---- findings: a card each ---- */
.fsection { display: none; }
.fsection.is-on { display: block; }
.fsection__title { margin: var(--sp-7) 0 var(--sp-5); font-size: var(--fs-title); font-weight: var(--fw-semibold); }
.fsection__title small { margin-left: var(--sp-4); color: var(--text-dim); font-weight: var(--fw-regular); font-size: var(--fs-base); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: var(--sp-6); }
.fd {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
  padding: var(--sp-6) var(--sp-7);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  background: var(--surface-0);
}
.fd__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-5); }
.fd__title { margin: 0; font-size: var(--fs-title); font-weight: var(--fw-semibold); line-height: 1.35; }
.fd__head .badge { flex: none; }
.fd__text { margin: 0; color: var(--text-muted); font-size: var(--fs-lg); line-height: var(--lh-base); }
.fd code { padding: 1px 5px; border-radius: var(--r-sm); background: var(--surface-2); font-family: var(--font-mono); font-size: .92em; }
.ev { display: grid; gap: 2px; padding: var(--sp-4) var(--sp-5); border-radius: var(--r-md); background: var(--surface-2); font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.6; }
.ev__line { display: flex; flex-wrap: wrap; column-gap: var(--sp-5); }
.ev__q { overflow-wrap: anywhere; }
.ev__r::before { content: "→ "; color: var(--text-dim); }
.ev--ok { color: var(--ok-dark); }
.ev--no { color: var(--err-dark); }

/* ============================ 2 · THE BOARD LOOK ============================ */

/* our own board: dark olive and gold, high contrast. The DB look keeps its navy. */
.is-board .dbboard { background: #16180f; color: #f1f1e6; font-family: var(--font-sans); }
.is-board .db-station { color: #a6a993; opacity: 1; }
.is-board .db-title { font-size: 40px; }
.is-board .db-filters { background: #242719; }
.is-board .db-cat { color: #e6e8dd; border-color: #3a3d2e; }
.is-board .db-cat.is-active { background: #f1f1e6; border-color: #f1f1e6; color: #16180f; }
.is-board .db-filters .cat-dot { border-color: rgba(255, 255, 255, .55); }
.is-board .db-ctl, .is-board .dd-btn, .is-board .db-switch, .is-board .db-more { border-color: #3a3d2e; color: #f1f1e6; }
.is-board .db-ctl:hover, .is-board .dd-btn:hover, .is-board .db-switch:hover, .is-board .db-more:hover { background: #242719; }
.is-board .db-input { border-color: #3a3d2e; background: #242719; }
.is-board .db-cols { border-bottom-color: #2e3122; color: #8e9180; opacity: 1; }
.is-board .db-note { color: #a6a993; opacity: 1; }
.is-board .db-route { background: #242719; }
.is-board .board-wait, .is-board .field__hint { color: #a6a993; }
.is-board .db-row { border-bottom-color: #2e3122; }

.bd-list-reset { list-style: none; }
.bd-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 14px;
  padding: 16px 0;
  border-bottom: 1px solid #2e3122;
  cursor: pointer;
}
.bd-row:hover { background: rgba(255, 255, 255, .03); }
.bd-row:focus-visible { outline: 2px solid #f5a800; outline-offset: 2px; }
.bd-t { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.bd-time { font-size: 32px; font-weight: 700; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.bd-time .board-live { margin-left: 8px; padding: 1px 6px; border-radius: 4px; background: #f5a800; color: #16180f; font-size: 18px; }
.bd-chip { padding: 3px 8px; border-radius: 5px; background: #8e9180; color: #16180f; font-size: 12.5px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.bd-chip--long { background: #f5a800; }
.bd-chip--regional { background: #3bb07a; }
.bd-chip--suburban { background: #1d7a45; color: #fff; }
.bd-chip--bus { background: #c64a8a; color: #fff; }
.bd-chip--ship { background: #3a7bd5; color: #fff; }
.bd-to { margin-top: 2px; font-size: 22px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.bd-via {
  color: #a6a993;
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bd-pf { grid-row: 1; grid-column: 2; align-self: center; min-width: 58px; padding-left: 14px; border-left: 1px solid #2e3122; text-align: center; }
.bd-pf small { display: block; color: #8e9180; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.bd-pf b { font-size: 34px; font-weight: 800; line-height: 1.1; }
.bd-row .db-route { grid-column: 1 / -1; }

/* the stepper's buttons on a dark page */
.dd-btn {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.dd-btn:hover { background: rgba(255, 255, 255, .14); }
.dd-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* a timeline on a dark page */
.dbboard .tl .tm, .dbboard .tl .nm, .dbboard .tl .pf { color: #f1f1e6; }
.dbboard .tl .tm small, .dbboard .tl .nm small, .dbboard .tl .pf { color: rgba(255, 255, 255, .65); }
.dbboard .tl .ln::before { background: rgba(255, 255, 255, .28); }
.dbboard .tl .ln::after { background: #16180f; border-color: rgba(255, 255, 255, .7); }
.is-db .dbboard .tl .ln::after { background: #1c1f4a; }
.dbboard .tl .s.here .ln::after { background: #f5a800; border-color: #f5a800; }
.dbboard .tl .s.is-dim .nm, .dbboard .tl .s.is-dim .tm { color: rgba(255, 255, 255, .5); }
.dbboard .tl .nm { font-size: 15px; }
.dbboard .tl .tm { font-size: 14px; }

/* ======================= 3 · PHONE AND TABLET: SHARED PIECES ================= */
/* Hidden by default; the media queries below turn on the ones a width needs. */

:root { --tabbar-h: 56px; }

.tabbar, .sheetbar, .formsheet__head, .topbar__refresh { display: none; }
.sheet[hidden], .sheet-dim[hidden] { display: none; }

/* a sheet: the "More" one and the form ones share it */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 130;
  display: flex;
  flex-direction: column;
  max-height: 88dvh;
  border-radius: 22px 22px 0 0;
  background: var(--surface-1);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .16);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-dim { position: fixed; inset: 0; z-index: 120; background: rgba(20, 22, 15, .38); }
.sheet__grab { width: 38px; height: 5px; margin: 8px auto 4px; border-radius: 3px; background: var(--border); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 16px 10px; }
.sheet__head b { font-size: 19px; }
.sheet__close { min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: var(--ht-gold-600); font: inherit; font-size: 16px; font-weight: 500; cursor: pointer; }
.sheet__body { padding: 0 16px 16px; overflow-y: auto; overscroll-behavior: contain; }

.more__group { margin-bottom: 12px; border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface-0); overflow: hidden; }
.more__title { margin: 14px 4px 6px; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.more__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 14px;
  border: 0;
  border-top: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  text-align: left;
  text-decoration: none;
}
.more__row:first-child { border-top: 0; }
.more__row small { min-width: 0; overflow: hidden; color: var(--text-dim); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
button.more__row:active, a.more__row:active { background: var(--surface-2); }
.more__signout { color: var(--err-dark); }

/* a screen pushed over a list */
.pushbar { display: flex; align-items: center; gap: 8px; }
.pushbar__back { display: flex; align-items: center; gap: 2px; border: 0; background: transparent; color: var(--ht-gold-600); font: inherit; font-size: 17px; font-weight: 500; cursor: pointer; }
.pushbar__title { flex: 1; min-width: 0; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
#detail:not(.is-pushed) .pushbar { display: none; }

.offline-banner { margin-bottom: var(--sp-5); }
.is-sheet-open { overflow: hidden; }

/* ============================ 4 · TABLET: 600–1023 ========================== */

@media (min-width: 600px) and (max-width: 1023px) {
  /* an icon rail instead of the drawer the design system turns the sidebar into */
  .app { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { position: static; width: 72px; transform: none; box-shadow: none; }
  .sidebar__brand { justify-content: center; padding: var(--sp-5) 0; }
  .sidebar__brand-text, .nav-section-title, .sidebar__foot { display: none; }
  .nav-item { justify-content: center; gap: 0; min-height: 48px; padding: 12px 0; font-size: 0; }
  .nav-item__icon { width: 22px; height: 22px; }
  .topbar__burger { display: none; }
  .view__head, .view__body { padding-left: var(--sp-8); padding-right: var(--sp-8); }
}

/* ================================ 5 · PHONE: < 600 =========================== */

@media (max-width: 599px) {
  html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
  body { overflow-x: hidden; }

  /* the shell: 100dvh (Safari's toolbar moves 100vh), one scroller, no sidebar */
  .app { height: 100dvh; grid-template-columns: minmax(0, 1fr); }
  .sidebar, .topbar__burger { display: none; }
  .main { min-width: 0; }
  .topbar {
    padding: max(var(--sp-4), env(safe-area-inset-top)) var(--sp-6) var(--sp-4);
    min-height: 0;
    background: var(--surface-1);
    border-bottom: 0;
  }
  .topbar__refresh { display: grid; }
  .view__head { padding: 2px var(--sp-7) var(--sp-5); border-bottom: 0; }
  .view__title { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
  .view__body {
    padding: 0 var(--sp-7) calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
  }

  /* the bottom tab bar */
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-bottom-nav);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 4px env(safe-area-inset-bottom);
    border-top: 1px solid var(--border-soft);
    background: rgba(250, 250, 246, .94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
  .tabbar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 10.5px;
    font-weight: 500;
  }
  .tabbar__item svg { width: 22px; height: 22px; }
  .tabbar__item.is-active { color: var(--text); }
  .tabbar__item.is-active svg { color: var(--ht-gold-600); }
  .tabbar__item:active { opacity: .6; }
  .app.is-board-db .tabbar { display: none; }              /* a board takes the whole screen */
  .cmpbar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); }

  /* touch: 44px targets, 48px fields at 17px so iOS does not zoom on focus */
  .field-grid { grid-template-columns: 1fr; }
  .field__input, select.field__input { min-height: 48px; padding: 0 14px; border-radius: 12px; font-size: 17px; }
  .field__input--sm { padding: 0 14px; font-size: 17px; }
  .field__label { font-size: 13px; letter-spacing: 0; text-transform: none; font-weight: 600; }
  .field__hint { font-size: 12.5px; }
  .btn { min-height: 44px; font-size: 15px; border-radius: 12px; }
  .btn--sm { min-height: 44px; padding: 0 14px; font-size: 15px; }
  .btn--primary { min-height: 50px; font-size: 17px; border-radius: 14px; }
  .chip { min-height: 36px; padding: 0 13px; font-size: 14px; }
  .idbtn { min-height: 32px; padding: 0 10px; }
  .copyval { padding: 2px 0; }
  .btn:active, .chip:active, .idbtn:active, .nav-item:active, .seg__btn:active { opacity: .65; }
  .tabs__tab, .seg__btn { min-height: 40px; }

  .kpis { grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
  #refresh { display: none; }                              /* the top bar has the refresh icon */
  .card__body { padding: var(--sp-6) var(--sp-7); }
  .scroll-x { margin: 0 calc(var(--sp-7) * -1); padding: 0 var(--sp-7); }
  .scroll-x > .payload__copy { display: none; }

  /* a form becomes a sheet, behind a bar that says what is filtered */
  .sheetbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: block;
    margin: 0 calc(var(--sp-7) * -1) var(--sp-5);
    padding: 8px var(--sp-7);
    background: var(--surface-1);
  }
  .sheetbar__open {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 0 12px 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-0);
    color: var(--text);
    font: inherit;
    font-size: 16px;
  }
  .sheetbar__label { font-weight: 600; }
  .sheetbar__chips { display: flex; flex: 1; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
  .sheetbar__chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--ht-gold-100); font-size: 13px; }
  .sheetbar__chip button { width: 24px; height: 24px; border: 0; background: transparent; color: var(--text-muted); font-size: 16px; line-height: 1; }
  .sheetbar__none { color: var(--text-dim); font-size: 14px; }
  .sheetbar__chev { flex: none; color: var(--text-muted); }

  [data-sheet] {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 130;
    max-height: 88dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 var(--sp-7) env(safe-area-inset-bottom);
    border-radius: 22px 22px 0 0;
    background: var(--surface-1);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .16);
    transform: translateY(110%);
    transition: transform .25s var(--ease);
  }
  [data-sheet].is-open { transform: none; }
  /* overflow: visible — the design system's card clips, and a sticky footer cannot stick past a clipping ancestor */
  [data-sheet] > .card { overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  [data-sheet] > .card > .card__head { display: none; }
  [data-sheet] > .card > .card__body { padding: 0; }
  .formsheet__head { position: sticky; top: 0; z-index: 3; display: block; margin: 0 calc(var(--sp-7) * -1); padding: 0 var(--sp-7); background: var(--surface-1); }
  [data-sheet] .form-actions {
    position: sticky;
    bottom: 0;
    margin: var(--sp-7) calc(var(--sp-7) * -1) 0;
    padding: 12px var(--sp-7) calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-soft);
    background: var(--surface-1);
  }
  [data-sheet] .form-actions .btn--primary { flex: 1; }
  [data-sheet] .field-group { padding: var(--sp-5); }

  /* a form that is not in a sheet (the console): its primary action rides above the tab bar */
  .form-actions {
    position: sticky;
    /* 0, not the tab bar's height: the scroller's own padding-bottom already reserves that space,
       and sticky measures from inside that padding — adding it again floated the bar 78px too high */
    bottom: 0;
    z-index: 4;
    margin-left: calc(var(--sp-7) * -1);
    margin-right: calc(var(--sp-7) * -1);
    padding: 12px var(--sp-7);
    background: var(--surface-1);
  }
  .form-actions .btn--primary { flex: 1; }
  [data-sheet] .form-actions { bottom: 0; }
  /* the design system's card clips, and a sticky child cannot stick past a clipping ancestor */
  .card:has(.form-actions) { overflow: visible; }

  /* the day stepper takes the width it needs and no more */
  .daystep { flex-wrap: wrap; }
  .board-bar { gap: var(--sp-4); }
  .board-tabs { width: 100%; min-width: 0; }
  /* flex: 1 in board.css gives a basis of 0, which beats width:100% — say 100% as the basis, so From and the
     search box take a line of their own instead of running off the screen after the day stepper */
  .board-find { flex: 1 1 100%; min-width: 0; }
  .board-filters, .db-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .board-filters::-webkit-scrollbar, .db-filters::-webkit-scrollbar { display: none; }
  .board-filters .chip, .db-cat { flex: none; }
  .board-sub { font-size: 13px; }

  /* tables the views opted into become cards; each cell names its column */
  .table--cards { display: block; }
  .table--cards thead { display: none; }
  .table--cards tbody { display: block; }
  .table--cards tbody tr {
    display: block;
    margin: 0 0 10px;
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface-0);
  }
  .table--zebra.table--cards tbody tr:nth-child(even) > td { background: transparent; }
  .table--cards td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    max-width: none;
    padding: 4px 0;
    border: 0;
    background: transparent;
    text-align: right;
    white-space: normal;
  }
  .table--cards td::before { content: attr(data-label); flex: none; color: var(--text-muted); font-size: 12.5px; text-align: left; }
  .table--cards td:empty { display: none; }
  .table--cards td.trunc { overflow: visible; text-overflow: clip; }

  /* a service result: number and id, times and places, who runs it */
  #results .table--cards tbody tr {
    display: grid;
    grid-template-columns: 32px 52px minmax(0, 1fr) auto;
    grid-template-areas: "chk num num id" "chk dep from days" "chk arr to mode" "chk prov prov prov" "chk brand brand brand";
    gap: 2px 8px;
    align-items: center;
  }
  #results .table--cards td { display: block; min-width: 0; padding: 0; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
  #results .table--cards td::before { content: none; }
  #results .table--cards td:first-child { grid-area: chk; }
  #results .table--cards td[data-col="number"] { grid-area: num; font-size: 17px; font-weight: 700; }
  #results .table--cards td[data-col="id"] { grid-area: id; text-align: right; }
  #results .table--cards td[data-col="dep"] { grid-area: dep; font-weight: 600; }
  #results .table--cards td[data-col="from"] { grid-area: from; }
  #results .table--cards td[data-col="arr"] { grid-area: arr; font-weight: 600; }
  #results .table--cards td[data-col="to"] { grid-area: to; }
  #results .table--cards td[data-col="days"] { grid-area: days; color: var(--text-muted); font-size: 13px; text-align: right; }
  #results .table--cards td[data-col="mode"] { grid-area: mode; color: var(--text-muted); font-size: 13px; text-align: right; }
  #results .table--cards td[data-col="mode"]::before { content: "mode "; }
  #results .table--cards td[data-col="provider"] { grid-area: prov; color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }
  #results .table--cards td[data-col="brand"] { grid-area: brand; color: var(--text-muted); font-size: 13.5px; }

  /* places: the long, rarely needed columns are not worth a line each */
  #locResults td[data-label="time zone"], #locResults td[data-label="short name"], #locResults td[data-label="period"] { display: none; }

  /* a departure on the standard board: time, destination and via, platform */
  .board-table.table--cards tbody tr.board-row {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    grid-template-areas: "time dest plat" "time train plat" "time oper plat";
    gap: 2px 10px;
    align-items: start;
  }
  .board-table.table--cards td { display: block; padding: 0; text-align: left; }
  .board-table.table--cards td::before { content: none; }
  .board-table.table--cards td:nth-child(1) { grid-area: time; font-size: 17px; }
  .board-table.table--cards td:nth-child(2) { grid-area: train; color: var(--text-muted); font-size: 13px; }
  .board-table.table--cards td:nth-child(3) { grid-area: dest; font-size: 16px; font-weight: 600; line-height: 1.25; }
  .board-table.table--cards td:nth-child(4) { grid-area: plat; min-width: 44px; align-self: center; text-align: center; font-size: 22px; font-weight: 700; }
  .board-table.table--cards td:nth-child(4)::before { content: "Platform"; display: block; color: var(--text-dim); font-size: 9.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
  .board-table.table--cards td:nth-child(5) { grid-area: oper; color: var(--text-dim); font-size: 12.5px; }
  .board-via { overflow: hidden; font-size: 13px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
  .board-table.table--cards tbody tr.board-route-row { display: block; padding: 6px 10px; }
  .board-table.table--cards tbody tr.board-route-row td { display: block; padding: 0; }

  /* a pushed screen covers the list, with its own back button */
  #detail.is-pushed, #locOne.is-pushed {
    position: fixed;
    inset: 0 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom)) 0;
    z-index: 110;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0 var(--sp-7) 24px;
    background: var(--surface-1);
  }
  .is-pushed .pushbar {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: 0 calc(var(--sp-7) * -1) 8px;
    padding: env(safe-area-inset-top) var(--sp-7) 0 var(--sp-4);
    min-height: calc(52px + env(safe-area-inset-top));
    background: rgba(250, 250, 246, .94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-soft);
  }
  .is-pushed .pushbar__back { min-height: 44px; padding: 0 6px 0 0; }
  .is-pushed .pushbar__title { padding-right: 64px; font-size: 16px; font-weight: 600; }
  .is-pushed > .stack { margin-top: 0; }

  /* a service's sections, one at a time */
  .detail-seg { position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 3; display: grid; width: 100%; margin-bottom: var(--sp-5); }
  .seg-pane { display: none; }
  .seg-pane.is-on { display: block; }
  .only-wide { display: none; }
  .only-narrow { display: block; }
  .out-seg, .findings-seg { display: flex; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .out-seg .seg__btn, .findings-seg .seg__btn { flex: 1 0 auto; }
  .fgrid { grid-template-columns: 1fr; }
  .ev__line { display: block; }

  /* boards: the dark looks fill the screen */
  .dbboard__inner { padding: calc(12px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); }
  .db-top { flex-wrap: wrap; gap: 8px; padding-bottom: 18px; }
  .db-title { font-size: 32px; }
  .db-controls { gap: 10px 12px; }
  .db-controls .board-find { flex: 1 1 100%; min-width: 0; }
  .is-board .db-top [data-mode="db"] { display: none; }    /* the DB look stays a desktop option; the review advised against it */
  .db-input, .dd-btn, .db-ctl, .db-switch { min-height: 44px; font-size: 16px; }
  .db-input { padding: 0 12px; }
  .bd-time { font-size: 28px; }
  .bd-to { font-size: 20px; }
  .bd-pf { min-width: 52px; padding-left: 10px; }
  .bd-pf b { font-size: 30px; }
  .dbboard .tl .s { grid-template-columns: 50px 18px minmax(0, 1fr) auto; }
}

@media print { .tabbar, .sheetbar, .sheet, .sheet-dim { display: none !important; } }
