/* HaulTalk design tokens (Design Spec Part D / F1). Single shared source for the map page (lib/roadview.js)
   and the app screens (od*.js). Components use ONLY the --ht-* semantic tokens below, never raw hex.
   Day = :root. Night = html[data-theme=night] | body.night | [data-ht-theme=night]
   | (html[data-theme=auto] + OS dark). Text size: html[data-textsize=l|xl] = 115% | 130% (D14).
   Display size (whole app): html[data-disp=l|xl] + --ht-z (D14b). Tablet layout (>= 744px wide): D16 at the end.
   Icons: Lucide (ISC). Fonts: system first (no runtime web-font loading). */
:root{
  /* D6.1 raw brand palette (do not use in components) */
  --ht-navy-950:#060B16;--ht-navy-900:#0B1220;--ht-navy-850:#0F1829;--ht-navy-800:#131C2E;--ht-navy-700:#1B2640;
  --ht-navy-600:#26324A;--ht-navy-500:#3A4766;--ht-slate-400:#7C8AA3;--ht-slate-300:#A3AFC2;--ht-slate-600:#4A5568;
  --ht-gray-50:#F4F6FA;--ht-white:#FFFFFF;--ht-ink:#0E1626;
  --ht-amber-300:#FFD36B;--ht-amber-500:#FFB020;--ht-amber-600:#E08A00;--ht-amber-800:#9A5B00;--ht-amber-ink:#1A1200;
  --ht-red-600:#C62A20;--ht-red-300:#FF6B61;--ht-green-700:#0E7A4A;--ht-green-300:#3DD68C;--ht-blue-600:#2B5BD7;--ht-blue-300:#7EA2FF;

  /* D6.2 semantic tokens: DAY */
  --ht-bg:#FFFFFF;
  --ht-surface-1:#FFFFFF;
  --ht-surface-2:#F4F6FA;
  --ht-surface-glass:rgba(255,255,255,.88);
  --ht-line:#E2E6EE;
  --ht-text-1:#0E1626;
  --ht-text-2:#4A5568;
  --ht-text-3:#6B7588;
  --ht-primary:#FFB020;
  --ht-on-primary:#1A1200;
  --ht-primary-text:#9A5B00;
  --ht-primary-tint:rgba(255,176,32,.16);
  --ht-danger:#C62A20;
  --ht-on-danger:#FFFFFF;
  --ht-danger-text:#C62A20;
  --ht-danger-tint:rgba(198,42,32,.10);
  --ht-success:#0E7A4A;
  --ht-on-success:#FFFFFF;
  --ht-success-text:#0E7A4A;
  --ht-success-tint:rgba(14,122,74,.10);
  --ht-caution:#E08A00;
  --ht-caution-tint:rgba(224,138,0,.12);
  --ht-info-text:#2B5BD7;
  --ht-info-tint:rgba(43,91,215,.10);
  --ht-route:#2F6BFF;
  --ht-route-casing:#FFFFFF;
  --ht-route-alt:#9AA6B8;
  --ht-scrim:rgba(6,11,22,.40);
  --ht-focus:#FFB020;
  --ht-poi-parking:#2B5BD7;--ht-poi-fuel:#1B2640;--ht-poi-slate:#4A5568;--ht-on-poi:#FFFFFF;

  /* D7 elevation */
  --ht-e0:none;
  --ht-e1:0 1px 2px rgba(14,22,38,.18),0 2px 8px rgba(14,22,38,.10);
  --ht-e2:0 2px 4px rgba(14,22,38,.12),0 8px 24px rgba(14,22,38,.14);
  --ht-e3:0 -2px 16px rgba(14,22,38,.12);
  --ht-edge-1:0 0 0 0 transparent;  /* night adds a hairline */
  --ht-edge-2:0 0 0 0 transparent;
  --ht-glass-blur:blur(20px) saturate(1.4);

  /* D3 fonts */
  --ht-font-ui:system-ui,-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,"Noto Sans","Helvetica Neue",Arial,sans-serif;
  --ht-font-fa:"Vazirmatn","SF Arabic","Noto Sans Arabic","Noto Naskh Arabic","Geeza Pro",Tahoma,sans-serif;
  --ht-font-pa:"Noto Sans Gurmukhi","Gurmukhi Sangam MN","Mukta Mahee",sans-serif;
  --ht-font-num:var(--ht-font-ui);
  --ht-font:var(--ht-font-ui);
  --ht-lh-mult:1;

  /* D2 type scale (rem; root 16px -> scales with html font-size for D14) */
  --ht-fs-nav-hero:2.75rem;  --ht-lh-nav-hero:3rem;      /* 44/48 */
  --ht-fs-display:2.125rem;  --ht-lh-display:2.5625rem;  /* 34/41 */
  --ht-fs-title1:1.75rem;    --ht-lh-title1:2.125rem;    /* 28/34 */
  --ht-fs-title2:1.375rem;   --ht-lh-title2:1.75rem;     /* 22/28 */
  --ht-fs-title3:1.25rem;    --ht-lh-title3:1.5625rem;   /* 20/25 (min while moving) */
  --ht-fs-headline:1.0625rem;--ht-lh-headline:1.375rem;  /* 17/22 */
  --ht-fs-body:1.0625rem;    --ht-lh-body:1.5rem;        /* 17/24 */
  --ht-fs-callout:1rem;      --ht-lh-callout:1.3125rem;  /* 16/21 */
  --ht-fs-subhead:.9375rem;  --ht-lh-subhead:1.25rem;    /* 15/20 */
  --ht-fs-footnote:.8125rem; --ht-lh-footnote:1.125rem;  /* 13/18 absolute minimum */
  --ht-fs-drive-min:1.25rem; /* 20: min text while driving */

  /* D4 spacing */
  --ht-space-1:4px;--ht-space-2:8px;--ht-space-3:12px;--ht-space-4:16px;--ht-space-5:20px;--ht-space-6:24px;
  --ht-space-8:32px;--ht-space-10:40px;--ht-space-12:48px;--ht-space-16:64px;
  --ht-gutter:16px;

  /* D5 radii */
  --ht-radius-s:8px;--ht-radius-m:12px;--ht-radius-l:16px;--ht-radius-xl:24px;--ht-radius-full:9999px;

  /* D9 control sizes */
  --ht-hit-min:48px;--ht-btn-h:56px;--ht-btn-h-s:48px;--ht-map-btn:56px;--ht-talk:64px;--ht-end-w:64px;
  --ht-ptt:160px;--ht-chip-h:40px;--ht-row-h:56px;--ht-row-h-2:72px;--ht-tile-h:96px;--ht-tabbar-h:56px;
  --ht-icon-chip:20px;--ht-icon:24px;--ht-icon-map:28px;--ht-icon-grid:32px;--ht-icon-tile:40px;

  /* D10 motion */
  --ht-ease-standard:cubic-bezier(.2,0,0,1);
  --ht-ease-decel:cubic-bezier(.05,.7,.1,1);
  --ht-ease-accel:cubic-bezier(.3,0,1,1);
  --ht-ease-emph:cubic-bezier(.2,0,0,1);
  --ht-ease-sheet:cubic-bezier(.32,.72,0,1);
  --ht-motion-press:100ms;--ht-motion-quick:150ms;--ht-motion-base:250ms;--ht-motion-sheet:350ms;
  --ht-motion-screen:300ms;--ht-motion-exit:200ms;--ht-motion-camera:600ms;

  color-scheme:light;
}

/* D6.2 NIGHT (default in cab) */
html[data-theme=night],body.night,[data-ht-theme=night]{
  --ht-bg:#0B1220;
  --ht-surface-1:#131C2E;
  --ht-surface-2:#1B2640;
  --ht-surface-glass:rgba(19,28,46,.88);
  --ht-line:#26324A;
  --ht-text-1:#EEF2F8;
  --ht-text-2:#A3AFC2;
  --ht-text-3:#7C8AA3;
  --ht-primary:#FFB020;
  --ht-on-primary:#1A1200;
  --ht-primary-text:#FFB020;
  --ht-primary-tint:rgba(255,176,32,.14);
  --ht-danger:#C62A20;
  --ht-on-danger:#FFFFFF;
  --ht-danger-text:#FF6B61;
  --ht-danger-tint:rgba(255,107,97,.14);
  --ht-success:#0E7A4A;
  --ht-on-success:#FFFFFF;
  --ht-success-text:#3DD68C;
  --ht-success-tint:rgba(61,214,140,.12);
  --ht-caution:#FFD36B;
  --ht-caution-tint:rgba(255,211,107,.14);
  --ht-info-text:#7EA2FF;
  --ht-info-tint:rgba(126,162,255,.14);
  --ht-route:#5C8CFF;
  --ht-route-casing:#0B1220;
  --ht-route-alt:#56627A;
  --ht-scrim:rgba(0,0,0,.55);
  --ht-poi-parking:#2B5BD7;--ht-poi-fuel:#3A4766;--ht-poi-slate:#4A5568;--ht-on-poi:#FFFFFF;
  --ht-e1:0 2px 8px rgba(0,0,0,.5);
  --ht-e2:0 8px 24px rgba(0,0,0,.55);
  --ht-e3:0 -1px 0 rgba(255,255,255,.08);
  --ht-edge-1:0 0 0 1px rgba(255,255,255,.06);
  --ht-edge-2:0 0 0 1px rgba(255,255,255,.08);
  color-scheme:dark;
}
@media (prefers-color-scheme:dark){
  html[data-theme=auto]{
    --ht-bg:#0B1220;--ht-surface-1:#131C2E;--ht-surface-2:#1B2640;--ht-surface-glass:rgba(19,28,46,.88);--ht-line:#26324A;
    --ht-text-1:#EEF2F8;--ht-text-2:#A3AFC2;--ht-text-3:#7C8AA3;--ht-primary-text:#FFB020;--ht-primary-tint:rgba(255,176,32,.14);
    --ht-danger-text:#FF6B61;--ht-danger-tint:rgba(255,107,97,.14);--ht-success-text:#3DD68C;--ht-success-tint:rgba(61,214,140,.12);
    --ht-caution:#FFD36B;--ht-caution-tint:rgba(255,211,107,.14);--ht-info-text:#7EA2FF;--ht-info-tint:rgba(126,162,255,.14);
    --ht-route:#5C8CFF;--ht-route-casing:#0B1220;--ht-route-alt:#56627A;--ht-scrim:rgba(0,0,0,.55);--ht-poi-fuel:#3A4766;
    --ht-e1:0 2px 8px rgba(0,0,0,.5);--ht-e2:0 8px 24px rgba(0,0,0,.55);--ht-e3:0 -1px 0 rgba(255,255,255,.08);
    --ht-edge-1:0 0 0 1px rgba(255,255,255,.06);--ht-edge-2:0 0 0 1px rgba(255,255,255,.08);color-scheme:dark;
  }
}

/* D3 per-language fonts (+ x1.15 line height for Farsi/Pashto/Dari and Gurmukhi) */
html[lang=fa],html[lang=ps],html[lang=prs],html[lang^=fa-],html[lang^=ps-]{--ht-font:var(--ht-font-fa);--ht-lh-mult:1.15}
html[lang=pa],html[lang^=pa-]{--ht-font:var(--ht-font-pa);--ht-lh-mult:1.15}

/* D14 text size: Default / Large / Larger */
html{font-size:100%;-webkit-text-size-adjust:100%;text-size-adjust:100%}
html[data-textsize=l]{font-size:115%}
html[data-textsize=xl]{font-size:130%}

/* D14b Display size: Standard / Large / Extra large for the whole app (lib/htsize.js sets html[data-disp=l|xl] and --ht-z,
   capped so a small phone keeps >= 300 CSS px of layout). Every UI layer (each direct child of <body>) is zoomed by --ht-z:
   text, buttons, tap targets, icons, tab bar, sheets, banners, chat bubbles, game tables. The map canvas (#map) is never
   zoomed, so it stays sharp. Inside the UI use --ht-vh1 / --ht-vw1 (one viewport percent, zoom-corrected), never raw vh / vw.
   Text size combines with it; the two together are capped at about 1.5x. */
:root{--ht-z:1;--ht-vh1:calc(1vh / var(--ht-z));--ht-vw1:calc(1vw / var(--ht-z))}
html[data-disp=l]{--ht-z:1.15}html[data-disp=xl]{--ht-z:1.3}
html[data-disp] body>:not(#map):not(script):not(style):not(link):not(template){zoom:var(--ht-z)}
/* two-column button rows and button lines: columns may shrink and words wrap instead of running off the card */
html[data-disp] :is(.g2,.sfr,.tpg,.ocg2,.ocpl)>*{min-width:0;white-space:normal;overflow-wrap:break-word}
html[data-disp] .ocline{flex-wrap:wrap}
/* the card table needs its height: on short screens (iPhone SE, phones in landscape) it stays at 1.1x */
@media (max-height:760px){html[data-disp] body>#ogx{zoom:1.1}}
html[data-disp=l][data-textsize=xl]{font-size:120%}
html[data-disp=xl][data-textsize=l]{font-size:108%}
html[data-disp=xl][data-textsize=xl]{font-size:115%}

/* D7 glass fallbacks */
@media (prefers-reduced-transparency:reduce){:root{--ht-glass-blur:none;--ht-surface-glass:var(--ht-surface-1)}}
/* D10 reduced motion: movement becomes a short crossfade */
@media (prefers-reduced-motion:reduce){
  :root{--ht-motion-base:150ms;--ht-motion-sheet:150ms;--ht-motion-screen:150ms;--ht-motion-camera:0ms}
}

/* Shared utility classes (opt-in; both teams may use) */
.ht-tnum{font-variant-numeric:tabular-nums}
.ht-focus:focus-visible,.ht-btn:focus-visible{outline:2px solid var(--ht-focus);outline-offset:2px}
.ht-ico{width:var(--ht-icon);height:var(--ht-icon);flex:none;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.ht-btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--ht-space-2);min-height:var(--ht-btn-h);padding:var(--ht-space-3) var(--ht-space-5);
  border:0;border-radius:var(--ht-radius-m);font:600 var(--ht-fs-headline)/var(--ht-lh-headline) var(--ht-font);background:var(--ht-surface-2);color:var(--ht-text-1);
  cursor:pointer;-webkit-tap-highlight-color:transparent;transition:transform var(--ht-motion-press) linear,filter var(--ht-motion-press) linear}
.ht-btn:active{transform:scale(.97);filter:brightness(.92)}
.ht-btn.primary{background:var(--ht-primary);color:var(--ht-on-primary)}
.ht-btn.danger{background:var(--ht-danger);color:var(--ht-on-danger)}
.ht-btn.small{min-height:var(--ht-btn-h-s)}

/* D16 Tablet layout: iPad (mini 744 up to Pro 13"), Android tablets and unfolded foldables, portrait and landscape, any
   width >= 744 px. Split View / Slide Over / phones (< 744 px) keep the phone layout. Like Google Maps on iPad: the map fills
   the screen; map sheets (route, stops, breakdown, parking, weigh, cross-dock, lists), the More sheet, Ask AI and Me become a
   side panel on the leading edge (left; right in Farsi / Pashto / Dari); the search bar, chips, turn banner, quick-action row
   and ETA / End bar line up in that same column; chats get two panes (list + conversation) when there are >= 680 CSS px after Display size (html:not([data-narrow])); other pop-up sheets become
   centred cards. --ht-pw = the panel width (zoom-aware, so Display size still fits). Prefix html:not(#_) = wins over the
   components' own phone rules, which load later. */
@media (min-width:744px){
  :root{--ht-pw:min(420px,max(calc(50 * var(--ht-vw1)),min(360px,calc(62 * var(--ht-vw1)))));--ht-lw:min(400px,max(calc(40 * var(--ht-vw1)),min(320px,calc(56 * var(--ht-vw1)))))}
  /* map page: one leading column */
  html:not(#_) body.ht #top{left:auto;right:auto;inset-inline-start:var(--ht-gutter);width:var(--ht-pw)}
  html:not(#_) body.ht.drv #top{inset-inline-start:var(--ht-space-3);top:calc(env(safe-area-inset-top,0px) + var(--ht-space-3))}
  html:not(#_) body.ht #bans{margin-inline-end:0}
  html:not(#_) body.ht #htchips{margin-inline:0;padding-inline:0;flex-wrap:wrap;overflow:visible}
  html:not(#_) body.ht .sheet,html:not(#_) body.ht #arr{left:auto;right:auto;inset-inline-start:var(--ht-gutter);top:calc(env(safe-area-inset-top,0px) + var(--ht-space-3));bottom:auto;width:var(--ht-pw);max-width:none;
    max-height:calc(100% - env(safe-area-inset-top,0px) - var(--ht-tb-live,0px) - var(--ht-space-3) * 2);margin:0;border-radius:var(--ht-radius-xl);box-shadow:var(--ht-e2),var(--ht-edge-2)!important;padding-bottom:var(--ht-space-6);overscroll-behavior:contain}
  html:not(#_) body.ht .sheet.full{bottom:calc(var(--ht-tb-live,0px) + var(--ht-space-3));max-height:none}
  html:not(#_) body.ht #arr{top:auto;bottom:calc(var(--ht-space-3) + env(safe-area-inset-bottom,0px))}
  html:not(#_) body.ht .sheet .grip{display:none}
  /* navigating: turn banner top-leading, ETA / End bar bottom-leading, speed sign right beside it (clear of the banner) */
  html:not(#_) body.ht.nav #bot{left:auto!important;right:auto!important;inset-inline-start:var(--ht-space-3)!important;width:var(--ht-pw);bottom:calc(var(--ht-space-3) + env(safe-area-inset-bottom,0px))}
  html:not(#_) body.ht.nav #nvb{border-radius:var(--ht-radius-xl);padding-bottom:var(--ht-space-3);box-shadow:var(--ht-e2),var(--ht-edge-2)}
  html:not(#_) body.ht.nav #spd{left:auto;right:auto;inset-inline-start:calc(var(--ht-space-3) * 2 + var(--ht-pw));bottom:calc(var(--ht-space-3) + env(safe-area-inset-bottom,0px))}
  html:not(#_) body.ht.nav #slim{left:auto;right:auto;inset-inline-start:calc(var(--ht-space-3) * 2 + var(--ht-pw));bottom:calc(var(--ht-space-3) + env(safe-area-inset-bottom,0px) + 56px)}
  /* app shell (public/od.js): quick row in the column, tab bar items grouped in the middle */
  html:not(#_) #odqa{left:auto;right:auto;inset-inline-start:var(--ht-gutter);width:var(--ht-pw);max-width:none;margin:0}
  html:not(#_) #odtb{padding-inline:max(var(--ht-space-2),calc(50% - 320px))}
  html:not(#_) #odms .pn{left:auto;right:auto;inset-inline-start:var(--ht-gutter);bottom:calc(var(--ht-tb-live,0px) + var(--ht-space-3));width:var(--ht-pw);max-height:calc(100% - var(--ht-tb-live,0px) - var(--ht-space-6) - env(safe-area-inset-top,0px));border-radius:var(--ht-radius-xl);box-shadow:var(--ht-e2),var(--ht-edge-2);padding-bottom:var(--ht-space-6)}
  html:not(#_) #odms .grab{display:none}
  html:not(#_) #odme,html:not(#_) #odai{left:auto;right:auto;inset-inline-start:0;width:calc(var(--ht-pw) + var(--ht-gutter) * 2);box-shadow:var(--ht-e2),var(--ht-edge-2)}
  html:not(#_) #odai{bottom:0}
  html:not(#_) body:has(#odme.on) #map{visibility:visible}
  /* pop-up sheets (language, licences, chat sheets, SOS, plans, call sheets, rooms, legal, background): centred cards */
  html:not(#_) .ht-sheet,html:not(#_) .ocsh,html:not(#_) #odcall .ccsh,html:not(#_) .frsh{align-items:center;justify-content:center;padding:var(--ht-space-6)}
  html:not(#_) .ht-sheet .pn,html:not(#_) .ocsh .ocshin,html:not(#_) #odcall .ccsh>div,html:not(#_) .frsh>div{width:min(560px,100%);max-height:calc(100% - var(--ht-space-6));border-radius:var(--ht-radius-xl)}
  html:not(#_) .odx{left:auto;right:auto;inset-inline-start:var(--ht-gutter);bottom:calc(var(--ht-space-3) + env(safe-area-inset-bottom,0px));width:var(--ht-pw);max-height:calc(100% - var(--ht-space-6));border-radius:var(--ht-radius-xl);box-shadow:var(--ht-e2),var(--ht-edge-2)}
  html:not(#_) #odbgp .pn,html:not(#_) #odlegp .pn{left:50%;right:auto;bottom:auto;top:50%;transform:translate(-50%,-50%);width:min(560px,calc(100% - 48px));max-height:calc(100% - 48px);border-radius:var(--ht-radius-xl)}
  /* chats: two panes (list | conversation); CB radio keeps the whole screen */
  html:not(#_):not([data-narrow]) #occ:not(.oc-cbmode) .ocnew{inset-inline-end:auto;inset-inline-start:calc(var(--ht-lw) - 74px)}
  html:not(#_):not([data-narrow]) #occ:not(.oc-cbmode)>:not(.occv):not(.ocnew){width:var(--ht-lw);overflow-x:clip;box-sizing:border-box;border-inline-end:1px solid var(--ht-line)}
  html:not(#_):not([data-narrow]) #occ:not(.oc-cbmode)::after{content:"";position:absolute;top:0;bottom:0;inset-inline-start:var(--ht-lw);inset-inline-end:0;z-index:-1;background:var(--ht-surface-2) no-repeat center/96px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C8AA3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z'/%3E%3Cpath d='M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1'/%3E%3C/svg%3E")}
  html:not(#_):not([data-narrow]) #occ:not(.oc-cbmode){isolation:isolate}
  html:not(#_):not([data-narrow]) #occ:not(.oc-cbmode) .occv{left:auto;right:auto;inset-inline-start:var(--ht-lw);inset-inline-end:0;width:auto}
  html:not(#_) #occ.oc-cbmode .ocbody>*{max-width:720px;margin-inline:auto}
}
/* Landscape tablets: room for a wider column */
@media (min-width:1100px) and (orientation:landscape){:root{--ht-pw:min(440px,max(calc(36 * var(--ht-vw1)),min(380px,calc(50 * var(--ht-vw1)))))}}
