:root {
  --btb-navy: #0b1f3a;
  --btb-navy-2: #13315c;
  --btb-teal: #0fb5a6;
  --btb-teal-hover: #0c9488;
  --btb-teal-light: #e6f7f5;
  --btb-text: #334155;
  --btb-text-secondary: #475569;
  --btb-text-muted: #64748b;
  --btb-text-quiet: #94a3b8;
  --btb-border-strong: #cbd5e1;
  --btb-border: #edf1f7;
  --btb-white: #ffffff;
  --btb-surface: #f6f8fb;
  --btb-warning: #f5a524;
  --btb-warning-bg: #fef3e0;
  --btb-danger: #b42318;
  --btb-danger-bg: #fef3f2;
  --btb-radius-card: 18px;
  --btb-radius-button: 10px;
  --btb-radius-pill: 999px;
  --btb-shadow-card: 0 10px 32px rgb(11 31 58 / 6%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--btb-surface); color: var(--btb-text); font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--btb-teal-hover); text-underline-offset: .2em; }
a:hover { color: var(--btb-navy-2); }
main { width: min(100% - 2rem, 1120px); margin: auto; padding: clamp(1.5rem, 4vw, 3.5rem) 0 4rem; }
h1, h2, h3 { color: var(--btb-navy); letter-spacing: -.025em; }
h1 { margin: .15em 0; font-size: clamp(2.15rem, 5vw, 3.75rem); line-height: 1.04; }
h2 { margin: 0 0 1rem; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.2; }
h3 { margin: 1.75rem 0 .75rem; }
p { margin: .65rem 0 1rem; }

.site-header { display: flex; justify-content: space-between; align-items: center; min-height: 76px; padding: .85rem max(1rem, calc((100vw - 1120px) / 2)); background: var(--btb-white); border-bottom: 1px solid var(--btb-border); box-shadow: 0 1px 8px rgb(11 31 58 / 4%); }
.brand-lockup { display: flex; align-items: center; gap: .85rem; color: var(--btb-navy); text-decoration: none; }
.brand-lockup strong { display: grid; place-items: center; width: 54px; height: 42px; color: var(--btb-white); background: var(--btb-navy); border-radius: 9px; font-size: 1.12rem; letter-spacing: .06em; box-shadow: inset 0 -4px 0 var(--btb-teal); }
.brand-lockup span { font-weight: 750; letter-spacing: -.01em; }
.header-context { display: flex; flex-direction: column; align-items: flex-end; color: var(--btb-navy); font-size: .9rem; }
.header-context span { color: var(--btb-text-muted); font-size: .78rem; }
.header-context span::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: .4rem; background: var(--btb-teal); border-radius: 50%; }

.hero { max-width: 760px; padding: clamp(3rem, 9vh, 6rem) 0; }
.hero .lead { max-width: 680px; color: var(--btb-text-secondary); font-size: clamp(1.12rem, 2.5vw, 1.42rem); }
.hero .notice { margin: 2rem 0; }
.hero-action button { min-width: 220px; }
.eyebrow, .step { margin-bottom: .55rem; color: var(--btb-navy-2); font-size: .73rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.language-switch { display: flex; justify-content: flex-end; gap: .25rem; width: max-content; margin-left: auto; padding: .25rem; background: var(--btb-white); border: 1px solid var(--btb-border); border-radius: var(--btb-radius-pill); box-shadow: 0 4px 16px rgb(11 31 58 / 5%); }
.language-switch a { min-height: 40px; padding: .5rem .9rem; border-radius: var(--btb-radius-pill); color: var(--btb-text-muted); font-size: .88rem; font-weight: 750; text-decoration: none; }
.language-switch a[aria-current="page"] { color: var(--btb-navy); background: var(--btb-teal-light); box-shadow: inset 0 0 0 1px rgb(15 181 166 / 18%); }

.card, .validation, .notice, .warning { margin: 1rem 0; padding: clamp(1.25rem, 3vw, 2rem); background: var(--btb-white); border: 1px solid var(--btb-border); border-radius: var(--btb-radius-card); box-shadow: var(--btb-shadow-card); }
.notice { color: var(--btb-navy-2); background: var(--btb-teal-light); border: 0; border-left: 4px solid var(--btb-teal); border-radius: 0 var(--btb-radius-card) var(--btb-radius-card) 0; box-shadow: none; }
.warning { color: #7a4b00; background: var(--btb-warning-bg); border-color: rgb(245 165 36 / 35%); border-left: 4px solid var(--btb-warning); border-radius: 0 var(--btb-radius-card) var(--btb-radius-card) 0; box-shadow: none; }
.validation { background: var(--btb-danger-bg); border-color: rgb(180 35 24 / 18%); box-shadow: none; }
.validation h2 { font-size: 1.2rem; }
.issue { margin: .5rem 0; padding: .65rem .75rem; color: var(--btb-text); background: var(--btb-white); border-left: 3px solid var(--btb-warning); border-radius: 6px; }
.issue.block_submit { border-left-color: var(--btb-danger); }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-bottom: 1.5rem; }
.page-head h1 { max-width: 780px; }
.badge, .status { display: inline-flex; align-items: center; gap: .35rem; width: fit-content; padding: .38rem .7rem; color: var(--btb-navy-2); background: var(--btb-teal-light); border: 1px solid rgb(15 181 166 / 16%); border-radius: var(--btb-radius-pill); font-size: .75rem; font-weight: 800; letter-spacing: .02em; }
.autosave-badge { color: var(--btb-text-muted); background: var(--btb-white); border-color: var(--btb-border); white-space: nowrap; }
.autosave-badge::before { content: ""; width: 7px; height: 7px; background: var(--btb-teal); border-radius: 50%; }
.status-note { display: block; margin-top: .35rem; color: var(--btb-warning); font-weight: 700; }

.grid { display: grid; gap: 1.1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: .42rem; color: var(--btb-text); font-size: .92rem; font-weight: 650; }
input, select, textarea, button, .button { min-height: 46px; padding: .7rem .82rem; color: var(--btb-text); background: var(--btb-white); border: 1px solid var(--btb-border-strong); border-radius: var(--btb-radius-button); font: inherit; }
input::placeholder, textarea::placeholder { color: var(--btb-text-quiet); }
textarea { min-height: 104px; resize: vertical; }
input:disabled { color: var(--btb-text-muted); background: var(--btb-surface); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgb(15 181 166 / 30%); outline-offset: 2px; border-color: var(--btb-teal); }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--btb-danger); background: var(--btb-danger-bg); }
button, .button { cursor: pointer; color: var(--btb-navy); font-weight: 750; text-decoration: none; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
button:hover, .button:hover { border-color: var(--btb-navy-2); }
button:disabled { cursor: not-allowed; }
.primary { color: var(--btb-white); background: var(--btb-teal); border-color: var(--btb-teal); box-shadow: 0 7px 18px rgb(15 181 166 / 18%); }
.primary:hover { color: var(--btb-white); background: var(--btb-teal-hover); border-color: var(--btb-teal-hover); }
.secondary { color: var(--btb-navy); background: var(--btb-white); border-color: var(--btb-border-strong); }
.large { width: 100%; min-height: 54px; font-size: 1.05rem; }
.help { color: var(--btb-text-muted); font-size: .93rem; }
fieldset { margin: 1.5rem 0 0; padding: 1rem; border: 1px solid var(--btb-border); border-radius: 14px; }
legend { padding: 0 .35rem; color: var(--btb-navy); font-weight: 750; }
.checks { display: flex; flex-wrap: wrap; gap: .7rem 1.1rem; }
.checks label { flex-direction: row; align-items: flex-start; font-weight: 550; }
.checks input { min-height: auto; accent-color: var(--btb-teal); }
.stacked { flex-direction: column; }
.plate { text-transform: uppercase; }

.input-unit { display: flex; overflow: hidden; background: var(--btb-white); border: 1px solid var(--btb-border-strong); border-radius: var(--btb-radius-button); }
.input-unit:focus-within { outline: 3px solid rgb(15 181 166 / 30%); border-color: var(--btb-teal); }
.input-unit input { width: 100%; min-width: 0; border: 0; border-radius: 0; outline: 0; }
.input-unit > span { display: grid; place-items: center; min-width: 46px; padding: 0 .7rem; color: var(--btb-text-muted); background: var(--btb-surface); border-left: 1px solid var(--btb-border); font-size: .85rem; font-weight: 800; }
.total { display: flex; align-items: baseline; gap: .4rem; margin: 1.5rem 0; color: var(--btb-navy); font-weight: 750; }
.total output { color: var(--btb-teal-hover); font-size: 1.75rem; }
.total > span { color: var(--btb-text-muted); }

.stepper { --progress: 16.667%; position: sticky; top: 0; z-index: 4; margin-bottom: 1.25rem; padding: .8rem; background: rgb(246 248 251 / 96%); border: 1px solid var(--btb-border); border-radius: 16px; backdrop-filter: blur(10px); }
.stepper ol { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .35rem; margin: 0; padding: 0; list-style: none; }
.stepper li { min-width: 0; }
.stepper button { display: flex; align-items: center; gap: .55rem; width: 100%; min-height: 58px; padding: .5rem; text-align: left; background: transparent; border-color: transparent; }
.stepper button:hover:not(:disabled) { background: var(--btb-white); border-color: var(--btb-border); }
.stepper button.active { color: var(--btb-navy); background: var(--btb-teal-light); border-color: rgb(15 181 166 / 24%); }
.stepper button.complete { color: var(--btb-navy-2); }
.stepper button:disabled { color: var(--btb-text-quiet); opacity: 1; }
.step-marker { display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; color: var(--btb-text-muted); background: var(--btb-white); border: 1px solid var(--btb-border-strong); border-radius: 50%; font-size: .78rem; font-weight: 850; }
.active .step-marker { color: var(--btb-white); background: var(--btb-teal); border-color: var(--btb-teal); box-shadow: 0 0 0 4px rgb(15 181 166 / 12%); }
.complete .step-marker { color: transparent; background: var(--btb-teal-light); border-color: var(--btb-teal); }
.complete .step-marker::after { content: "✓"; color: var(--btb-teal-hover); font-size: .9rem; }
.step-copy { display: flex; min-width: 0; flex-direction: column; }
.step-copy strong { overflow: hidden; font-size: .75rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.step-copy small { color: var(--btb-text-quiet); font-size: .66rem; }
.wizard-step { min-height: 420px; border-top: 4px solid var(--btb-teal); box-shadow: 0 14px 40px rgb(11 31 58 / 7%); }
.wizard-step[hidden], #submit-form[hidden] { display: none; }
.wizard-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.wizard-actions button { min-width: 132px; }
.field-error { margin: auto; color: var(--btb-danger); font-size: .88rem; font-weight: 700; }
.save-state { display: inline-flex; align-items: center; gap: .4rem; min-height: 30px; margin: .75rem 0 0; padding: .25rem .65rem; color: var(--btb-text-muted); background: var(--btb-teal-light); border-radius: var(--btb-radius-pill); font-size: .76rem; font-weight: 700; }
.save-state::before { content: "✓"; color: var(--btb-teal-hover); }

.save-state[data-state="saving"]::before { content: "…"; color: var(--btb-text-muted); }
.save-state[data-state="error"] { color: var(--btb-danger); background: var(--btb-danger-bg); }
.save-state[data-state="error"]::before { content: "!"; color: var(--btb-danger); }
[hidden] { display: none !important; }
.empty-state { display: flex; align-items: center; gap: 1rem; min-height: 120px; margin-top: 1.25rem; padding: 1.25rem; color: var(--btb-navy-2); background: linear-gradient(90deg, var(--btb-teal-light), var(--btb-surface)); border: 1px dashed rgb(15 181 166 / 40%); border-radius: 14px; }
.empty-state-icon { display: grid; place-items: center; flex: 0 0 46px; height: 46px; color: var(--btb-teal-hover); background: var(--btb-white); border-radius: 50%; font-size: 1.4rem; }
.axles { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 1rem; }
.axle { position: relative; margin-top: 1rem; padding: 1rem; background: var(--btb-surface); border-color: var(--btb-border); }
.axle legend { display: flex; align-items: center; gap: .65rem; background: var(--btb-white); border-radius: var(--btb-radius-button); }
.axle legend > span:last-child { display: flex; flex-direction: column; }
.axle legend strong { line-height: 1.2; }
.axle legend small { color: var(--btb-text-muted); font-size: .7rem; font-weight: 650; text-transform: uppercase; }
.axle-number { display: grid; place-items: center; flex: 0 0 30px; height: 30px; color: var(--btb-white); background: var(--btb-navy); border-radius: 50%; font-size: .76rem; font-weight: 850; }
.axle-options { display: grid; gap: .85rem; }
.axle-options > label:not(:has(select)) { flex-direction: row; align-items: center; }
.distances { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--btb-border); }
.axle-loads { margin-bottom: 1rem; }
.axle-load-card { padding: .85rem; background: var(--btb-surface); border: 1px solid var(--btb-border); border-radius: 14px; }
.axle-load-label { display: flex; align-items: center; gap: .55rem; }

.document-group { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--btb-border); }
.upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: end; margin: .7rem 0; padding: .9rem; background: var(--btb-surface); border: 1px solid var(--btb-border); border-radius: 14px; }
.upload input[type="file"] { width: 100%; padding: .5rem; background: var(--btb-white); }
.upload button { color: var(--btb-teal-hover); background: var(--btb-white); border-color: var(--btb-teal); }
.docs { display: flex; flex-wrap: wrap; gap: .6rem; }
.docs.card { display: block; }
.file-chip { display: inline-flex; align-items: center; gap: .45rem; max-width: 100%; padding: .5rem .75rem; color: var(--btb-navy-2); background: var(--btb-teal-light); border: 1px solid rgb(15 181 166 / 16%); border-radius: var(--btb-radius-button); overflow-wrap: anywhere; text-decoration: none; }
.file-chip::before { content: "✓"; color: var(--btb-teal-hover); font-weight: 900; }
.docs.card .file-chip { margin: .25rem; }

.review-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.review-summary article { padding: 1rem; background: var(--btb-surface); border: 1px solid var(--btb-border); border-left: 4px solid var(--btb-teal); border-radius: 0 14px 14px 0; }
.review-summary h3 { margin: 0; font-size: 1rem; }
.review-summary p { margin-bottom: 0; color: var(--btb-text-muted); overflow-wrap: anywhere; }

.admin-shell main { width: min(100% - 2rem, 1280px); }
.admin-shell h1 { font-size: clamp(2rem, 4vw, 3rem); }
.admin-shell .card { padding: clamp(1rem, 2vw, 1.5rem); }
.auth { max-width: 460px; margin: 8vh auto; border-top: 4px solid var(--btb-teal); }
.auth::before { content: "BTB OPERATIONS"; color: var(--btb-teal-hover); font-size: .7rem; font-weight: 850; letter-spacing: .14em; }
.auth form { display: grid; gap: 1rem; }
.filters { display: flex; align-items: end; gap: .75rem; padding: 1rem; }
.filters label:first-child { flex: 1; }
.table-wrap{overflow:auto; background: var(--btb-white); border: 1px solid var(--btb-border); border-radius: var(--btb-radius-card); box-shadow: var(--btb-shadow-card); }
table { width: 100%; min-width: 900px; border-collapse: collapse; }
th, td { padding: .8rem; border-bottom: 1px solid var(--btb-border); text-align: left; vertical-align: top; }
th { color: var(--btb-text-muted); background: var(--btb-surface); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:hover { background: rgb(230 247 245 / 35%); }
tbody tr:last-child td { border-bottom: 0; }
.tabs { display: flex; gap: .3rem; overflow: auto; position: sticky; top: 0; z-index: 3; margin: 0 0 1rem; padding: .45rem; background: rgb(255 255 255 / 96%); border: 1px solid var(--btb-border); border-radius: 12px; }
.tabs a { padding: .45rem .65rem; color: var(--btb-text-secondary); border-radius: 8px; font-size: .82rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--btb-navy); background: var(--btb-teal-light); }
.review-row { display: grid; grid-template-columns: 2fr 1fr 2fr auto; gap: .6rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--btb-border); }
.action-box { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--btb-border); }
.transfer-grid { display: grid; grid-template-columns: minmax(150px, 1fr) 3fr; gap: .45rem 1rem; }
.transfer-grid > span { padding: .55rem 0; color: var(--btb-text-secondary); font-weight: 700; }
copy-field { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .35rem; background: var(--btb-surface); border: 1px solid var(--btb-border); border-radius: 8px; }
copy-field code { color: var(--btb-navy-2); overflow-wrap: anywhere; }
copy-field label { flex-direction: row; align-items: center; font-size: .75rem; }
.summary { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.25rem; }
.summary dt { color: var(--btb-text-muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.summary dd { margin: 0; color: var(--btb-navy); font-weight: 650; }
.timeline { padding-left: 1.4rem; }
.timeline li { padding: 0 0 1rem .5rem; }
.timeline time { display: block; color: var(--btb-text-muted); font-size: .78rem; }

@media(max-width:900px) {
  .step-copy strong { font-size: .68rem; }
  .step-copy small { display: none; }
  .review-row { grid-template-columns: 1fr 1fr; }
  .review-row strong { grid-column: 1 / -1; }
}

@media(max-width:700px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .page-head { flex-direction: column; gap: .75rem; }
  .filters { align-items: stretch; flex-direction: column; }
  .upload { grid-template-columns: 1fr; }
  .review-summary { grid-template-columns: 1fr; }
  .transfer-grid { grid-template-columns: 1fr; }
  .transfer-grid > span { padding-top: 1rem; }
  copy-field { grid-template-columns: 1fr auto; }
  .review-row { grid-template-columns: 1fr; }
  .review-row strong { grid-column: auto; }
  table { min-width: 0; }
  thead { display: none; }
  tbody, tr, td { display: block; }
  tbody { padding: .5rem; }
  tr { margin: .5rem; padding: .65rem; border: 1px solid var(--btb-border); border-radius: 12px; }
  td { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem; border: 0; text-align: right; overflow-wrap: anywhere; }
  td::before { content: attr(data-label); color: var(--btb-text-muted); font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
  td[colspan] { display: block; text-align: left; }
  td[colspan]::before { content: none; }
}

@media(max-width:600px) {
  main { width: min(100% - 1.25rem, 1120px); padding-top: 1.25rem; }
  .site-header { min-height: 64px; padding: .65rem .75rem; }
  .brand-lockup { gap: .55rem; }
  .brand-lockup strong { width: 44px; height: 36px; font-size: .95rem; }
  .brand-lockup span { max-width: 110px; font-size: .76rem; line-height: 1.15; }
  .header-context strong { font-size: .75rem; }
  .header-context span { font-size: .65rem; }
  .hero { padding: 2.5rem 0; }
  .hero-action button { width: 100%; }
  .language-switch { width: 100%; justify-content: stretch; }
  .language-switch a { flex: 1; text-align: center; }
  .card { padding: 1.15rem; }
  .stepper { position: relative; margin-inline: 0; padding: .75rem .75rem 1.15rem; overflow: hidden; }
  .stepper::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 4px; background: linear-gradient(to right, var(--btb-teal) 0 var(--progress), var(--btb-border) var(--progress) 100%); }
  .stepper ol { display: block; }
  .stepper li { display: none; }
  .stepper li:has(button.active) { display: block; }
  .stepper button { min-height: 50px; padding: .25rem; }
  .step-copy strong { font-size: .9rem; white-space: normal; }
  .step-copy small { display: block; }
  .wizard-step { min-height: 0; }
  .wizard-actions { position: sticky; bottom: 0; z-index: 3; margin-inline: -.65rem; padding: .75rem .65rem; background: rgb(246 248 251 / 96%); border-top: 1px solid var(--btb-border); backdrop-filter: blur(10px); }
  .wizard-actions button { min-width: 0; }
  .field-error { font-size: .78rem; text-align: center; }
  .axles { grid-template-columns: 1fr; }
  .tabs { margin-inline: -.35rem; }
  .admin-page-head form, .admin-page-head button { width: 100%; }
}

@media(max-width:390px) {
  h1 { font-size: 2rem; }
  .header-context strong { display: none; }
  .wizard-actions { gap: .5rem; }
  .wizard-actions button { padding-inline: .65rem; }
  .total { flex-wrap: wrap; }
  copy-field { grid-template-columns: 1fr; }
  copy-field button { width: 100%; }
}
