/* Colors come from /static/css/brand.css (generated from config/brand.js). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 17px; line-height: 1.55; color: var(--ink); background: var(--paper); }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; word-break: break-word; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.lead { font-size: 1.15rem; max-width: 46rem; }

/* Header and nav */
.site-header { background: var(--primary); color: #fff; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.logo { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.logo .tag { font-weight: 400; font-size: .8rem; opacity: .8; margin-left: 6px; }
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
.nav a { color: #fff; text-decoration: none; font-size: .95rem; }
.nav a:hover { text-decoration: underline; }
.banner { background: var(--accent); color: var(--ink); text-align: center; padding: 8px 16px; font-weight: 600; font-size: .95rem; }

/* Buttons */
.btn { display: inline-block; background: var(--accent); color: var(--ink); border: 2px solid var(--accent); border-radius: 6px; padding: 10px 18px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(.95); }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--primary); }
.site-header .btn-ghost { color: #fff; border-color: #fff; }
.btn-small { padding: 4px 12px; font-size: .9rem; }
.nav a.btn { color: var(--ink); }
.link-button { background: none; border: 0; padding: 0; color: var(--primary); text-decoration: underline; font: inherit; cursor: pointer; }
form.inline { display: inline; margin: 0; }

/* Sections */
.hero { padding: 48px 0 24px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--muted); margin: 0 0 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.section { padding: 24px 0; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card { border: 1px solid #dde3ea; border-radius: 10px; padding: 18px; background: #fff; }
.card p { margin: 0; }
.card.narrow { max-width: 440px; margin: 32px auto; }
.steps { padding-left: 1.25em; max-width: 46rem; }
.steps li { margin-bottom: 10px; }
.example { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.example div { background: #f4f7fa; border-radius: 8px; padding: 14px; display: flex; flex-direction: column; }
.example strong { font-size: 1.5rem; }
.terms dt { font-weight: 700; margin-top: 12px; }
.terms dd { margin: 2px 0 0; max-width: 46rem; }
.faq details { border-bottom: 1px solid #dde3ea; padding: 12px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { margin: 8px 0 0; max-width: 46rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #dde3ea; vertical-align: top; }
.table th { background: #f4f7fa; }

/* Forms */
.form { display: grid; gap: 14px; max-width: 520px; }
.form label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
.form input, .form select, .form textarea { font: inherit; padding: 9px 10px; border: 1px solid #b9c3cf; border-radius: 6px; width: 100%; background: #fff; color: var(--ink); }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.form .field-error { color: #a4161a; font-weight: 400; font-size: .85rem; }
.alert { background: #fdecea; border: 1px solid #f5c2c0; color: #7a1513; padding: 10px 12px; border-radius: 6px; }
.notice { background: #e8f4ec; border: 1px solid #b7dfc3; color: #1d4d2c; padding: 12px 14px; border-radius: 6px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Calculator */
.calc { grid-template-columns: 1fr auto; align-items: end; }
.calc-results { margin-top: 20px; max-width: 560px; border: 1px solid #dde3ea; border-radius: 10px; overflow: hidden; }
.calc-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #eef1f5; }
.calc-row:last-child { border-bottom: 0; }
.calc-row.big strong { font-size: 1.3rem; }
.calc-row.total { background: #f4f7fa; font-weight: 700; }

/* MFA */
.qr { display: block; margin: 12px 0; image-rendering: pixelated; }
.secret { background: #f4f7fa; padding: 2px 6px; border-radius: 4px; }

/* Admin */
.admin-header { background: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { display: flex; flex-direction: column; gap: 4px; border: 1px solid #dde3ea; border-radius: 10px; padding: 16px; text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--primary); }
.tile span { color: var(--muted); font-size: .9rem; }

/* Footer */
.site-footer { border-top: 1px solid #dde3ea; margin-top: 40px; padding: 20px 0; font-size: .9rem; }
.site-footer p { margin: 4px 0; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero { padding-top: 28px; }
  .form .row { grid-template-columns: 1fr; }
  .calc { grid-template-columns: 1fr; }
  .calc-row { flex-direction: column; gap: 2px; }
}

.status-form { display: flex; gap: 6px; align-items: center; }
.status-form select { font: inherit; font-size: .9rem; padding: 4px 6px; border: 1px solid #b9c3cf; border-radius: 6px; }
.filters a[aria-current] { font-weight: 700; color: var(--ink); text-decoration: none; }

/* Application */
.form.wide { max-width: 720px; }
.form .row.three { grid-template-columns: 2fr 1fr 1fr; }
.list { padding-left: 1.1em; }
.list li { margin-bottom: 6px; }
.list form.inline { margin-left: 8px; }
fieldset.choice { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
fieldset.choice legend { font-weight: 600; font-size: .95rem; margin-bottom: 6px; width: 100%; }
.form label.inline-choice { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.form label.inline-choice input { width: auto; }
.checklist ul { margin: 0; }
button[disabled] { opacity: .5; cursor: not-allowed; }
@media (max-width: 600px) { .form .row.three { grid-template-columns: 1fr; } }

/* Back office carriers */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #eef1f5; color: var(--ink); white-space: nowrap; }
.pill-submitted, .pill-in_review { background: #fff3d6; }
.pill-approved { background: #e3f0ff; }
.pill-active { background: #e8f4ec; color: #1d4d2c; }
.pill-declined, .pill-inactive { background: #fdecea; color: #7a1513; }
.section.card { padding: 18px; margin: 16px 0; }
.form textarea { resize: vertical; }
.notes { list-style: none; padding: 0; }
.notes li { border-left: 3px solid #dde3ea; padding: 4px 0 4px 12px; margin-bottom: 10px; }
.notes p { margin: 2px 0 0; white-space: pre-wrap; }
.actions-cell form + form { margin-left: 10px; }
.status-form input[type="text"] { font: inherit; font-size: .9rem; padding: 4px 6px; border: 1px solid #b9c3cf; border-radius: 6px; min-width: 0; }
.status-form { flex-wrap: wrap; }
.form > button, .form > .btn { justify-self: start; }

/* Invoices */
fieldset.group { border: 1px solid #dde3ea; border-radius: 10px; padding: 12px 16px 16px; margin: 0; display: grid; gap: 14px; }
fieldset.group legend { font-weight: 700; padding: 0 6px; }
.pill-inv-submitted, .pill-inv-verifying { background: #fff3d6; }
.pill-inv-approved { background: #e3f0ff; }
.pill-inv-funded, .pill-inv-paid { background: #e8f4ec; color: #1d4d2c; }
.pill-inv-rejected, .pill-inv-charged_back, .pill-inv-short_paid { background: #fdecea; color: #7a1513; }
.pill-credit-approved { background: #e8f4ec; color: #1d4d2c; }
.pill-credit-call_first { background: #fff3d6; }
.pill-credit-do_not_haul { background: #fdecea; color: #7a1513; }
.big-rating .pill { font-size: 1rem; padding: 4px 14px; }
.search-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.search-form input, .search-form select { font: inherit; padding: 6px 8px; border: 1px solid #b9c3cf; border-radius: 6px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checks li.ok strong { color: #1d4d2c; }
.checks li.bad strong { color: #a4161a; }
.check-row { display: grid; grid-template-columns: 1fr 260px; gap: 10px; align-items: center; }
@media (max-width: 600px) { .check-row { grid-template-columns: 1fr; } }
.pill-batch-open, .pill-batch-exported { background: #fff3d6; }
.pill-batch-sent { background: #e8f4ec; color: #1d4d2c; }
.pill-batch-cancelled { background: #fdecea; color: #7a1513; }

/* Invoice timeline */
.timeline { list-style: none; padding: 0; margin: 16px 0; border-left: 3px solid #dde3ea; }
.timeline li { position: relative; padding: 0 0 14px 18px; }
.timeline li::before { content: ''; position: absolute; left: -8px; top: 4px; width: 13px; height: 13px; border-radius: 50%; background: #dde3ea; border: 2px solid var(--paper); }
.timeline li.done::before { background: #2f8a4c; }
.timeline li.current::before { background: var(--accent); }
.timeline li.rejected::before { background: #a4161a; }
.timeline li.todo { color: var(--muted); }
.timeline li strong { margin-right: 6px; }
.row-late td { background: #fdecea; }

/* Reports */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.table.money td:not(:first-child), .table.money th:not(:first-child) { text-align: right; white-space: nowrap; }
.table td.indent { padding-left: 24px; }
.total-row td { font-weight: 700; background: #f4f7fa; }
.pill-tms-match { background: #e8f4ec; color: #1d4d2c; margin-left: 6px; }
.pill-tms-mismatch { background: #fdecea; color: #7a1513; margin-left: 6px; }
.card.tms-match { border-color: #9fd2ad; }
.card.tms-mismatch { border-color: #f5c2c0; }
