/* Drayage Dispute Audit — dashboard styles.
   One stylesheet, no framework. The palette is HaulSentry's brand blue on a light
   neutral base; money and verdicts are the only places colour is spent, so that the
   number the user came for is the first thing their eye lands on. */

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-tint: #eff4ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --surface: #ffffff;
  --good: #047857;
  --good-tint: #ecfdf5;
  --warn: #b45309;
  --warn-tint: #fffbeb;
  --bad: #b91c1c;
  --bad-tint: #fef2f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.015em; }
p { margin: 0; }
em { font-style: normal; }

/* ------------------------------------------------------------------- topbar */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(140deg, var(--brand) 0%, #60a5fa 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .55);
}
.brand-text { font-weight: 650; font-size: 15px; display: flex; flex-direction: column; }
.brand-text em { font-weight: 450; font-size: 11.5px; color: var(--ink-3); letter-spacing: .02em; }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topnav .who { color: var(--ink-3); font-size: 13px; margin-right: 6px; }
.language-menu select { width: auto; min-width: 102px; padding: 6px 26px 6px 8px; font-size: 12.5px; color: var(--ink-2); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------------ buttons */

.btn {
  font: inherit; font-weight: 550; font-size: 14px;
  padding: 8px 15px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: #f1f5f9; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { border-color: var(--line); background: var(--surface); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 10px; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
.linkbtn {
  font: inherit; color: var(--brand); background: none; border: 0;
  padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}

/* -------------------------------------------------------------------- hero */

main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 72px; }

.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: start;
  padding: 28px 0 12px;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: .09em; font-size: 11.5px;
  font-weight: 650; color: var(--brand); margin-bottom: 14px;
}
.hero h1 { font-size: 42px; letter-spacing: -.03em; margin-bottom: 18px; }
.hero h1 em { color: var(--brand); }
.lede { font-size: 17px; color: var(--ink-2); max-width: 34em; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 26px 0 14px; }
.hero-note { font-size: 13.5px; color: var(--ink-3); max-width: 34em; }

.hero-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.panel-title { font-weight: 650; font-size: 14.5px; }
.panel-sub { font-size: 13px; color: var(--ink-3); margin-top: 4px !important; margin-bottom: 14px; }

.sample-list { display: flex; flex-direction: column; gap: 8px; }
.sample {
  text-align: left; width: 100%; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 12px 14px; font: inherit; color: inherit;
  transition: border-color .12s, background .12s;
}
.sample:hover { border-color: var(--brand); background: var(--brand-tint); }
.sample strong { display: block; font-size: 13.5px; font-weight: 600; }
.sample span { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.sample-list-compact .sample span { display: none; }

/* --------------------------------------------------------------------- how */

.how { margin-top: 56px; }
.how h2 { font-size: 22px; margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.card h3 { font-size: 14.5px; margin-bottom: 7px; }
.card p { font-size: 13.5px; color: var(--ink-2); }
.card-quiet { background: #f1f5f9; border-style: dashed; }

/* -------------------------------------------------------------------- forms */

.narrow { max-width: 560px; margin: 0 auto; padding-top: 20px; }
.page-title { font-size: 27px; margin-bottom: 8px; }
.page-sub { color: var(--ink-3); font-size: 14.5px; margin-bottom: 22px !important; }
.card-form {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 550; color: var(--ink-2); }
.req { font-weight: 450; color: var(--ink-3); font-size: 11.5px; }
input, textarea, select {
  font: inherit; font-size: 14.5px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { resize: vertical; }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }
.danger-zone { margin-top: 22px; text-align: center; }
.privacy-tools { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.privacy-tools h2 { font-size: 17px; margin-bottom: 6px; }
.privacy-tools > p { font-size: 13.5px; color: var(--ink-3); margin-bottom: 13px; }
.delete-account { margin-top: 18px; border: 1px solid #fecaca; border-radius: 10px; padding: 12px 14px; background: var(--bad-tint); }
.delete-account summary { cursor: pointer; font-weight: 600; color: var(--bad); }
.delete-account form { margin-top: 14px; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #991b1b; }

/* ------------------------------------------------------------------ banners */

.banner {
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 22px;
  border: 1px solid; font-size: 14px;
}
.banner-code { background: var(--warn-tint); border-color: #fcd34d; color: #7c2d12; }
.banner-code code {
  font-family: var(--mono); font-size: 18px; font-weight: 600; letter-spacing: .06em;
  background: #fff; padding: 3px 9px; border-radius: 7px; border: 1px solid #fcd34d;
  display: inline-block; margin: 6px 8px 6px 0;
}
.banner-title { font-weight: 650; margin-bottom: 4px; }

/* -------------------------------------------------------------------- stats */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat-label { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-value { font-size: 27px; font-weight: 680; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.stat-hero .stat-value { color: var(--brand); }
.stat-good .stat-value { color: var(--good); }

/* ------------------------------------------------------------------- upload */

.upload-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; margin-bottom: 24px; }
.dropzone {
  border: 2px dashed #cbd5e1; border-radius: var(--radius);
  background: var(--surface); padding: 34px 20px; text-align: center;
  transition: border-color .12s, background .12s;
}
.dropzone.over { border-color: var(--brand); background: var(--brand-tint); }
.dz-title { font-weight: 600; font-size: 15px; }
.dz-sub { font-size: 13.5px; color: var(--ink-3); margin-top: 5px !important; }
.upload-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

.progress {
  display: flex; align-items: center; gap: 11px; padding: 14px 18px;
  background: var(--brand-tint); border: 1px solid #bfdbfe;
  border-radius: var(--radius); margin-bottom: 20px; font-size: 14px; color: var(--ink-2);
}
.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid #bfdbfe; border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------- tables */

.section-title { font-size: 18px; margin: 28px 0 12px; }

.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); font-weight: 650; padding: 11px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #f8fafc; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-3); }

.empty {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 34px; text-align: center; color: var(--ink-3); font-size: 14px;
}

/* -------------------------------------------------------------------- pills */

.pill {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2.5px 8px;
  border-radius: 999px; border: 1px solid; white-space: nowrap;
}
.pill-good { background: var(--good-tint); border-color: #a7f3d0; color: var(--good); }
.pill-warn { background: var(--warn-tint); border-color: #fde68a; color: var(--warn); }
.pill-bad { background: var(--bad-tint); border-color: #fecaca; color: var(--bad); }
.pill-flat { background: #f1f5f9; border-color: var(--line); color: var(--ink-3); }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }

/* ------------------------------------------------------------------- detail */

.detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.detail-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 20px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.detail-title { font-size: 19px; }
.detail-sub { color: var(--ink-3); font-size: 13.5px; margin-top: 4px !important; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-body { padding: 22px; display: flex; flex-direction: column; gap: 24px; }

.verdict { border-radius: var(--radius); padding: 18px 20px; border: 1px solid; }
.verdict-yes { background: var(--brand-tint); border-color: #bfdbfe; }
.verdict-no { background: #f8fafc; border-color: var(--line); }
.verdict-amount { font-size: 34px; font-weight: 700; letter-spacing: -.025em; color: var(--brand); font-variant-numeric: tabular-nums; }
.verdict-no .verdict-amount { color: var(--ink-2); font-size: 20px; }
.verdict-sub { font-size: 14px; color: var(--ink-2); margin-top: 6px !important; }

.block h3 { font-size: 15px; margin-bottom: 10px; }
.finding {
  border-left: 3px solid var(--brand); background: #f8fafc;
  padding: 12px 14px; border-radius: 0 9px 9px 0; margin-bottom: 9px;
}
.finding-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.finding-head strong { font-size: 14px; }
.finding-amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.finding-days { font-size: 12.5px; color: var(--ink-3); margin-top: 2px !important; }
.finding-ev { font-size: 13px; color: var(--ink-2); margin-top: 7px !important; }

.caveats { background: var(--warn-tint); border: 1px solid #fde68a; border-radius: var(--radius); padding: 14px 16px; }
.caveats h3 { font-size: 13.5px; color: #7c2d12; margin-bottom: 7px; }
.caveats ul { margin: 0; padding-left: 18px; font-size: 13px; color: #78350f; }
.caveats li { margin-bottom: 4px; }

.daygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 7px; }
.day {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: var(--surface);
}
.day-billable { background: #f8fafc; }
.day-disputed { background: var(--bad-tint); border-color: #fecaca; }
.day-date { font-size: 12px; font-weight: 650; }
.day-amt { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.day-why { font-size: 11px; color: var(--bad); margin-top: 3px !important; line-height: 1.35; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
details.editor { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.editor > summary {
  cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 14.5px; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
details.editor > summary::-webkit-details-marker { display: none; }
details.editor > summary::after { content: "＋"; color: var(--ink-3); font-weight: 400; }
details.editor[open] > summary::after { content: "－"; }
.editor-body { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.hint { font-size: 12.5px; color: var(--ink-3); }

.evrow { display: grid; grid-template-columns: 1.1fr .8fr 1.4fr auto; gap: 8px; align-items: end; }
.checkline { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.checkline input { width: auto; }
.legal-consent { align-items: flex-start; line-height: 1.45; }
.legal-consent input { margin-top: 3px; }
.legal-consent-copy { display: block; }
.legal-consent-copy .inline-link { display: inline; }
.inline-link { padding: 0; border: 0; background: none; color: var(--brand-dark); font: inherit; text-decoration: underline; cursor: pointer; }

/* -------------------------------------------------------------------- toast */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; box-shadow: var(--shadow); z-index: 60; max-width: 90vw;
}
.toast.bad { background: var(--bad); }

/* ------------------------------------------------------------ operator view */

.admin-app { padding-top: 8px; }
.admin-head, .workspace-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.admin-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 20px 0; }
.admin-stats .stat { padding: 14px; }
.admin-stats .stat-value { font-size: 23px; }
.funnel { padding: 18px; margin-bottom: 18px; }
.funnel h2 { font-size: 16px; margin-bottom: 14px; }
.funnel-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.funnel-step { position: relative; padding: 12px; border-radius: 9px; background: var(--brand-tint); color: var(--brand-dark); }
.funnel-step:not(:last-child)::after { content: '→'; position: absolute; right: -10px; top: 11px; z-index: 1; color: var(--ink-3); }
.funnel-step strong { display: block; font-size: 23px; font-variant-numeric: tabular-nums; }
.funnel-step span { display: block; font-size: 12px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(270px, .8fr); gap: 18px; align-items: start; }
.admin-filter { margin: -4px 0 10px; }
.admin-flag { margin-top: 7px; max-width: 26em; font-size: 11.5px; color: var(--warn); line-height: 1.35; }
.activity-feed { display: flex; flex-direction: column; gap: 8px; }
.activity-item { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.activity-item div { display: flex; flex-direction: column; gap: 1px; }
.activity-item strong { font-size: 13px; }
.activity-item span, .activity-item p, .activity-item time { font-size: 12px; color: var(--ink-3); }
.activity-item p { margin-top: 5px !important; color: var(--ink-2); }
.activity-item time { display: block; margin-top: 4px; }
.workspace-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; }
.workspace-head h2 { font-size: 20px; }
.workspace-head p { color: var(--ink-3); font-size: 13px; margin-top: 4px !important; }
.operator-flags { border: 1px solid #fde68a; background: var(--warn-tint); border-radius: var(--radius); padding: 14px 18px; margin: 14px 0; }
.operator-flags h3 { font-size: 14px; color: #7c2d12; }
.operator-flags ul { color: #78350f; font-size: 13px; padding-left: 19px; margin: 7px 0 0; }
.operator-flags li + li { margin-top: 4px; }
.admin-detail { margin-top: 14px; }

/* ------------------------------------------------------------- legal pages */

.legal { max-width: 760px; margin: 0 auto; padding-top: 16px; }
.legal h2 { font-size: 18px; margin: 28px 0 8px; }
.legal p { color: var(--ink-2); max-width: 72ch; }
.legal a { color: var(--brand-dark); }
.legal code { font-family: var(--mono); font-size: .9em; color: var(--ink); }
.legal-note { margin-top: 26px; border-left: 3px solid var(--warn); padding-left: 12px; font-size: 13px; }
.site-footer { max-width: 1120px; margin: 0 auto; padding: 20px 24px 32px; border-top: 1px solid var(--line); color: var(--ink-3); display: flex; justify-content: space-between; align-items: center; gap: 14px; font-size: 12.5px; }
.site-footer nav { display: flex; gap: 14px; }
.footer-link { border: 0; padding: 0; background: transparent; color: var(--ink-3); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.footer-link:hover { color: var(--brand-dark); }
.cookie-banner { position: fixed; z-index: 70; left: 18px; right: 18px; bottom: 18px; max-width: 850px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(15,23,42,.18); }
.cookie-banner strong { font-size: 14px; }
.cookie-banner p { font-size: 12.5px; color: var(--ink-3); margin-top: 3px !important; }
.cookie-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; flex: none; }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero h1 { font-size: 32px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .upload-row { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .evrow { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: repeat(3, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  main { padding: 20px 14px 56px; }
  .topbar { padding: 12px 14px; }
  .cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .hero h1 { font-size: 27px; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .funnel-row { grid-template-columns: 1fr; }
  .funnel-step:not(:last-child)::after { content: '↓'; right: 12px; top: auto; bottom: -15px; }
  .cookie-banner, .site-footer { align-items: flex-start; flex-direction: column; }
  .cookie-actions { justify-content: flex-start; }
}
