/* Brucon Console: phone first, plain and sturdy. No inline styles anywhere (the Content-Security-Policy forbids them). */
:root {
  --ink: #1f2933; --ink2: #3e4c59; --muted: #62707d; --line: #d9dee3; --bg: #f2f3f5; --card: #fff;
  --accent: #e8730c; --accent-dark: #c25f06; --blue: #1f6fd1; --green: #1d8348; --red: #b83227; --amber: #b9770e;
  --planned: #5f6c7b; --inprocess: #1f6fd1; --completed: #1d8348; --cancelled: #a33;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
h1, h2, h3 { line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 14px 0 6px; }
a { color: var(--blue); }
[hidden] { display: none !important; }

/* header */
header { display: flex; align-items: center; gap: 14px; background: var(--ink); color: #fff; padding: 0 16px; min-height: 52px; position: sticky; top: 0; z-index: 20; }
.brand { margin: 0; font-size: 1.1rem; white-space: nowrap; }
.brand a { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand .logo { display: block; height: 36px; width: auto; background: #fff; padding: 3px 7px; border-radius: 6px; }  /* black lettering needs a white tile on the dark bar */
header nav { display: flex; align-items: center; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
header nav::-webkit-scrollbar { display: none; }
header nav a { color: #cbd2d9; text-decoration: none; padding: 15px 10px; white-space: nowrap; border-bottom: 3px solid transparent; }
header nav a:hover { color: #fff; }
header nav a.current { color: #fff; border-bottom-color: var(--accent); }
.usermenu { display: flex; gap: 4px; margin-left: 10px; padding-left: 10px; border-left: 1px solid #52606d; }
.usermenu a { padding: 15px 8px; font-size: .92rem; }

/* layout */
.wrap { max-width: 1280px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card > h2:first-child { margin-top: 0; }
.hint { color: var(--muted); font-size: .92rem; }
.msg { padding: 10px 12px; border-radius: 8px; background: #e6f4ea; color: #14532d; margin-bottom: 12px; }
.msg.bad, .authmsg { background: #fdecea; color: #7a1c14; }
.authmsg { padding: 0; background: none; min-height: 1.4em; margin-top: 10px; }
.authmsg.ok { color: var(--green); }
.warnbox { padding: 10px 12px; border-radius: 8px; background: #fff4e0; color: #7a4a05; border: 1px solid #f0cf94; margin-bottom: 12px; }
.empty { color: var(--muted); padding: 14px 0; }
#toast { position: sticky; top: 52px; z-index: 15; margin: 8px 12px 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1 1 auto; }
.toolbar select { width: auto; min-width: 12em; }
.chip.far { margin-left: 6px; }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .cols2 { grid-template-columns: minmax(0, 1fr); } }

/* forms and buttons */
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: .95rem; }
input, select, textarea { width: 100%; padding: 10px; font: inherit; border: 1px solid #b6bec6; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid #9ec5f5; outline-offset: 1px; }
input[type=checkbox] { width: auto; margin-right: 8px; transform: scale(1.2); }
label.check { display: flex; align-items: center; font-weight: 600; }
textarea { resize: vertical; min-height: 70px; }
button, .btn { display: inline-block; padding: 10px 16px; font: inherit; font-weight: 700; color: #fff; background: var(--accent); border: 0; border-radius: 8px; cursor: pointer; text-decoration: none; text-align: center; }
button:hover, .btn:hover { background: var(--accent-dark); }
button:disabled { opacity: .55; cursor: default; }
button.secondary, .btn.secondary { background: #e4e7eb; color: var(--ink); }
button.secondary:hover { background: #d3d8dd; }
button.danger { background: var(--red); }
button.small, .btn.small { padding: 5px 10px; font-size: .88rem; }
button.link { background: none; color: var(--blue); padding: 2px 4px; font-weight: 600; text-decoration: underline; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; gap: 0; } }
.datenav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.datenav input[type=date] { width: auto; }
.datenav .daylabel { font-weight: 700; min-width: 8.5em; text-align: center; }

/* dialogs */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 10px 40px rgba(0, 0, 0, .35); color: var(--ink); }
dialog::backdrop { background: rgba(20, 26, 33, .55); }
dialog form, dialog .dlgbody { padding: 18px; }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
dialog h2 { margin-top: 0; }
.dlgactions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.dlgerr { margin-top: 10px; color: #7a1c14; font-weight: 600; min-height: 1.2em; }

/* tables */
.scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.grid th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 2px solid var(--line); padding: 8px 6px; white-space: nowrap; }
table.grid td { border-bottom: 1px solid var(--line); padding: 8px 6px; vertical-align: top; }
table.grid tr.off td { color: #8a949e; }
table.grid td select { width: auto; min-width: 7.5em; max-width: 11em; padding: 6px 6px; }
td.acts { min-width: 120px; }
#people td select, #equipment td select { max-width: none; }  /* Crews and Team pick lists have room, so long job names are not cut off */
td.acts button { margin: 0 2px 4px 0; }  /* the buttons wrap onto a second line instead of running off the right edge */
.sub { color: var(--muted); font-size: .85rem; }

/* chips */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; color: #fff; background: var(--planned); white-space: nowrap; }
.chip.planned { background: var(--planned); }
.chip.in_process { background: var(--inprocess); }
.chip.completed { background: var(--completed); }
.chip.cancelled { background: var(--cancelled); }
.chip.warn { background: var(--amber); }
.chip.kind { background: #e4e7eb; color: var(--ink2); }
.chip.kind.equipment { background: #fde8d0; color: #8a4205; }
.chip.kind.dirt_aggregate { background: #e8e0d2; color: #5b4a2a; }
.chip.kind.material { background: #dbe8f7; color: #1d4577; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.stat { background: #f2f3f5; border-radius: 8px; padding: 6px 12px; font-size: .9rem; }
.stat b { font-size: 1.15rem; margin-right: 4px; }

/* sign-in pages */
.authcard { max-width: 420px; margin: 28px auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.authcard .brandline { font-weight: 800; color: var(--accent); margin-bottom: 4px; text-align: center; }
.cardlogo { display: block; width: 230px; max-width: 70%; height: auto; margin: 0 auto 10px; }
.authcard button { width: 100%; margin-top: 18px; padding: 13px; }
.accountwrap { max-width: 480px; margin: 0 auto; padding: 16px; }

/* driver phone page */
.driverwrap { max-width: 640px; margin: 0 auto; padding: 12px; }
.daybar { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.daybar h2 { margin: 0; }
.loadcard { background: var(--card); border: 1px solid var(--line); border-left: 8px solid var(--planned); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.loadcard.in_process { border-left-color: var(--inprocess); }
.loadcard.completed { border-left-color: var(--completed); background: #f6fbf8; }
.loadcard.overdue { border-left-color: var(--red); }
.loadcard .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.loadcard .what { font-size: 1.25rem; font-weight: 800; margin: 6px 0 2px; }
.loadcard .route { margin: 6px 0; }
.loadcard .route b { display: inline-block; min-width: 3.4em; color: var(--muted); font-weight: 600; }
.loadcard .truckline { margin-top: 8px; }
.truckname { font-weight: 800; font-size: 1.15rem; }
.moveline { margin-top: 4px; }
.loadcard .notes { background: #fff8e6; border-radius: 8px; padding: 8px 10px; margin: 8px 0; white-space: pre-wrap; }
.bigbtn { display: block; width: 100%; min-height: 56px; font-size: 1.15rem; margin-top: 8px; border-radius: 12px; }
.bigbtn.go { background: var(--inprocess); }
.bigbtn.done { background: var(--completed); }
.bigbtn.secondary { min-height: 44px; font-size: 1rem; }
.gpsstate { font-size: 1.05rem; text-align: center; padding: 14px 0; }
.sectionhead { font-weight: 800; margin: 18px 0 8px; color: var(--red); }

/* manager boards */
.jobcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.jobcard { background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--accent); border-radius: 10px; padding: 12px; }
.jobcard h3 { margin: 0 0 6px; }
.jobcard ul { margin: 4px 0 8px; padding-left: 18px; }
.jobcard .none { color: var(--muted); }
.maplink { white-space: nowrap; }
.loadwhat { font-weight: 700; }
.events { margin: 8px 0 0; padding-left: 18px; }
.events li { margin-bottom: 4px; }

/* menu down the left side for managers and supervisors on desktops and tablets (phones keep the top bar) */
@media (min-width: 760px) {
  body.sidebar { padding-left: 220px; }
  body.sidebar header { position: fixed; left: 0; top: 0; bottom: 0; width: 220px; flex-direction: column; align-items: stretch; gap: 0; padding: 0; min-height: 0; overflow-y: auto; }
  body.sidebar .brand { padding: 14px 16px 12px; border-bottom: 1px solid #323f4b; }
  body.sidebar .brand a { flex-direction: column; align-items: stretch; gap: 8px; }  /* the logo on top, the words under it */
  body.sidebar .brand .logo { height: auto; width: 100%; padding: 8px 10px; border-radius: 8px; }
  body.sidebar header nav { flex: 1 1 auto; flex-direction: column; align-items: stretch; margin: 0; gap: 0; overflow: visible; }
  body.sidebar header nav a { padding: 11px 18px; border-bottom: 0; border-left: 4px solid transparent; }
  body.sidebar header nav a.current { background: #2b3945; border-left-color: var(--accent); }
  body.sidebar header nav a:hover { background: #2b3945; }
  body.sidebar .usermenu { margin: auto 0 0; padding: 8px 0 12px; border-left: 0; border-top: 1px solid #52606d; flex-direction: column; }
  body.sidebar .usermenu a { padding: 10px 18px; border-left: 0; font-size: .95rem; }
  body.sidebar #toast { top: 8px; margin: 8px 16px 0; }
}

/* phones, managers and supervisors: the logo bar on top and the menu on its own row below it, not squeezed beside the logo */
@media (max-width: 759px) {
  body.sidebar header { flex-wrap: wrap; gap: 0; padding: 0; }
  body.sidebar .brand { flex: 1 1 100%; padding: 8px 14px; }
  body.sidebar header nav { flex: 1 1 100%; margin-left: 0; padding: 0 6px; border-top: 1px solid #323f4b; }
}

/* who reports to whom (Team page) */
.tree ul { list-style: none; margin: 4px 0 4px 6px; padding-left: 16px; border-left: 2px solid var(--line); }
.tree > ul { border-left: 0; padding-left: 0; margin-left: 0; }
.tree li { margin: 4px 0; }
.tree .boss { font-weight: 800; }
.tree .group { margin-top: 12px; font-weight: 700; color: var(--red); }

/* rental equipment */
.chip.rental { background: #6b4aa8; }
.chip.returned { background: #6c757d; }

/* hauls: several loads on one trip */
.haulbox { border: 2px solid var(--accent); border-radius: 14px; padding: 10px; margin-bottom: 12px; background: #f4f8fd; }
.haulbox .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 2px 4px; }
.haulbox .haulname { font-size: 1.1rem; }
.haulbox .loadcard { margin: 10px 0 0; }
.haulbox > .route, .haulbox > .hint { padding: 0 4px; }
.combinebtn { margin: 0 0 12px; }
.pick { display: flex; align-items: flex-start; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.pick input { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.haultag { margin-left: 6px; }

/* truck GPS dialogs */
.kv { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv b { min-width: 8em; color: var(--muted); font-weight: 600; }
.kv.big { font-size: 1.2rem; font-weight: 800; border-bottom: 0; }
.trailsvg { display: block; width: 100%; height: auto; max-height: 340px; margin: 8px 0; }
.trailtable { max-height: 300px; overflow: auto; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }
.dot.start { background: #1d8348; }
.dot.end { background: #b83227; }
.trailmap { height: 380px; border-radius: 8px; border: 1px solid var(--line); margin: 8px 0; z-index: 0; }

/* reports: the filter row, and what a printed page (or "Save as PDF") keeps */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5em, 1fr)); gap: 0 12px; align-items: end; }
.reportbtns { margin: 14px 0 0; }
#rTable td:first-child { white-space: nowrap; }  /* a date must not break at its hyphens */

/* truck inspection reports: the checklist dialog, the trucks card on the driver's phone, and a single printed report */
.inspectdlg { max-width: 760px; }
.checklist { border: 1px solid var(--line); border-radius: 10px; margin: 14px 0 0; padding: 8px 10px 12px; }
.checklist legend { font-weight: 800; padding: 0 6px; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15em, 1fr)); gap: 6px; }
.checkgrid .pick { min-height: 46px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }
.checkgrid .pick:has(input:checked) { border-color: var(--red); background: #fdecea; font-weight: 700; }
.checkgrid .pick input { flex: none; }
.inssummary { margin: 12px 0 4px; font-weight: 700; color: var(--green); }
.inssummary.bad { color: var(--red); }
.certify { margin: 14px 0 6px; align-items: flex-start; }
.trucksec .truckbox { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.trucksec .truckbox .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.trucksec .bigbtn { margin-top: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(12em, 1fr)); gap: 10px 16px; margin: 10px 0; }
.pre { white-space: pre-wrap; margin: 4px 0 10px; }
.certform { max-width: 36em; }
@media print { body.print-detail .listcard { display: none !important; } }  /* printing one report: its title stays, the list and the buttons (.noprint) go */
.printonly { display: none; }
@media print {
  header, .noprint, #toast { display: none !important; }
  body, body.sidebar { padding-left: 0; background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; margin: 0; }
  .printonly { display: block; font-size: .85rem; color: #444; margin-bottom: 8px; }
  .scroll { overflow: visible; }
  table.grid { font-size: .78rem; }
  table.grid th, table.grid td { padding: 4px 5px; }
  table.grid tr { break-inside: avoid; }
  table.grid thead { display: table-header-group; }
}

/* trailers, truck classes, problems, saved places and the calendar */
tr.grouprow td { background: #eef1f5; padding: 6px 10px; border-top: 2px solid var(--line); }
.trailersel { margin-top: 4px; }
.timewin { font-weight: 600; }
.linkstat { border: 0; cursor: pointer; font: inherit; color: var(--red); background: #fdecea; }
.problemflag { cursor: pointer; border: 0; font: inherit; }
.problem { border-bottom: 1px solid var(--line); padding: 10px 0; }
.problem .small { margin-top: 6px; }
.problembox { border-radius: 8px; padding: 8px 10px; margin: 8px 0; background: #fdecea; }
.problembox.resolved { background: #f6fbf8; }
.sortrow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sortrow select { margin-left: auto; max-width: 60%; }
.monthgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.monthdow { text-align: center; font-weight: 700; color: var(--muted); padding: 4px 0; font-size: .85rem; }
.daycell { display: flex; flex-direction: column; gap: 2px; min-height: 88px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: inherit; text-decoration: none; overflow: hidden; }
.daycell.blank { border-color: transparent; background: transparent; }
a.daycell:hover { border-color: var(--accent); }
.daycell.today { border: 2px solid var(--accent); }
.daycell.busy { background: #f4f8fd; }
.daycell .dnum { font-weight: 800; }
.daycell .dloads, .daycell .ddrivers { font-size: .85rem; }
.daycell .dloads b { font-size: 1.05rem; }
.daycell .dprob { font-size: .7rem; align-self: flex-start; padding: 1px 6px; }
@media (max-width: 600px) {
  .daycell { min-height: 64px; padding: 3px; }
  .daycell .lbl { display: none; }
  .daycell .dprob { font-size: .6rem; padding: 0 3px; }
}
