/* The driver's screens: the phone app's driver frame (Layout/DriverShell) and
 * the load cards and My day card (Pages/Operations), which the web app's
 * My loads page shares.
 *
 * Made for a phone in a truck: gloves on, sun on the glass. Targets are at
 * least 3.5rem tall, the main buttons 4.5rem; sizes are in rem so a driver
 * who turns the phone's text size up gets bigger buttons, not clipped words.
 * Every colour is a theme token (themes.css).
 */

/* ---------------------------------------------------------------------------
 * The frame: top bar, page, tab bar.
 * ------------------------------------------------------------------------ */
.osm-driver-app {
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
  background: var(--osm-ground);
}

.osm-driver-topbar { position: sticky; top: 0; }
.osm-driver-org {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  font-weight: 700; font-size: 1.0625rem; color: var(--osm-on-chrome);
}
.osm-driver-org-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.osm-driver-main { flex: 1 1 auto; outline: none; padding-bottom: 6rem; }

.osm-driver-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  display: flex;
  padding-bottom: var(--osm-safe-bottom);
  background: var(--osm-surface);
  border-top: 2px solid var(--osm-rule-strong);
  box-shadow: var(--osm-shadow-md);
}
.osm-driver-tab {
  flex: 1 1 0; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 4.25rem; padding: 6px 4px;
  color: var(--osm-ink-soft); text-decoration: none;
  font-weight: 600; font-size: 0.9375rem;
  border-top: 4px solid transparent;
}
.osm-driver-tab.is-active { color: var(--osm-accent); border-top-color: var(--osm-accent); background: var(--osm-accent-soft); }
.osm-driver-tab:focus-visible { outline: 3px solid var(--osm-accent); outline-offset: -3px; }
.osm-driver-tab-count {
  position: absolute; top: 4px; left: calc(50% + 10px);
  min-width: 1.4rem; height: 1.4rem; padding: 0 6px; border-radius: 999px;
  background: var(--osm-warn); color: var(--osm-ink);
  font-size: 0.75rem; font-weight: 700; line-height: 1.4rem; text-align: center;
}

/* ---------------------------------------------------------------------------
 * A load card.
 * ------------------------------------------------------------------------ */
.osm-driver-card.is-running { border: 2px solid var(--osm-accent); }
.osm-driver-number { font-family: var(--osm-font-mono); font-size: 1.5rem; font-weight: 700; letter-spacing: 0.01em; }

.osm-due {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-weight: 700; font-size: 0.9375rem; white-space: nowrap;
}
.osm-due.is-fine { background: var(--osm-sunk); color: var(--osm-ink-soft); }
.osm-due.is-soon { background: var(--osm-warn-soft); color: var(--osm-ink); border: 1px solid var(--osm-warn); }
.osm-due.is-late { background: var(--osm-alarm-soft); color: var(--osm-alarm); border: 1px solid var(--osm-alarm); }

.osm-driver-times { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 1rem; }
.osm-driver-times dt { font-weight: 600; color: var(--osm-ink-soft); }
.osm-driver-times dd { margin: 0; }
.osm-driver-nlt-pending { color: var(--osm-ink-mute); font-style: italic; }

.osm-driver-route { display: grid; grid-template-columns: 1.5rem 1fr; gap: 4px 8px; align-items: start; }
.osm-driver-route-mark {
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--osm-sunk); color: var(--osm-ink); font-weight: 700; font-size: 0.75rem;
}
.osm-driver-route-mark.is-next { background: var(--osm-accent); color: var(--osm-on-accent); }

.osm-driver-big {
  min-height: 4.5rem; font-size: 1.375rem; font-weight: 800; letter-spacing: 0.02em;
  width: 100%;
}
/* The same sizes on MudButtons. material.css's phone rule (.mud-button-root.mud-button
 * { min-height: 44px }) has the same weight and loads first, so these win by order. */
.mud-button-root.osm-driver-big { min-height: 4.5rem; font-size: 1.375rem; font-weight: 800; }
.mud-button-root.osm-driver-confirm-button { min-height: 4rem; }   /* Yes, start / Yes, stop */
.mud-button-root.osm-driver-cancel { min-height: 4rem; min-width: 6rem; }
.mud-button-root.osm-driver-secondary { min-height: 3.5rem; }     /* Undo, the ticket, Directions */
/* Directions on our own map (V0956): one big, full-width button on a phone;
   the view under it - the map, then the turns, each a readable line. */
.osm-driver-directions .mud-button-root { width: 100%; }
@media (min-width: 600px) { .osm-driver-directions .mud-button-root { width: auto; } }
.osm-driver-directions-view .osm-map.osm-directions-map { height: 300px; min-height: 240px; }
@media (min-width: 768px) { .osm-driver-directions-view .osm-map.osm-directions-map { height: 380px; } }
.osm-directions-turns { margin: 0; padding-left: 1.5rem; }
.osm-directions-turns li { padding: 0.4rem 0; border-bottom: 1px solid var(--osm-rule); font-size: 1.0625rem; }
.osm-directions-turns li:last-child { border-bottom: 0; }
.osm-directions-turn-miles { display: block; font-size: 0.875rem; }
.osm-driver-directions-view .mud-button-root.osm-directions-again { width: 100%; }
@media (min-width: 600px) { .osm-driver-directions-view .mud-button-root.osm-directions-again { width: auto; } }
.mud-button-root.osm-driver-small { min-height: 44px; }           /* OK under a refused step */
.mud-button-root.osm-driver-refresh { min-height: 3rem; }
.mud-button-root.osm-driver-break { min-height: 3.75rem; }
.osm-driver-line { min-height: 3.5rem; }                          /* a sent / waiting step line */
/* The driver's fields stay 3.5rem (56px) tall on a phone, with the label centered:
 * material.css's phone rule trims outlined fields to 45px, which leaves the
 * label of a full-size (not dense) field sitting low. */
.osm-driver-card .mud-input.mud-input-outlined .mud-input-slot.mud-input-slot,
.osm-driver-select .mud-input.mud-input-outlined .mud-input-slot.mud-input-slot { padding-top: 18.5px; padding-bottom: 18.5px; }

/* The field phone's big buttons (Components/FieldPhoneButton): never smaller
 * than the Bootstrap btn-lg buttons they replaced. */
.mud-button-root.osm-phone-button { min-height: 3rem; font-size: 1.25rem; }
.mud-button-root.osm-phone-button.is-tall { min-height: 3.75rem; }
.mud-button-root.osm-phone-button.is-hero { min-height: 4.5rem; font-size: 1.5rem; }
.mud-button-root.osm-phone-button.justify-start { text-align: start; }

.osm-driver-stop { background: var(--osm-alarm); border-color: var(--osm-alarm); color: var(--osm-on-accent); }
.osm-driver-stop:hover, .osm-driver-stop:focus { background: var(--osm-alarm); border-color: var(--osm-ink); color: var(--osm-on-accent); }

.osm-driver-timer {
  font-family: var(--osm-font-mono); font-size: 2.25rem; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}

/* Saved here, not yet with the office: dashed, never green, never a tick. */
.osm-driver-waiting {
  border: 2px dashed var(--osm-accent); border-radius: var(--osm-radius);
  color: var(--osm-ink); padding: 8px 12px;
}
.osm-driver-sent {
  background: var(--osm-signal-soft); color: var(--osm-signal);
  border-radius: var(--osm-radius); padding: 8px 12px;
}
.osm-driver-refused {
  border: 1px solid var(--osm-alarm); border-radius: var(--osm-radius); padding: 8px 12px;
}

.osm-driver-more > summary {
  min-height: 3.5rem; display: flex; align-items: center; gap: 8px;
  font-weight: 600; cursor: pointer; list-style: none;
}
.osm-driver-more > summary::-webkit-details-marker { display: none; }

.osm-driver-confirm {
  background: var(--osm-sunk); border-radius: var(--osm-radius); padding: 12px;
}
.osm-driver-confirm-question { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }

/* ---------------------------------------------------------------------------
 * My day.
 * ------------------------------------------------------------------------ */
.osm-myday-state { font-size: 1.25rem; font-weight: 700; }
.osm-myday-clock {
  font-family: var(--osm-font-mono); font-size: 2.5rem; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.osm-myday-punches { list-style: none; padding: 0; margin: 0; }
.osm-myday-punches li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--osm-rule); }

/* A phone with its text turned up: let the tab labels wrap, never clip. */
@media (max-width: 359.98px) {
  .osm-driver-tab { font-size: 0.8125rem; }
  .osm-driver-big { font-size: 1.125rem; }
}

/* ---------------------------------------------------------------------------
 * Operations and Field pages (Material): phone targets for the few controls
 * the shared 44px rule in material.css does not reach - clickable filter
 * chips, a load number that is the row's only link, a fold-out's summary.
 * ------------------------------------------------------------------------ */
@media (max-width: 767.98px), (pointer: coarse) {
  .mud-chip.osm-tap-chip { height: 44px; }
  a.osm-tap-link { display: inline-block; padding: 14px 0; }
  summary.osm-tap-summary { padding: 13px 0; }   /* stays a list item, so it keeps its disclosure triangle */
}
/* Field codes (site, equipment, price-book item, PM program) are stored in
 * capitals: show them in capitals as they are typed, as the Bootstrap forms
 * did with text-uppercase. The placeholder is already in capitals. */
.osm-code-field .mud-input > input.mud-input-root { text-transform: uppercase; font-family: var(--osm-font-mono); }
/* The field phone's fields (Pages/Field/Phone): bigger text for gloves and
 * sun, in the body face. (Typo.h6 did this before, but h6 is the heading face -
 * in capitals in the Flare and Mesquite themes - so what a person
 * typed came out in capitals.) */
.osm-phone-field .mud-input { font-size: 1.25rem; }
.osm-phone-field .mud-input input::placeholder, .osm-phone-field .mud-input textarea::placeholder { font-size: 1rem; }
/* Getting onto the lease (V0830, V0831): the gate code, large enough to read
 * at the gate in a glove, and the lease road under the stop. */
.osm-driver-gate { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem; padding: 0.4rem 0.6rem;
                   border: 1px solid var(--osm-rule-strong); border-radius: var(--osm-radius); background: var(--osm-sunk); }
.osm-driver-gate-code { font-size: 1.5rem; letter-spacing: 0.08em; }
.osm-driver-lease-road { color: var(--osm-ink-soft); }

/* Live turn-by-turn guidance (V0956): the next turn in one big banner - the
   arrow, the distance counting down, the words - readable at arm's length in
   a cab, in the theme's own colours, light or dark. */
.osm-guidance-banner {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem; border-radius: var(--osm-radius);
    background: var(--osm-accent); color: var(--osm-on-accent);
}
.osm-guidance-banner .osm-guidance-arrow { font-size: 3.5rem; width: 3.5rem; height: 3.5rem; flex: none; color: inherit; }
.osm-guidance-words { min-width: 0; }
.osm-guidance-distance { font-size: 1.75rem; font-weight: 800; line-height: 1.1; }
.osm-guidance-instruction { font-size: 1.25rem; font-weight: 600; line-height: 1.25; }
.osm-guidance-entrance { font-size: 1rem; margin-top: 0.25rem; }
.osm-guidance-controls .mud-button-root { flex: 1 1 8rem; }
.osm-directions-turns li.is-next { font-weight: 700; }
