/* FreightPencil — styles.css */
:root {
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fe;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #16191d;
  --muted: #5b636e;
  --line: #dfe3e8;
  --good: #1a7f37;
  --bad: #c62828;
  --fixed: #1f6feb;
  --variable: #e8912d;
  --driver: #8250df;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #4c8dff;
    --accent-soft: #15233d;
    --bg: #0f1216;
    --surface: #171b21;
    --ink: #e8ebef;
    --muted: #9aa4b1;
    --line: #2a3038;
    --good: #3fb950;
    --bad: #ff6b6b;
    --fixed: #4c8dff;
    --variable: #f0a04b;
    --driver: #a782f0;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); }
a { color: var(--accent); }
img, svg { max-width: 100%; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.logo svg { color: var(--accent); }
.nav { display: flex; gap: 16px; font-size: .95rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; font-size: .9rem; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
.site-footer a { color: var(--muted); }

.breadcrumbs { font-size: .85rem; color: var(--muted); margin: 14px 0 0; }
.breadcrumbs a { color: var(--muted); }

h1 { font-size: clamp(1.5rem, 4.2vw, 2.2rem); line-height: 1.2; margin: 10px 0 4px; letter-spacing: -.02em; }
.subtitle { margin: 0 0 16px; color: var(--muted); }
h2 { font-size: 1.4rem; line-height: 1.3; margin: 2em 0 .5em; letter-spacing: -.01em; }
h3 { font-size: 1.1rem; margin: 1.5em 0 .4em; }

/* calculator card */
.calc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr; }
.calc-inputs { padding: 14px 14px 6px; order: 1; }
.calc-results { order: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--accent-soft); border-radius: var(--radius) var(--radius) 0 0; position: sticky; top: 0; z-index: 5; }
@media (min-width: 860px) {
  .calc-card { grid-template-columns: 1.25fr 1fr; }
  .calc-inputs { padding: 20px; order: 1; }
  .calc-results { order: 2; border-bottom: 0; border-left: 1px solid var(--line); border-radius: 0 var(--radius) var(--radius) 0; position: static; padding: 20px; }
  .results-inner { position: sticky; top: 16px; }
}

fieldset { border: 0; margin: 0 0 8px; padding: 0; min-width: 0; }
legend { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0; margin-bottom: 6px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.grid .full { grid-column: 1 / -1; }
@media (min-width: 560px) { .grid.three { grid-template-columns: 1fr 1fr 1fr; } }
.field { display: flex; flex-direction: column; min-width: 0; }
.field label { font-size: .82rem; color: var(--muted); line-height: 1.25; margin-bottom: 3px; }
.input { position: relative; display: flex; align-items: center; }
.input .unit { position: absolute; font-size: .9rem; color: var(--muted); pointer-events: none; }
.input .unit.pre { left: 10px; }
.input .unit.post { right: 10px; }
.input input { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; font-variant-numeric: tabular-nums; }
.input .pre + input { padding-left: 22px; }
.input input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); background: var(--surface); }
details.group { border-top: 1px solid var(--line); padding: 8px 0; }
details.group > summary { cursor: pointer; font-weight: 700; font-size: .95rem; display: flex; justify-content: space-between; align-items: center; list-style: none; padding: 4px 0; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 1.2rem; }
details.group[open] > summary::after { content: "\2212"; }
details.group > summary .sub { font-weight: 400; color: var(--muted); font-size: .85rem; margin-left: auto; margin-right: 10px; }
details.group .grid { margin-top: 6px; }

.error { color: var(--bad); font-size: .9rem; margin: 6px 0 0; }
.calc-invalid .result-main, .calc-invalid .result-rows, .calc-invalid .bar-wrap { opacity: .35; }

.result-main { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.big { font-size: clamp(2rem, 9vw, 2.8rem); font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.big-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.target { margin-left: auto; text-align: right; }
.target .val { font-size: 1.35rem; font-weight: 800; color: var(--good); font-variant-numeric: tabular-nums; }
@media (min-width: 860px) { .result-main { display: block; } .target { margin: 14px 0 0; text-align: left; } }
.result-rows { margin: 12px 0 0; padding: 0; list-style: none; font-size: .92rem; display: none; }
.result-rows li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.result-rows li span:first-child { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.bar-wrap { margin-top: 12px; display: none; }
.bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line); }
.bar span { display: block; height: 100%; transition: width .2s; }
@media (min-width: 860px) { .result-rows, .bar-wrap { display: block; } }
.result-note { font-size: .85rem; color: var(--muted); margin: 10px 0 0; display: none; }
@media (min-width: 860px) { .result-note { display: block; } }

/* load verdict */
.verdict { display: inline-block; font-size: .85rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-top: 6px; background: var(--line); color: var(--ink); }
.verdict[data-verdict="healthy"] { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.verdict[data-verdict="thin"] { background: color-mix(in srgb, var(--variable) 20%, transparent); color: #9a5b00; }
.verdict[data-verdict="loss"] { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.big[data-verdict="loss"], .val[data-verdict="loss"] { color: var(--bad); }
.val[data-verdict="thin"] { color: #9a5b00; }
.val-plain[data-verdict="loss"] { color: var(--bad); }
.val-plain[data-verdict="healthy"] { color: var(--good); }
@media (prefers-color-scheme: dark) { .verdict[data-verdict="thin"] { color: var(--variable); } }
.result-rows li.sep { border-top: 1px solid var(--line); margin-top: 4px; }

/* tabs (driver pay modes) */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.tabs button { font: inherit; font-size: .9rem; border: 0; background: none; color: var(--muted); padding: 7px 6px; border-radius: 7px; cursor: pointer; min-height: 36px; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.tabs button:focus-visible { outline: 2px solid var(--accent); }
[hidden] { display: none !important; }

/* IFTA rows */
.ifta-head, .ifta-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 32px; gap: 6px; align-items: center; }
.ifta-head { font-size: .75rem; color: var(--muted); margin: 2px 0 4px; }
.ifta-row { margin-bottom: 6px; }
.ifta-row select { width: 100%; font: inherit; font-size: .95rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 6px; min-height: 40px; }
.ifta-row select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.sr-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.row-x { font: inherit; font-size: 1.2rem; line-height: 1; width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; cursor: pointer; }
.row-x:hover { color: var(--bad); border-color: var(--bad); }
.add-row { margin: 2px 0 8px; }
.warnings { margin: 10px 0 0; padding: 8px 10px 8px 26px; font-size: .85rem; background: color-mix(in srgb, var(--variable) 14%, transparent); border-radius: 8px; }
.warnings li { margin: 2px 0; }
.big[data-verdict="healthy"] { color: var(--good); }
.breakdown { margin-top: 16px; }
.breakdown h2 { margin-top: 0; font-size: 1.1rem; }

/* fuel what-if */
.whatif { border-top: 1px solid var(--line); padding: 10px 0 6px; margin-top: 6px; }
.whatif .compare { margin-top: 4px; }
.whatif .compare th { color: var(--muted); font-weight: 400; }
.whatif .compare tr.current th, .whatif .compare tr.current td { color: var(--ink); font-weight: 700; background: var(--accent-soft); }
.note-warn { font-size: .88rem; background: color-mix(in srgb, var(--variable) 16%, transparent); border-radius: 8px; padding: 8px 10px; margin: 10px 0 0; }
.good-txt { color: var(--good); }
.bad-txt { color: var(--bad); }

/* breakdown shown under the card on phones */
.mobile-breakdown { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; }
.mobile-breakdown .result-rows, .mobile-breakdown .bar-wrap { display: block; margin-top: 0; }
.mobile-breakdown .bar-wrap { margin-top: 10px; }
@media (min-width: 860px) { .mobile-breakdown { display: none; } }

.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px 14px; grid-column: 1 / -1; border-top: 1px solid var(--line); order: 3; }
@media (min-width: 860px) { .actions { padding: 14px 20px 18px; } }
.btn { font: inherit; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; min-height: 36px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 16px; height: 16px; }
.privacy-note { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); margin: 10px 0 0; }
.link-btn { font: inherit; font-size: .85rem; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 2px 4px; }
.link-btn.danger { color: var(--bad); }

.saved-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 12px; }
.saved-panel h2 { font-size: 1.05rem; margin: 0 0 8px; }
.saved-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line); }
.saved-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.compare th, .compare td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.compare thead th { font-size: .85rem; }
.compare tbody th { color: var(--muted); font-weight: 400; }

/* ads + affiliates */
.ad-slot { min-height: 280px; margin: 28px 0; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: .75rem; }
.ad-slot::before { content: "Advertisement"; text-transform: uppercase; letter-spacing: .08em; }
.affiliates { margin: 20px 0; display: grid; gap: 10px; }
.affiliates .disclosure { margin: 0; font-size: .8rem; color: var(--muted); }
.offer { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink); }
.offer span { color: var(--muted); font-size: .9rem; }

/* article */
.content { max-width: 720px; }
.content p, .content li { color: var(--ink); }
.formula { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 14px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92rem; overflow-x: auto; }
.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: .93rem; background: var(--surface); font-variant-numeric: tabular-nums; }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; }
table.data td.num, table.data th.num { text-align: right; }
table.data tfoot td { font-weight: 700; }
.callout { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; }
.broker-tip { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--good); border-radius: 10px; padding: 12px 16px; margin: 14px 0; }
.broker-tip p { margin: 6px 0; }
.broker-tip .tip-label { margin: 0; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--good); }
.broker-tip .tip-sig { font-size: .85rem; color: var(--muted); margin-bottom: 0; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 2px; }

.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tool-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); }
.tool-card:hover { border-color: var(--accent); }
.tool-card strong { display: block; margin-bottom: 2px; }
.tool-card span { color: var(--muted); font-size: .9rem; }
.tool-card.soon { opacity: .6; pointer-events: none; }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 4px; background: var(--line); color: var(--muted); margin-left: 6px; vertical-align: middle; }
.disclaimer { font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 32px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: .9rem; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .site-header, .site-footer, .actions, .ad-slot, .affiliates, .content, .saved-panel, .breadcrumbs, .privacy-note, .mobile-breakdown, .subtitle, noscript { display: none !important; }
  .print-only { display: block; }
  .calc-card { display: block; border: 0; box-shadow: none; }
  .calc-results { position: static; background: none; border: 0; padding: 0 0 12px; }
  .result-rows, .bar-wrap, .result-note { display: block !important; }
  details.group { display: block; }
  details.group > summary::after { content: ""; }
  .input input { border: 0; background: none; padding: 0 0 0 18px; min-height: 0; }
}
