:root {
  --bfm-green: #1f4d3a;
  --bfm-green-dark: #163a2b;
  --bfm-amber: #c68a2e;
  --bfm-bg: #f3f5f4;
  --bfm-border: #dde3e0;
  --bs-primary: #1f4d3a;
  --bs-primary-rgb: 31, 77, 58;
  --bs-link-color: #1f4d3a;
  --bs-link-color-rgb: 31, 77, 58;
  --bs-link-hover-color: #163a2b;
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-bg: var(--bfm-bg);
}

.btn-primary {
  --bs-btn-bg: #1f4d3a; --bs-btn-border-color: #1f4d3a;
  --bs-btn-hover-bg: #163a2b; --bs-btn-hover-border-color: #163a2b;
  --bs-btn-active-bg: #11301f; --bs-btn-active-border-color: #11301f;
  --bs-btn-disabled-bg: #1f4d3a; --bs-btn-disabled-border-color: #1f4d3a;
  --bs-btn-focus-shadow-rgb: 31, 77, 58;
}
.btn-outline-primary {
  --bs-btn-color: #1f4d3a; --bs-btn-border-color: #1f4d3a;
  --bs-btn-hover-bg: #1f4d3a; --bs-btn-hover-border-color: #1f4d3a;
  --bs-btn-active-bg: #163a2b; --bs-btn-active-border-color: #163a2b;
}
.text-bg-primary { background-color: #1f4d3a !important; }
.form-check-input:checked { background-color: #1f4d3a; border-color: #1f4d3a; }
.form-control:focus, .form-select:focus { border-color: #4f8a6f; box-shadow: 0 0 0 .2rem rgba(31, 77, 58, .18); }
:focus-visible { outline: 3px solid var(--bfm-amber); outline-offset: 2px; }

body { min-height: 100vh; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 3000; background: #fff; padding: .5rem 1rem; }
.skip-link:focus { left: .5rem; top: .5rem; }

/* ---------- Admin shell ---------- */
.bfm-shell { display: flex; min-height: 100vh; }
.bfm-sidebar { width: 16rem; flex-shrink: 0; background: var(--bfm-green-dark); color: #dbe7e0; }
.bfm-sidebar .brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.25rem; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .01em; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.bfm-sidebar .brand i { color: var(--bfm-amber); font-size: 1.5rem; }
.bfm-sidebar .nav-heading { padding: 1.1rem 1.25rem .35rem; font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; color: #8fb3a1; }
.bfm-sidebar .nav-link { display: flex; align-items: center; gap: .7rem; padding: .55rem 1.25rem; color: #dbe7e0; border-left: 3px solid transparent; border-radius: 0; }
.bfm-sidebar .nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.bfm-sidebar .nav-link.active { background: rgba(255, 255, 255, .12); color: #fff; border-left-color: var(--bfm-amber); }
.bfm-sidebar .nav-link .badge { margin-left: auto; }
.bfm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bfm-topbar { background: #fff; border-bottom: 1px solid var(--bfm-border); padding: .6rem 1.25rem; display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 1020; }
.bfm-content { padding: 1.5rem; flex: 1; }
.bfm-footer { padding: 1rem 1.5rem; color: #6c757d; font-size: .8rem; }
@media (min-width: 992px) { .bfm-sidebar-offcanvas { position: sticky; top: 0; height: 100vh; overflow-y: auto; } }
@media (max-width: 991.98px) {
  .bfm-content { padding: 1rem; }
  .offcanvas.bfm-sidebar { width: 17rem; }
}

.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head .sub { color: #6c757d; margin: .15rem 0 0; }

.card { border-color: var(--bfm-border); box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.card-header { background: #fff; font-weight: 600; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-card .icon { font-size: 1.6rem; color: var(--bfm-green); opacity: .85; }
.table > :not(caption) > * > * { padding: .65rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #5b6b63; background: #f8faf9; white-space: nowrap; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.filters .form-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #5b6b63; margin-bottom: .2rem; }
.required::after { content: " *"; color: #b02a37; }
.empty { text-align: center; padding: 2.5rem 1rem; color: #6c757d; }
.empty i { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .6; }

/* Trip progress */
.trip-steps { display: flex; gap: .25rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.trip-steps li { flex: 1 1 6.5rem; text-align: center; font-size: .72rem; padding: .45rem .25rem; background: #e9eeeb; color: #5b6b63; border-radius: .35rem; position: relative; }
.trip-steps li.done { background: #cfe4d8; color: #1f4d3a; }
.trip-steps li.current { background: var(--bfm-green); color: #fff; font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .5rem 0 .5rem 1.1rem; border-left: 2px solid var(--bfm-border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .85rem; width: 10px; height: 10px; border-radius: 50%; background: var(--bfm-green); }
.doc-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .35rem; border: 1px solid var(--bfm-border); background: #fff; }

/* ---------- Auth and install ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(160deg, #163a2b 0%, #1f4d3a 55%, #2d6a4f 100%); }
.auth-card { width: 100%; max-width: 27rem; }
.auth-card .brand-mark { color: var(--bfm-amber); font-size: 2.4rem; }
.install-card { max-width: 46rem; }
.stepper { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.25rem; }
.stepper li { flex: 1; text-align: center; font-size: .78rem; padding: .5rem .25rem; border-radius: .35rem; background: #e9eeeb; color: #5b6b63; }
.stepper li.active { background: var(--bfm-green); color: #fff; font-weight: 600; }
.stepper li.done { background: #cfe4d8; color: #1f4d3a; }

/* ---------- Driver portal ---------- */
.drv-body { padding-bottom: 5rem; }
.drv-top { background: var(--bfm-green-dark); color: #fff; padding: .8rem 1rem; display: flex; align-items: center; gap: .6rem; position: sticky; top: 0; z-index: 1020; }
.drv-top i.brand { color: var(--bfm-amber); font-size: 1.4rem; }
.drv-wrap { max-width: 44rem; margin: 0 auto; padding: 1rem; }
.drv-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--bfm-border); display: flex; z-index: 1030; padding-bottom: env(safe-area-inset-bottom); }
.drv-nav a { flex: 1; text-align: center; padding: .6rem .25rem .5rem; color: #5b6b63; text-decoration: none; font-size: .75rem; }
.drv-nav a i { display: block; font-size: 1.35rem; }
.drv-nav a.active { color: var(--bfm-green); font-weight: 600; }
.trip-card { display: block; text-decoration: none; color: inherit; }
.trip-card:hover { border-color: var(--bfm-green); }
.btn-xl { padding: .9rem 1rem; font-size: 1.1rem; font-weight: 600; }

/* ---------- Printable documents ---------- */
.doc-page { max-width: 52rem; margin: 1.5rem auto; background: #fff; padding: 2.25rem; border: 1px solid var(--bfm-border); }
.doc-page h1 { font-size: 1.6rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bfm-green); }
.doc-meta dt { font-weight: 600; color: #5b6b63; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.doc-meta dd { margin-bottom: .6rem; }
.doc-totals td { padding: .25rem .5rem; }
@media print {
  body { background: #fff !important; }
  .no-print, .bfm-sidebar, .bfm-topbar, .bfm-footer, .drv-nav { display: none !important; }
  .doc-page { border: 0; margin: 0; padding: 0; max-width: none; }
  .bfm-content { padding: 0 !important; }
  a { color: inherit !important; text-decoration: none !important; }
}
