/* ============================================================
   FleetFax — hi-fi brand system
   Clean white · crimson red w/ subtle gradient · heavy grotesque
   headings · monospace red eyebrows · soft shadows
   ============================================================ */

:root {
  /* brand */
  --red:      #E11D2A;
  --red-dk:   #C20F1B;
  --red-grad: linear-gradient(180deg, #ED2230 0%, #C70F1C 100%);
  --red-soft: #FDECEC;
  --red-line: #F6C9CC;

  /* neutrals */
  --ink:    #0B0C0E;   /* headings */
  --text:   #353A42;   /* body */
  --muted:  #697586;
  --faint:  #98A1AE;
  --bg:     #FFFFFF;
  --soft:   #F6F7F9;
  --soft-2: #EEF0F3;
  --line:   #E7E9EE;
  --line-2: #EFF1F4;

  /* status */
  --green:    #15A34A;
  --green-sf: #E7F6ED;
  --amber:    #E08A00;
  --amber-sf: #FCF1DD;
  --danger:   #E11D2A;
  --danger-sf:#FDECEC;
  --blue:     #2F6BFF;
  /* FMCSA percentile "alert zone" wash — strong enough to read as a shaded band
     on the percentile track (the old 11% was nearly invisible). Single source so
     the chart band and the legend swatch can never drift apart. */
  --alert-zone: color-mix(in oklab, var(--red) 17%, transparent);
  --alert-zone-edge: color-mix(in oklab, var(--red) 55%, transparent);

  /* radii + shadow */
  --r-xs: 8px; --r-sm: 10px; --r: 14px; --r-lg: 18px; --r-xl: 24px;
  --sh-xs: 0 1px 2px rgba(16,24,40,.05);
  --sh-sm: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --sh:    0 4px 14px rgba(16,24,40,.07), 0 1px 3px rgba(16,24,40,.05);
  --sh-lg: 0 12px 34px rgba(16,24,40,.12), 0 3px 8px rgba(16,24,40,.06);

  /* official fleetfax typography — Inter (sans) + Geist Mono (mono/display) */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-display: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* official brand gradient (matches css/main.css --brand-gradient) */
  --brand-gradient: linear-gradient(135deg, #e6202b 0%, #c8102e 55%, #8e0c20 100%);
}

/* official gradient wordmark */
.ff-wordmark {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.04em;
  text-transform: lowercase; color: var(--red-dk);
  background: var(--brand-gradient);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* "beta" pill that follows the wordmark — mirrors the home-page nav badge so the
   carrier header reads "fleetfax beta" too. translateY bottom-aligns the pill on
   the wordmark baseline. */
.ff-beta {
  align-self: center; transform: translateY(2px);
  font-family: var(--mono); font-size: 0.5625rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; line-height: 1;
  color: var(--faint); background: none; border: 1px solid var(--line);
  border-radius: 999px; padding: 0.12rem 0.4rem;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

h1,h2,h3,h4 { color: var(--ink); font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.12; }

.mono { font-family: var(--mono); }
a, .link { color: var(--red); text-decoration: none; cursor: pointer; }
a:hover, .link:hover { text-decoration: underline; }

/* monospace red eyebrow */
.eyebrow {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted);
}
.eyebrow.red { color: var(--red); }

/* subtle gradient ink for big display numbers/wordmark */
.grad-ink {
  background: linear-gradient(150deg, #1A1C20 0%, #4A5260 120%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- layout helpers ---------- */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.center { align-items: center; }
.start { align-items: flex-start; }
.g4{gap:4px}.g6{gap:6px}.g8{gap:8px}.g10{gap:10px}.g12{gap:12px}.g14{gap:14px}.g16{gap:16px}.g20{gap:20px}.g24{gap:24px}
.muted{color:var(--muted)} .faint{color:var(--faint)} .ink{color:var(--ink)}
.tiny{font-size:12.5px} .sm{font-size:13.5px}
.nowrap{white-space:nowrap}

/* ---------- card ---------- */
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-sm);
}
.card.soft { background: var(--soft); box-shadow: none; }
.card-pad { padding: 22px 24px; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border-radius: var(--r-sm); padding: 9px 15px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); box-shadow: var(--sh-xs);
  transition: background .12s, border-color .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--soft); }
.btn:active { transform: translateY(1px); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn.primary {
  background: var(--red-grad); color: #fff; border-color: var(--red-dk);
  box-shadow: 0 1px 2px rgba(193,15,27,.35), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn.primary:hover { filter: brightness(1.04); }
.btn.danger:hover { background: var(--danger-sf); border-color: var(--red-line); color: var(--red); }
.icon-btn { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: var(--r-sm); }

/* ---------- chips / pills ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 12.5px; font-weight: 500; color: var(--text);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--bg);
}
.chip.solid { background: var(--soft); border-color: var(--line-2); }
.pill { display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.pill .dot { width:7px; height:7px; border-radius:50%; }
.pill.ok    { background: var(--green-sf);  color: #0F7A37; }
.pill.warn  { background: var(--amber-sf);  color: #9A5E00; }
.pill.bad   { background: var(--danger-sf); color: var(--red-dk); }
.pill.ok .dot{background:var(--green)} .pill.warn .dot{background:var(--amber)} .pill.bad .dot{background:var(--danger)}
.tag { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--red); border: 1px solid var(--red-line); background: var(--red-soft);
  border-radius: 6px; padding: 2px 6px; font-weight: 500; white-space: nowrap; }
.tag.pro { color: var(--red); }

.dotc { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

/* ---------- percentile bar ---------- */
.pbar { position: relative; height: 10px; border-radius: 999px; background: var(--soft-2); overflow: visible; }
.pbar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.pbar .fill.good { background: linear-gradient(90deg,#1FB85C,#15A34A); }
.pbar .fill.warn { background: linear-gradient(90deg,#F2A93B,#E08A00); }
.pbar .fill.bad  { background: var(--red-grad); }
.pbar .alertzone { position: absolute; top: 0; bottom: 0; right: 0; background: var(--alert-zone); border-radius: 0 999px 999px 0; pointer-events: none; }
.pbar .peer { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #0B0C0E; opacity: .55; border-radius: 2px; }
.pbar .thr  { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 2px dashed var(--alert-zone-edge); }
/* marker-on-track variant: carrier percentile is a dot at its POSITION (lower=better),
   so a 2nd-percentile carrier reads as a dot near the left, never an empty bar. */
.pbar.marker .mark {
  position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%;
  transform: translate(-50%, -50%); z-index: 2;
  border: 2px solid var(--bg); box-shadow: 0 0 0 1px rgba(11, 12, 14, .14);
}
.pbar.marker .mark.good { background: #15A34A; }
.pbar.marker .mark.warn { background: #E08A00; }
.pbar.marker .mark.bad  { background: var(--red); }

/* placeholder imagery */
.ph {
  background:
    repeating-linear-gradient(45deg, var(--soft) 0 9px, var(--soft-2) 9px 10px);
  border: 1px solid var(--line); border-radius: var(--r);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px;
  color: var(--muted); font-family: var(--mono); font-size: 11.5px;
}

/* divider */
.hr { height: 1px; background: var(--line); border: 0; }
.vr { width: 1px; background: var(--line); align-self: stretch; }

/* Safety: peer-percentile (BASIC) table beside its "how to read" guide, instead
   of the guide stranded at the page bottom. Stacks (guide drops below the table,
   still attached to the section — never back to the page bottom) once the wide
   6-column BASIC table can no longer share the row without cramping. */
/* summary band: the headline values evenly split into equal columns (adapts to
   however many are shown), labels centered beneath each, hairline dividers between. */
.ff-sumstats { display: flex; width: 400px; max-width: 100%; }
.ff-sumstats > div { flex: 1 1 0; min-width: 0; }
.ff-sumstats > div + div { border-left: 1px solid var(--line); }

.ff-safety-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: stretch; }
@media (max-width: 1080px) { .ff-safety-split { grid-template-columns: 1fr; } }
/* Violations + Roadside side by side; each grows so a lone one spans full width,
   and they wrap to a stack on narrow viewports. */
.ff-safety-pair { display: flex; flex-wrap: wrap; gap: 20px; align-items: start; }
.ff-safety-pair > section { flex: 1 1 420px; min-width: 0; }
/* How-to guide capped to the BASIC table's height: the scroll layer is absolute so
   it contributes no height (the table drives the row), then scrolls with a bottom
   fade when its own content is taller. */
.ff-howto { position: relative; overflow: hidden; }
.ff-howto-scroll {
  position: absolute; inset: 0; overflow-y: auto; padding: 18px 20px 20px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
}
@media (max-width: 1080px) {
  .ff-howto { position: static; overflow: visible; }
  .ff-howto-scroll { position: static; overflow: visible; padding: 18px 20px;
    -webkit-mask-image: none; mask-image: none; }
}
/* vertical dividers become stray lines once flex zones wrap to a stack — hide on narrow */
@media (max-width: 760px) { .vr { display: none; } }

/* folder tabs (clean, color-coded) — horizontally scrollable so all tabs are reachable on narrow screens */
.ftabs {
  display: flex; gap: 4px; align-items: flex-end; border-bottom: 1px solid var(--line);
  /* overflow-x:auto enables horizontal scroll on narrow screens, but it implicitly
     promotes overflow-y to `auto` too — and the active tab's `bottom:-1px` overhang
     then becomes 1px of vertical scroll, so the strip "wiggles" up/down on a trackpad.
     Pin overflow-y:hidden to kill that without losing the horizontal scroll. */
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none;
}
.ftabs::-webkit-scrollbar { display: none; }
.ftab {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; flex: 0 0 auto;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--muted);
  padding: 10px 14px; border: 1px solid transparent; border-bottom: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0; position: relative; bottom: -1px; background: transparent;
  transition: background .12s, color .12s;
}
/* responsive header: drop the keyboard hint / help on narrow so the search fits */
@media (max-width: 640px) { .ff-kbd { display: none !important; } }
@media (max-width: 480px) { .ff-help { display: none !important; } }
.ftab:hover { color: var(--ink); background: var(--soft); }
.ftab .tdot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.ftab[aria-selected="true"] {
  color: var(--ink); background: var(--bg);
  border-color: var(--line); border-bottom-color: var(--bg);
}
.ftab[aria-selected="true"]::before {
  content: ""; position: absolute; top: 0; height: 3px;
  /* Inset by the 1px tab border and round to the tab's own top radius so the accent
     follows the tab's rounded corners instead of overhanging them with square ends. */
  left: 1px; right: 1px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  background: var(--tab-accent, var(--red));
}
/* Suppress the persistent mouse-click focus ring on tabs (the stray border that
   appeared after clicking); keep a real, intentional ring for keyboard users. */
.ftab:focus { outline: none; }
.ftab:focus-visible { outline: 2px solid color-mix(in oklab, var(--tab-accent, var(--red)) 60%, transparent); outline-offset: 1px; border-radius: var(--r-sm) var(--r-sm) 0 0; }

/* DOT / MC deep-link to the official FMCSA SAFER snapshot — subtle hover underline
   so the clickability reads without shouting "link" in the identifier row. */
.ff-extlink { text-decoration: none; cursor: pointer; }
.ff-extlink:hover { text-decoration: underline; text-underline-offset: 2px; }

/* equipment unit table — 10 columns never fit a phone; scroll it horizontally
   inside its own track instead of blowing out the whole page width. */
.eq-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  /* let the table keep its natural column widths and scroll, not crush */
  margin: 0 -2px var(--s-5, 20px);
}
.eq-table-scroll .eq-table { margin-bottom: 0; min-width: 760px; }
/* faint right-edge cue that there's more to scroll */
@media (max-width: 760px) {
  .eq-table-scroll {
    background:
      linear-gradient(90deg, var(--bg) 30%, transparent),
      linear-gradient(90deg, transparent, var(--bg) 70%) 100% 0,
      radial-gradient(farthest-side at 0 50%, rgba(11,12,14,.10), transparent),
      radial-gradient(farthest-side at 100% 50%, rgba(11,12,14,.10), transparent) 100% 0;
    background-repeat: no-repeat;
    background-size: 24px 100%, 24px 100%, 12px 100%, 12px 100%;
    background-attachment: local, local, scroll, scroll;
  }
}

/* Summary stat clusters (Safety summary + inspection rows) sit in flex columns
   that are `flex:0 0 auto` for the desktop 2-up layout. shrink:0 stops the inner
   wrapped stat row from ever wrapping on a phone, so the last stat clips off the
   right edge. On narrow, let the column take the full width and shrink so its
   `.row.wrap` of stats wraps cleanly. */
@media (max-width: 640px) {
  .ff-statcol { flex: 1 1 100% !important; min-width: 0 !important; width: 100%; }
}

/* Compact (scrolled) hero: on a phone the status pills crowd the verdict label
   and Save button off the edge. Drop the secondary pills — the verdict + Save
   are the load-bearing controls; the pills repeat what the full hero shows. */
@media (max-width: 640px) { .cmpt-pill, .cmpt-dot, .cmpt-concern { display: none !important; } }
/* keep the compact-bar call button as an icon-only tap target on narrow */
@media (max-width: 520px) { .cmpt-calltext { display: none !important; } }

/* contact copy buttons — quiet by default, lift on hover (always visible so a
   trackpad/touch user can reach them without a hover state). */
.ff-copy:hover { background: var(--soft) !important; color: var(--ink) !important; }
.ff-contact .ff-copy { opacity: .55; transition: opacity .12s; }
.ff-contact:hover .ff-copy, .ff-copy:focus-visible { opacity: 1; }

/* scrollbar */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #D3D7DE; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #BfC4cc; }
