:root {
  --blue: #00a1de;
  --blue-dark: #0081c2;
  --blue-soft: #e5f5fc;
  --deep: #00224a;
  --deep-2: #003a78;
  --bg: #f3f6fa;
  --card: #ffffff;
  --text: #0b2239;
  --muted: #64768a;
  --border: #dfe6ee;
  --green: #12965a;
  --green-bg: #e2f5ea;
  --orange: #c26f00;
  --orange-bg: #fff1d9;
  --red: #d33a42;
  --red-bg: #fde8e9;
  --grey-bg: #eef2f6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 34, 74, .05), 0 8px 24px -8px rgba(0, 34, 74, .12);
  --shadow-lg: 0 24px 60px -20px rgba(0, 34, 74, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--blue-dark); }
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: 18px; margin: 0 0 14px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px 72px; }

/* ---------- topbar ---------- */
.topbar { background: var(--deep); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 10px; background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.brand-logo svg { width: 24px; height: 24px; }
.brand-logo img { width: 78%; height: 78%; object-fit: contain; }
.brand-logo.lg { width: 64px; height: 64px; border-radius: 16px; }
.brand-logo.lg svg { width: 36px; height: 36px; }
#nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
#nav a { color: #b9cbe0; text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; transition: background .15s, color .15s; }
#nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
#nav a.active { background: rgba(255,255,255,.14); color: #fff; }
#nav a .count { background: var(--blue); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 6px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-email { color: #b9cbe0; font-size: 13px; }
.lang-toggle { background: transparent; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 999px; padding: 4px 10px; cursor: pointer; font-weight: 700; font-size: 12px; font-family: inherit; }
.topbar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.25); border-radius: 999px; }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.08); }

/* ---------- page hero (full-bleed band under the topbar) ---------- */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin: 0 calc(50% - 50vw) 28px;
  padding: 40px calc(50vw - 50%) 76px;
  color: #fff;
  background:
    radial-gradient(900px 300px at 85% -20%, rgba(0,161,222,.55), transparent 60%),
    linear-gradient(160deg, var(--deep) 0%, var(--deep-2) 60%, #0062a8 100%);
}
.page-head h1 { color: #fff; }
.page-head .muted { color: rgba(255,255,255,.78); max-width: 640px; margin: 4px 0 0; }
.page-head .btn.primary { background: #fff; color: var(--deep); border-color: #fff; }
.page-head .btn.primary:hover { background: var(--blue-soft); }
.page-head + .card, .page-head + form, .page-head + .stats, .page-head + #plan, .page-head + .row { margin-top: -76px; position: relative; }

/* ---------- cards & layout ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.stack > * + * { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* numbered steps */
form { counter-reset: step; }
.card.step h2 { display: flex; align-items: center; gap: 12px; }
.card.step h2::before {
  counter-increment: step; content: counter(step);
  width: 30px; height: 30px; border-radius: 50%; background: var(--blue-soft); color: var(--blue-dark);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; flex: none;
}

/* ---------- forms ---------- */
label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #2a3f55; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #c5d2df; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,161,222,.15); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { width: auto; accent-color: var(--blue); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 10px 18px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--grey-bg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 6px 16px -6px rgba(0,161,222,.6); }
.btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.success:hover { background: #0d7f4b; }
.btn.danger { background: #fff; border-color: #f0b8bb; color: var(--red); }
.btn.danger:hover { background: var(--red-bg); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* segmented choice */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg button {
  text-align: left; border: 2px solid var(--border); background: #fff; border-radius: 14px; padding: 18px 20px;
  cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s, background .15s, box-shadow .15s;
}
.seg button:hover { border-color: #a9dcf2; }
.seg button strong { display: block; font-size: 16px; margin-bottom: 2px; }
.seg button.on { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 4px rgba(0,161,222,.12); }
#outsideChoice { padding: 16px; background: #f7fafc; border-radius: 14px; border: 1px dashed var(--border); }
#outsideChoice .seg button { padding: 14px 16px; }

/* ---------- cars ---------- */
.cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.car {
  position: relative; border: 2px solid var(--border); border-radius: 14px; padding: 16px; background: #fff; cursor: pointer;
  text-align: left; font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.car:hover:not(:disabled) { border-color: #a9dcf2; transform: translateY(-2px); box-shadow: var(--shadow); }
.car.on { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 4px rgba(0,161,222,.12); }
.car:disabled { cursor: not-allowed; background: #f7f9fb; }
.car:disabled > *:not(.meta:last-child) { opacity: .55; }
.car-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--blue-soft); color: var(--blue-dark); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.car-ico svg { width: 24px; height: 24px; }
.car:disabled .car-ico { background: var(--grey-bg); color: var(--muted); }
.car-check { position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 13px; font-weight: 800; display: none; align-items: center; justify-content: center; }
.car.on .car-check { display: flex; }
.car.on .row .badge { display: none; }
.car .num { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.car .model { font-weight: 600; }
.car .meta { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.pending { background: var(--orange-bg); color: var(--orange); }
.badge.approved { background: var(--green-bg); color: var(--green); }
.badge.rejected { background: var(--red-bg); color: var(--red); }
.badge.cancelled { background: var(--grey-bg); color: var(--muted); }
.badge.warn { background: var(--orange-bg); color: var(--orange); }
.badge.alert { background: var(--red-bg); color: var(--red); }
.badge.trip-schiphol { background: var(--grey-bg); color: #4b5d70; }
.badge.trip-binnenland { background: #e3f6f1; color: #0f7a63; }
.badge.trip-buitenland { background: #e7efff; color: #2456b8; }

/* ---------- lists ---------- */
.booking { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 20px 0; border-top: 1px solid var(--border); }
.booking:first-child { border-top: 0; padding-top: 0; }
.booking:last-child { padding-bottom: 0; }
.booking .title { font-weight: 700; font-size: 16px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; font-size: 14px; margin-top: 10px; }
.kv div span { color: var(--muted); display: block; font-size: 12px; font-weight: 500; }
.booking .actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.comment { background: #f6f9fb; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; margin-top: 10px; }
.empty { text-align: center; color: var(--muted); padding: 36px 0; }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 700; }
table.list td { padding: 12px 10px; border-bottom: 1px solid #edf1f5; vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.clickable { cursor: pointer; }
table.list tr.clickable:hover td { background: #f7fafd; }
table.list tr.inactive td { opacity: .5; }

/* ---------- tabs & pills ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; background: #fff; padding: 5px; border-radius: 999px; box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.tabs a { padding: 8px 18px; text-decoration: none; color: var(--muted); font-weight: 600; border-radius: 999px; font-size: 14px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: #fff; background: var(--deep); }
.pills { display: inline-flex; gap: 4px; flex-wrap: wrap; background: #fff; padding: 4px; border-radius: 999px; box-shadow: var(--shadow); }
.pills button { border: 0; background: transparent; border-radius: 999px; padding: 7px 16px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); }
.pills button.on { background: var(--deep); color: #fff; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.stat b { font-size: 30px; display: block; letter-spacing: -.02em; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 500; }

/* ---------- planning grid ---------- */
.plan-wrap { overflow-x: auto; }
.plan { border-collapse: separate; border-spacing: 0; font-size: 12px; table-layout: fixed; width: max-content; }
.plan th, .plan td { border-bottom: 1px solid #edf1f5; border-right: 1px solid #f1f4f7; padding: 0; height: 42px; overflow: hidden; }
.plan thead th { height: auto; padding: 8px 2px; font-weight: 600; color: var(--muted); text-align: center; width: 38px; }
.plan thead th.car-h { width: 200px; }
.plan th.car-h { position: sticky; left: 0; background: #fff; z-index: 2; text-align: left; padding: 0 14px; white-space: nowrap; font-size: 13px; box-shadow: 1px 0 0 var(--border); }
.plan thead th.we, .plan td.we { background: #f8fafc; }
.plan thead th.today { color: #fff; background: var(--blue); border-radius: 8px 8px 0 0; }
.plan td .blk { display: block; height: 28px; margin: 0 2px; padding: 0 10px; line-height: 28px; color: #fff; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.plan td .blk.approved { background: var(--green); }
.plan td .blk.pending { background: repeating-linear-gradient(45deg, #e89a1c, #e89a1c 6px, #f0ad3f 6px, #f0ad3f 12px); }
.plan td .blk.busy { background: var(--red); font-weight: 500; }
.plan td .blk.s { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.plan td .blk.e { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 6px; }

/* ---------- month calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-h { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 4px 0; }
.cal-day {
  min-height: 84px; border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 10px;
  text-align: left; display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.cal-day:hover:not(:disabled) { border-color: var(--blue); box-shadow: var(--shadow); transform: translateY(-1px); }
.cal-day.out { background: #fafbfd; }
.cal-day.out .dnum { color: var(--muted); }
.cal-day.past { background: var(--grey-bg); cursor: default; opacity: .5; }
.cal-day.today { border: 2px solid var(--blue); }
.cal-day.today .dnum { color: var(--blue-dark); }
.cal-day .dnum { font-weight: 800; font-size: 15px; }
.cal-day .avail { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 8px; align-self: flex-start; }
.avail.ok { background: var(--green-bg); color: var(--green); }
.avail.low { background: var(--orange-bg); color: var(--orange); }
.avail.full { background: var(--red-bg); color: var(--red); }

/* ---------- notes ---------- */
.note { border-left: 3px solid var(--border); padding: 8px 14px; margin: 10px 0; background: #fafcfd; border-radius: 0 10px 10px 0; }
.note.maintenance { border-color: var(--orange); }
.note.damage { border-color: var(--red); }
.note.apk { border-color: #2456b8; }
.note.resolved { opacity: .55; }
.note .meta { font-size: 12px; color: var(--muted); }

/* ---------- login ---------- */
body.is-login {
  background:
    radial-gradient(800px 500px at 90% 0%, rgba(0,161,222,.5), transparent 60%),
    radial-gradient(600px 400px at 0% 100%, rgba(0,161,222,.25), transparent 60%),
    linear-gradient(160deg, var(--deep) 0%, var(--deep-2) 70%, #0062a8 100%);
  min-height: 100vh;
}
.center-card { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 440px; text-align: center; padding: 40px 32px 28px; box-shadow: var(--shadow-lg); border-radius: 22px; }
.login-card h1 { font-size: 22px; margin-top: 4px; }
.login-card form { text-align: left; margin-top: 22px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-name { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.login-name small { display: block; font-size: 13px; font-weight: 700; color: var(--blue-dark); letter-spacing: .12em; text-transform: uppercase; margin-top: 4px; }
.login-card .lang-toggle { color: var(--muted); border-color: var(--border); margin-top: 20px; }
.notice { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-top: 14px; text-align: left; }
.notice.ok { background: var(--green-bg); color: #0e6b41; }
.notice.err { background: var(--red-bg); color: #9e2328; }
.notice.info { background: var(--blue-soft); color: #075a80; }

/* ---------- modal & toast ---------- */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); color: var(--text); }
dialog::backdrop { background: rgba(0, 34, 74, .5); backdrop-filter: blur(3px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: #fff; }
.x { border: 0; background: var(--grey-bg); width: 32px; height: 32px; border-radius: 50%; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; flex: none; }
.x:hover { color: var(--text); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--deep); color: #fff; padding: 13px 20px; border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 100; max-width: calc(100vw - 32px); font-weight: 500; }
.toast.err { background: var(--red); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .grid2, .grid3, .seg { grid-template-columns: 1fr; }
  .booking { grid-template-columns: 1fr; }
  .booking .actions { flex-direction: row; align-items: center; justify-content: flex-start; }
  .user-email { display: none; }
  .topbar-inner { gap: 10px; }
  .brand-text { font-size: 15px; }
  h1 { font-size: 24px; }
  .page-head { padding-top: 28px; }
  .card { padding: 18px; }
  .cal { gap: 3px; }
  .cal-day { min-height: 58px; padding: 5px; border-radius: 8px; }
  .cal-day .avail { font-size: 10px; padding: 1px 4px; }
}

/* logo: wider box once the real logo is loaded */
.brand-logo.has-img { width: 58px; padding: 0 8px; }
.brand-logo.has-img img { width: 100%; height: auto; }
.brand-logo.lg.has-img, .login-brand .brand-logo.lg:has(img) { width: 104px; height: 72px; padding: 0 16px; }
.login-brand .brand-logo.lg img { width: 100%; height: auto; }

/* blocks */
.plan td .blk.blocked { background: repeating-linear-gradient(45deg, #8a99a8, #8a99a8 6px, #9eacba 6px, #9eacba 12px); }
.legend i.lg-blocked { background: repeating-linear-gradient(45deg, #8a99a8, #8a99a8 3px, #9eacba 3px, #9eacba 6px); }

/* key panel & handover */
.key-panel { background: var(--blue-soft); border-radius: 12px; padding: 14px 16px; margin-top: 12px; }
.key-panel .kv { margin-top: 6px; }
.key-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; font-weight: 800; letter-spacing: .18em; color: var(--deep); }
.key-code.sm { font-size: 15px; letter-spacing: .12em; }
.key-code-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; font-weight: 700; }
.kv.handover { background: #f6f9fb; border-radius: 10px; padding: 10px 14px; }

/* QR sheet */
.qr-sheet { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 28px; border: 2px solid var(--border); border-radius: 16px; background: #fff; }
.qr-name { font-size: 22px; font-weight: 800; }
.qr-sub { font-weight: 600; color: var(--blue-dark); }
.qr-url { font-size: 11px; color: var(--muted); }
#qrBox img, #qrBox canvas { display: block; }

/* one-click scope picker */
.scope-pick { display: inline-flex; background: var(--grey-bg); border-radius: 999px; padding: 3px; gap: 2px; white-space: nowrap; }
.scope-pick button, .scope-pick label span { border: 0; background: transparent; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-block; }
.scope-pick button:hover, .scope-pick label span:hover { color: var(--text); }
.scope-pick label input { position: absolute; opacity: 0; pointer-events: none; }
.scope-pick label { position: relative; }
.scope-pick .sp-schiphol.on, .scope-pick label.sp-schiphol input:checked + span { background: #fff; color: #4b5d70; box-shadow: var(--shadow); }
.scope-pick .sp-binnenland.on, .scope-pick label.sp-binnenland input:checked + span { background: #0f7a63; color: #fff; }
.scope-pick .sp-buitenland.on, .scope-pick label.sp-buitenland input:checked + span { background: #2456b8; color: #fff; }
.scope-pick.lg label span { padding: 8px 14px; font-size: 13px; }
