/* Plain and big. Todd uses this on a phone in a driveway. */

:root {
  --ink: #16191d;
  --muted: #5c6672;
  --line: #d8dde3;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #14507d;
  --accent-ink: #ffffff;
  --bad: #9b2226;
  --good: #1b6b3a;
}

* { box-sizing: border-box; }

/*
  The body is the accent colour, not the page colour, and <main> paints the
  light background instead. That matters because of black-translucent: the
  iOS status bar draws white text straight over whatever is behind it, and
  rubber-band scrolling at the top of the page exposes the body. A light
  body there would put white status text on a near-white background.
*/
body {
  margin: 0;
  min-height: 100vh;
  background: var(--accent);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* header */

/*
  Sticky so the bar keeps covering the status bar strip while the page
  scrolls. Keep this background dark -- white status bar text sits on it.
*/
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--accent);
  padding: 12px calc(20px + env(safe-area-inset-right)) 12px
           calc(20px + env(safe-area-inset-left));
  padding-top: calc(12px + env(safe-area-inset-top));
}

.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent-ink);
  text-decoration: none;
  letter-spacing: .01em;
}

.bar nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar form { margin: 0; }

.who { color: rgba(255, 255, 255, .72); font-size: 14px; }

.ghost {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.ghost:hover { border-color: var(--muted); }

/* In the dark bar the same buttons have to invert. */
.bar .ghost {
  border-color: rgba(255, 255, 255, .35);
  color: var(--accent-ink);
}

.bar .ghost:hover { border-color: var(--accent-ink); }

/* page */

main {
  background: var(--bg);
  min-height: 100vh;
  padding: 24px calc(20px + env(safe-area-inset-right))
           calc(64px + env(safe-area-inset-bottom))
           calc(20px + env(safe-area-inset-left));
}

main > * {
  max-width: 900px;
  margin-inline: auto;
}

h1 { font-size: 26px; margin: 8px 0 24px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em;
     color: var(--muted); margin: 32px 0 12px; }

section:first-of-type h2 { margin-top: 0; }

.empty { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; }

/* tool buttons */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  min-height: 96px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
}

.tile:hover { border-color: var(--accent); }
.tile-title { font-size: 19px; font-weight: 600; }
.tile-desc { color: var(--muted); font-size: 14px; }
.tile.quiet { background: transparent; }

/* login */

.login {
  max-width: 340px;
  margin: 48px auto;
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.login h1 { margin-top: 0; }

label {
  display: block;
  margin: 14px 0 5px;
  font-size: 14px;
  color: var(--muted);
}

input[type="email"],
input[type="tel"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  /* 16px minimum, or iOS zooms the whole page on focus. */
  font-size: 16px;
}

/*
  .chip is excluded: ETA chips are submit buttons too, and without this they
  inherit the full-width primary style and stack into a column of giant bars.
*/
button[type="submit"]:not(.ghost):not(.chip) {
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.error {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fdeceb;
  color: var(--bad);
  font-size: 14px;
}

/* --- price rounder ------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 { margin-top: 0; }

/* Side by side on a phone: quantity x rate reads as one expression. */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.row label { margin-top: 0; }

/* Big enough to hit with a thumb without looking. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.chip {
  flex: 1 1 auto;
  min-width: 72px;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chip:active { background: var(--bg); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.out {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.out:last-child { border-bottom: 0; }
.out dt { color: var(--muted); font-size: 14px; margin: 0; }
.out dd {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.out.lead dd { font-size: 30px; color: var(--accent); }
.out .sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }

dl { margin: 0; }

.copy {
  margin-top: 4px;
  padding: 11px 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
}

.copy.done { color: var(--good); border-color: var(--good); }

/* --- on my way ----------------------------------------------------------- */

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

.stop-time {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.stop-name { font-size: 20px; font-weight: 600; }

.badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: #e7f3ec;
  color: var(--good);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.card .chips { margin-top: 14px; }

/*
  Four ETAs, one row, always. Left to flex they size to their own text and
  wrap the last one onto a line of its own, which reads like a different
  kind of button. A fixed four-column grid keeps them a single control.
*/
.chips.etas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.chips.etas .chip { min-width: 0; padding: 12px 4px; }
.hint.warn { color: var(--bad); }

/* Just-sent stop, so a glance down the list confirms which one went. */
.card.flash { border-color: var(--good); box-shadow: 0 0 0 1px var(--good); }

/* The message exactly as the customer will see it. */
.bubble {
  margin: 16px 0 4px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 14px;
  font-size: 17px;
  line-height: 1.45;
}

/* --- quote follow-up ------------------------------------------------------ */

/* Reuses .card/.stop-head/.stop-time/.stop-name/.badge/.hint/.copy from
   on-my-way and the price rounder rather than inventing a parallel set. */

.amount-badge {
  background: #eaf1f7;
  color: var(--accent);
}

.lead-card .copy { margin-top: 10px; display: inline-block; }

.contact-lines {
  margin-top: 10px;
  padding: 9px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--muted);
}

.contact-lines div + div { margin-top: 3px; }

.notes {
  margin: 10px 0 0;
  padding: 9px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13.5px;
}

/* --- quoter --------------------------------------------------------------- */

.picks { margin: 8px 0; }
.pick {
  display: block; width: 100%; text-align: left;
  padding: 12px 14px; margin-top: 8px;
  font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer;
}
.pick span { display: block; font-size: 14px; color: var(--muted); }
.radio { display: flex; gap: 8px; align-items: center; font-weight: 400; margin-top: 8px; }

.line { border-top: 1px solid var(--line); padding: 14px 0; }
.line:first-child { border-top: 0; padding-top: 0; }
.line-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.line-total { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 6px; }
.x {
  width: 40px; height: 40px; font-size: 22px; line-height: 1;
  background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); cursor: pointer;
}

.readout .out.lead dd { font-size: 34px; }

.big {
  display: block; width: 100%; min-height: 56px; margin: 8px 0 16px;
  font: inherit; font-size: 18px; font-weight: 700; text-align: center;
  color: var(--accent-ink); background: var(--accent);
  border: 0; border-radius: 10px; cursor: pointer; text-decoration: none; line-height: 56px;
}
.big:disabled { opacity: .4; cursor: default; }
.big.done, .big.done:disabled { background: var(--good); opacity: 1; }
.big.link { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px;
  font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 8px;
}
.script { padding-left: 20px; margin: 0; }
.script li + li { margin-top: 8px; }
.warn { color: var(--bad); }
