/* Nelco Fuel: Barlow Condensed headings, Public Sans body, diesel-green accent. Mobile first. */
:root {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --surface-2: #eceee8;
  --ink: #1a1d18;
  --muted: #5b6457;
  --line: #d6dad0;
  --accent: #2f6b2a;        /* diesel green */
  --accent-ink: #ffffff;
  --accent-soft: #e2eedc;
  --warn: #8a5a00;
  --warn-soft: #fbefd6;
  --danger: #a32020;
  --danger-soft: #fbe2e0;
  --ok: #2f6b2a;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 5%);
  --head: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111410;
    --surface: #191d17;
    --surface-2: #222720;
    --ink: #e9ece5;
    --muted: #9aa494;
    --line: #2f362c;
    --accent: #7cc16a;
    --accent-ink: #0d140b;
    --accent-soft: #23331f;
    --warn: #f0b545;
    --warn-soft: #3a2e14;
    --danger: #ff8a80;
    --danger-soft: #3d1b19;
    --ok: #7cc16a;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Whatever the page scrolls to (a section, an anchor) lands below the sticky top bar, not under it. */
html { scroll-padding-top: 5rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); }
h1, h2, h3, .brand { font-family: var(--head); font-weight: 700; letter-spacing: .01em; line-height: 1.1; margin: 0 0 .5rem; }
h1 { font-size: 2.2rem; text-transform: uppercase; }
h2 { font-size: 1.5rem; text-transform: uppercase; }
h3 { font-size: 1.2rem; }
a { color: var(--accent); }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.site-footer { text-align: center; padding: 1.5rem 1rem 2.5rem; font-size: .875rem; }
.site-footer a { color: var(--muted); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem;
  background: var(--surface); border-bottom: 3px solid var(--accent); position: sticky; top: 0; z-index: 5; }
.brand { font-size: 1.5rem; text-transform: uppercase; margin: 0; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.narrow { max-width: 640px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.hero { padding: 1.5rem 1rem; }
.hero p { font-size: 1.1rem; color: var(--muted); }

label { display: block; font-weight: 600; font-size: .9rem; margin: .75rem 0 .25rem; }
input, select, textarea { width: 100%; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: .65rem .75rem; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: 1.25rem; min-height: 1.25rem; margin: 0; accent-color: var(--accent); }
/* iPhone Safari gives date and time inputs a minimum width of their own and ignores width: 100%,
   pushing forms past the screen. Let them shrink; the native picker still opens. */
input[type=date], input[type=datetime-local], input[type=time] { display: block; min-width: 0; max-width: 100%;
  -webkit-appearance: none; appearance: none; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.field-error { color: var(--danger); font-size: .85rem; margin-top: .25rem; }
.grid { display: grid; gap: 0 1rem; }
.grid > * { min-width: 0; }
@media (min-width: 640px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }

button, .button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: 700 1.05rem var(--head);
  text-transform: uppercase; letter-spacing: .04em; border: 0; border-radius: 8px; padding: .7rem 1.1rem; min-height: 44px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; }
button.secondary, .button.secondary { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { button.danger { color: #1a0b0a; } }
button:disabled { opacity: .55; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

.stat { font: 700 2rem var(--head); color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.stats > div { background: var(--surface-2); border-radius: 8px; padding: .75rem; }

.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.high, .pill.block, .pill.overdue, .pill.expired, .pill.clawed_back { background: var(--danger-soft); color: var(--danger); }
.pill.elevated, .pill.warn, .pill.due_today, .pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.low, .pill.on_time, .pill.earned, .pill.restored, .pill.approved, .pill.approved_with_deposit { background: var(--accent-soft); color: var(--ok); }

.flags { list-style: none; padding: 0; margin: .5rem 0; }
.flags li { padding: .4rem .6rem; border-left: 4px solid var(--line); margin-bottom: .3rem; background: var(--surface-2); border-radius: 0 6px 6px 0; font-size: .92rem; }
.flags li.block { border-color: var(--danger); }
.notes { list-style: none; padding: 0; margin: .5rem 0; color: var(--muted); font-size: .9rem; }
.note { color: var(--warn); font-weight: 600; }
.flags li.warn { border-color: var(--warn); }

.notice { padding: .75rem 1rem; border-radius: 8px; background: var(--accent-soft); margin: 1rem 0; }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.hidden { display: none !important; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 700 .95rem var(--head); text-transform: uppercase; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
@media (max-width: 639px) { .hide-sm { display: none; } }

.tabs { display: flex; gap: .25rem; overflow-x: auto; margin-bottom: 1rem; }
.tabs button { background: transparent; color: var(--muted); border-bottom: 3px solid transparent; border-radius: 0; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs button[hidden] { display: none; }

/* Pipeline board: stages stack on phones, three across on wider screens. Empty stages shrink to their heading. */
.board { display: grid; grid-template-columns: 1fr; gap: .75rem; padding-bottom: .5rem; }
@media (min-width: 900px) { .board { grid-template-columns: repeat(3, 1fr); } }
.column { background: var(--surface-2); border-radius: var(--radius); padding: .6rem; min-width: 0; }
.column.empty h3 { margin: 0; color: var(--muted); }
.board-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; margin-bottom: .75rem; }
.board-tools input[type=search] { flex: 1 1 16rem; margin: 0; }
.board-tools details { flex: 0 0 auto; }
.board-tools details[open] { flex: 1 1 100%; }
.board-tools summary { list-style: none; }
.board-tools summary::-webkit-details-marker { display: none; }
.due-list { list-style: none; padding: 0; margin: 0; }
.due-list li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.due-list li:last-child { border-bottom: 0; }
.due-list .due { font-size: .9rem; color: var(--muted); }
.due-list .due.late { color: var(--danger); font-weight: 600; }
.closed-deals { margin-top: 1rem; }
.closed-deals > summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: .5rem 0; }
.fleet-card .next { font-size: .85rem; margin-top: .25rem; }
.column h3 { display: flex; justify-content: space-between; font-size: 1.05rem; text-transform: uppercase; }
.fleet-card { display: block; width: 100%; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: .6rem; margin-bottom: .5rem; font: inherit; text-transform: none; letter-spacing: 0; min-height: 0; }
.fleet-card, .fleet-card:hover { text-decoration: none; }
.fleet-card:hover { border-color: var(--accent); }
.fleet-card strong, .fleet-card span { display: block; }
.fleet-card .due { font-size: .85rem; color: var(--muted); }
.fleet-card .due.late { color: var(--danger); font-weight: 600; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 .75rem .75rem; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline time { display: block; font-size: .8rem; color: var(--muted); }

/* Sign-in */
.sign-in { margin: 1.5rem auto; }
.code-input { font: 700 2.2rem var(--head); letter-spacing: .45em; text-align: center; padding-left: .45em; font-variant-numeric: tabular-nums; }
button.link { background: none; border: 0; color: var(--accent); font: 600 .95rem var(--body); text-transform: none; letter-spacing: 0;
  padding: 0; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.choices { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .6rem; }
.choices .button { width: 100%; justify-content: space-between; }
.choices .button small { font: 600 .85rem var(--body); color: inherit; text-transform: none; letter-spacing: 0; opacity: .9; }
.who { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-end { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.brand, .topbar button { white-space: nowrap; }
@media (max-width: 639px) { .who { display: none; } }

/* Team */
.invite-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.invite-row:last-child { border-bottom: 0; }
.invite-row .who-line { min-width: 0; overflow-wrap: anywhere; }
details.member { display: block; }
details.member summary { cursor: pointer; }
details.member .check { margin: .5rem 0; }
#invite .check { margin: .5rem 0; }
.code-input::selection { background: var(--accent-soft); color: var(--ink); }

/* Prices: one line per supplier sheet with its date */
.sheets { list-style: none; padding: 0; margin: 1rem 0 .5rem; }
.sheets li { padding: .5rem 0; border-top: 1px solid var(--line); }
.sheets li:first-child { border-top: 0; }
.sheets li > span { display: block; font-size: .9rem; }
.sheets .stale { color: var(--warn); font-weight: 600; }
.sheets .notice { margin: .5rem 0 0; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#file-paperwork { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
#file-paperwork h4 { margin: 0 0 .5rem; }

/* Prospect search: a table on wide screens, one card per carrier on phones. */
.actions select { width: auto; }
table.prospects td.place { min-width: 9.5rem; }
table.prospects td.carrier { min-width: 14rem; }
table.prospects td.contact { min-width: 11rem; max-width: 14rem; overflow-wrap: anywhere; }
table.prospects td.gallons { white-space: nowrap; }
table.prospects .drivers-note { display: inline-block; min-width: 6rem; }
table.prospects details.fit ul { margin: .25rem 0; padding-left: 1.1rem; }

/* Near you: search around a town or the phone's location, the map, and a day of visits. */
fieldset.near-search { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem 1rem .75rem; margin: 0 0 1rem; }
fieldset.near-search legend { font-weight: 600; padding: 0 .35rem; }
.near-actions { align-self: end; margin-top: 0; }
/* isolation keeps Leaflet's own layers under the sticky page header. */
.prospect-map { height: 420px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); isolation: isolate; position: relative; z-index: 0; }
@media (max-width: 640px) { .prospect-map { height: 320px; } }
.visit-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: .75rem; }
.visit-bar .check { margin: 0; }
label.visit-pick { display: inline-flex; gap: .25rem; align-items: center; font-size: .8rem; white-space: nowrap; cursor: pointer; }
label.visit-pick input { width: auto; margin: 0; }
.visit-route ol { padding-left: 1.4rem; }
.visit-route li { margin: .35rem 0; }
.route-number span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #1a5fb4; color: #fff; font-weight: 700; font-size: 13px; border: 2px solid #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 35%); }
.leaflet-popup-content button { margin-top: .4rem; }
td.row-actions button.show-on-map { margin: .35rem 0; }
tr.mini-map-row td { background: var(--surface-2); }
.mini-map { height: 260px; max-width: 720px; border-radius: var(--radius); overflow: hidden; isolation: isolate; position: relative; z-index: 0; }
.mini-map-note { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 0; }
table.prospects details.fit summary { cursor: pointer; }
/* File names have no spaces; let them break so the Open button stays on a phone screen. */
table.documents td:first-child { overflow-wrap: anywhere; min-width: 8rem; }
@media (max-width: 639px) {
  table.prospects thead { display: none; }
  table.prospects, table.prospects tbody, table.prospects tr, table.prospects td { display: block; width: 100%; }
  table.prospects tr { padding: .75rem 0; border-bottom: 1px solid var(--line); }
  table.prospects td { border: 0; padding: .15rem 0; text-align: left; }
  table.prospects td.num:first-child { display: none; }
  table.prospects td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
  table.prospects td a { overflow-wrap: anywhere; }
}

/* Fleet page: lesser sections fold shut behind a one-line summary. */
details.fold > summary { cursor: pointer; display: flex; align-items: baseline; gap: .6rem; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: '▸'; margin-left: auto; color: var(--muted); }
details.fold[open] > summary::after { content: '▾'; }
details.fold[open] > summary { margin-bottom: .75rem; }
details.fold > summary h3 { margin: 0; }
/* Team tab: which product's team is showing. */
.team-choice { margin: 0 0 1rem; }

/* Sales agent terms (/agent-terms/): long reading, so a calm measure and clear section breaks. */
.terms h1 { margin-bottom: .25rem; }
.terms section { margin-top: 1.25rem; }
.terms h2 { font-size: 1.1rem; margin-bottom: .4rem; }
.terms p { line-height: 1.55; max-width: 70ch; }
#accept .check { margin-bottom: 1rem; }
