:root {
  --navy: #314457; --text: #333335; --orange: #EF7656; --orange-d: #d95f40;
  --cyan: #008FC5; --link: #006E96; --light: #67B7D1; --green: #00A47A;
  --ice: #EFF8FA; --line: #E5EAF0; --muted: #6B7785; --white: #fff;
  --red: #C8413A; --amber: #B7791F; --radius: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--ice); color: var(--text); font-family: Gabarito, system-ui, sans-serif; font-size: 16px; }
h1, h2, h3 { color: var(--navy); margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 17px; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
.eyebrow { text-transform: uppercase; letter-spacing: 1.4px; font-size: 13px; font-weight: 700; color: var(--orange); margin-bottom: 6px; }

/* header */
.top { position: sticky; top: 0; z-index: 40; background: var(--navy); color: #fff; display: flex; align-items: center; gap: 20px;
  padding: env(safe-area-inset-top) 24px 0; min-height: 72px; box-shadow: 0 2px 12px rgba(49,68,87,.18); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; white-space: nowrap; }
.brand .mark { width: 40px; height: 40px; border-radius: 12px; background: var(--orange); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.brand > span:last-child { font-weight: 700; font-size: 19px; line-height: 1.05; }
.brand small { display: block; font-weight: 600; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--light); }
#nav { display: flex; gap: 6px; flex: 1; justify-content: center; }
#nav a { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; padding: 11px 16px; border-radius: 12px;
  white-space: nowrap; font-weight: 600; font-size: 16px; opacity: .85; transition: background .15s, opacity .15s; }
#nav a i { font-size: 15px; color: var(--light); }
#nav a:hover { background: rgba(255,255,255,.08); opacity: 1; }
#nav a.on { background: #fff; color: var(--navy); opacity: 1; }
#nav a.on i { color: var(--orange); }
.badge { background: var(--orange); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; margin-left: 2px; }
.cta { display: none; }
.who { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: #fff; cursor: pointer; white-space: nowrap; font-weight: 600; padding: 6px 10px 6px 6px; border-radius: 12px; }
.who:hover { background: rgba(255,255,255,.08); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--light); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.burger { display: none; position: relative; width: 48px; height: 48px; border: 0; border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; font-size: 22px; cursor: pointer; flex: 0 0 auto; }
.burger .dot { position: absolute; top: 9px; right: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 2px var(--navy); }
.menu { position: fixed; left: 0; right: 0; bottom: 0; top: calc(68px + env(safe-area-inset-top)); z-index: 35; background: rgba(49,68,87,.45); }
.menu-in { background: var(--navy); padding: 8px 16px 20px; border-radius: 0 0 20px 20px; box-shadow: 0 12px 30px rgba(0,0,0,.2); animation: drop .18s ease-out; }
@keyframes drop { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.menu a, .menu-me { display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px; border-radius: 14px; color: #fff; text-decoration: none;
  background: none; border: 0; text-align: left; cursor: pointer; font: inherit; }
.menu a + a { margin-top: 4px; }
.menu a > i:first-child { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--light); flex: 0 0 auto; }
.menu a b, .menu-me b { display: block; font-size: 18px; }
.menu a small, .menu-me small { display: block; font-size: 13px; color: rgba(255,255,255,.65); margin-top: 2px; }
.menu a > span { flex: 1; }
.menu a .go { color: rgba(255,255,255,.35); }
.menu a.on { background: #fff; color: var(--navy); }
.menu a.on > i:first-child { background: var(--orange); color: #fff; }
.menu a.on small { color: var(--muted); }
.menu-me { margin-top: 12px; border-top: 1px solid rgba(255,255,255,.12); border-radius: 0; padding-top: 18px; }
.menu-me .avatar { width: 44px; height: 44px; font-size: 15px; }
body.menu-open { overflow: hidden; }
@media (max-width: 980px) {
  .top { gap: 10px; padding: env(safe-area-inset-top) 16px 0; min-height: 68px; }
  #nav, .who { display: none; }
  .burger { display: block; margin-left: auto; }
  .cta { display: inline-flex; align-items: center; gap: 8px; background: var(--orange); color: #fff; text-decoration: none; font-weight: 700;
    padding: 0 16px; height: 48px; border-radius: 12px; margin-left: auto; white-space: nowrap; }
  .cta:not([hidden]) ~ .burger { margin-left: 0; }
}
@media (min-width: 981px) { .menu { display: none !important; } }
@media (max-width: 380px) { .cta span, .brand small { display: none; } }

main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 80px; }
main.narrow { max-width: 640px; }

.card { background: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(49,68,87,.06); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.muted { color: var(--muted); font-size: 14px; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }

label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-weight: 600; color: var(--navy); margin-bottom: 6px; font-size: 14px; }
input[type=text], input[type=number], input[type=date], input[type=month], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cyan); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 20px;
  background: var(--orange); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; font-size: 15px; }
.btn:hover { background: var(--orange-d); }
.btn.big { width: 100%; padding: 16px; font-size: 17px; }
.btn.ghost { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: var(--ice); }
.btn.navy { background: var(--navy); }
.btn.sm { padding: 7px 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--link); cursor: pointer; padding: 0; font-weight: 600; }

/* chips / segmented */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 0; background: var(--ice); color: var(--navy); border-radius: 999px; padding: 10px 16px; cursor: pointer; font-weight: 500; text-align: left; }
.chip.on { background: var(--navy); color: #fff; }
.chip small { display: block; font-size: 12px; opacity: .75; font-weight: 400; }
.recent .chip { flex: 1 1 220px; border-radius: 12px; }

/* enkele reis / heen en terug */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.seg button { display: flex; align-items: center; gap: 12px; text-align: left; border: 2px solid transparent; background: var(--ice);
  color: var(--navy); border-radius: 14px; padding: 12px 14px; cursor: pointer; font: inherit; }
.seg button i { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--link); }
.seg button b { display: block; font-size: 16px; }
.seg button small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.seg button.on { background: var(--navy); color: #fff; }
.seg button.on i { background: var(--orange); color: #fff; }
.seg button.on small { color: rgba(255,255,255,.75); }
@media (max-width: 480px) { .seg button small { display: none; } .seg button { padding: 10px 12px; } }
.stop.terug .dot { color: var(--orange); }
.stop.terug .picked { background: #FDEFEA; }

.f > .lbl { display: block; font-weight: 600; color: var(--navy); margin-bottom: 6px; font-size: 14px; }
.seg.autos { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }

/* stops */
.stop { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.stop .dot { width: 28px; flex: 0 0 28px; height: 46px; display: flex; align-items: center; justify-content: center; color: var(--light); }
.stop:first-child .dot { color: var(--green); }
.stop.last .dot { color: var(--orange); }
.stop .picker { flex: 1; position: relative; }
.stop .x { background: none; border: 0; color: var(--muted); cursor: pointer; height: 46px; padding: 0 6px; }
.picked { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-radius: 12px; background: var(--ice); padding: 10px 14px; min-height: 46px; }
.picked b { color: var(--navy); display: block; }
.picked span { font-size: 13px; color: var(--muted); }
.dd { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: #fff; border-radius: 12px; z-index: 30;
  box-shadow: 0 8px 30px rgba(49,68,87,.18); max-height: 320px; overflow-y: auto; }
.dd button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 14px; cursor: pointer; }
.dd button:hover, .dd button.hl { background: var(--ice); }
.dd b { color: var(--navy); }
.dd .meta { font-size: 13px; color: var(--muted); }
.dd .tag { float: right; font-size: 12px; background: var(--ice); color: var(--link); border-radius: 999px; padding: 2px 8px; }
.dd .add { color: var(--link); font-weight: 600; border-top: 1px solid var(--line); }

.calc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 14px; }
.calc div { background: var(--ice); border-radius: 12px; padding: 10px 12px; }
.calc small { display: block; color: var(--muted); font-size: 12px; }
.calc b { color: var(--navy); font-size: 18px; }
.calc .warn { background: #FDEDE8; } .calc .warn b { color: var(--red); }
.calc .ok b { color: var(--green); }

.note { border-radius: 12px; padding: 12px 14px; background: var(--ice); font-size: 14px; margin-bottom: 14px; }
.note.warn { background: #FDEDE8; color: #7a2a1f; }
.note.info { background: #E6F4FA; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; padding: 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--ice); }
.tbl tfoot td { font-weight: 700; color: var(--navy); border-bottom: 0; }
.scroll { overflow-x: auto; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; background: var(--ice); color: var(--navy); white-space: nowrap; }
.pill.red { background: #FDEDE8; color: var(--red); } .pill.green { background: #E3F5EF; color: #00785a; }
.pill.amber { background: #FBF1DE; color: var(--amber); }

/* list cards (mobile) */
.trip { display: flex; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.trip:last-child { border-bottom: 0; }
.trip .d { width: 48px; text-align: center; color: var(--navy); font-weight: 700; line-height: 1.1; }
.trip .d small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.trip .m { flex: 1; min-width: 0; }
.trip .m b { color: var(--navy); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip .k { text-align: right; font-weight: 700; color: var(--navy); }

.melding { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.melding i { width: 22px; margin-top: 3px; }
.melding .t { font-weight: 600; color: var(--navy); }

/* login */
.login { max-width: 420px; margin: 8vh auto; }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.names .chip { border-radius: 12px; padding: 12px; }
.login { text-align: center; }
.login .names { text-align: left; }
.brand-login { display: flex; justify-content: center; margin-bottom: 14px; }
.brand-login .mark { width: 56px; height: 56px; border-radius: 16px; background: var(--orange); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.gbtn { display: flex; justify-content: center; min-height: 44px; margin: 22px 0 4px; }
.testmodus { margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--line); text-align: left; }

.modal-bg { position: fixed; inset: 0; background: rgba(49,68,87,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 22px; }
@media (min-width: 700px) { .modal-bg { align-items: center; } .modal { border-radius: 20px; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; z-index: 60; max-width: 90vw; }
.toast.err { background: var(--red); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.stat { background: #fff; border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 26px; color: var(--navy); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }

/* print documents */
.doc { background: #fff; padding: 32px; border-radius: var(--radius); }
.doc .head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 20px; border-bottom: 2px solid var(--navy); padding-bottom: 14px; }
.doc .tbl { font-size: 12.5px; }
.doc .tbl .muted { font-size: inherit; }
.doc .tbl td:first-child { white-space: nowrap; }
.doc .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
.doc .sign div { border-top: 1px solid var(--text); padding-top: 6px; font-size: 13px; }
@media print {
  /* Paginarichting staat in <style id="pagina">, gezet per scherm in render():
     declaratie staand, rittenregistratie liggend. */
  html, body { background: #fff; }
  .no-print, .top { display: none !important; }
  main { padding: 0; max-width: none; }
  .doc { padding: 0; border-radius: 0; }
  .doc.portrait .tbl { font-size: 10.5px; }
  .doc.portrait .tbl th, .doc.portrait .tbl td { padding: 6px 5px; }
  .doc.portrait h2 { font-size: 18px; }
  .tbl tr { break-inside: avoid; }
  .page-break { break-before: page; }
}
@media (max-width: 640px) {
  .hide-m { display: none; }
  .calc b { font-size: 16px; }
  .doc { padding: 16px; }
}
