:root {
  --ink: #16212b;
  --ink-2: #4b5966;
  --muted: #8693a0;
  --line: #e2e7ec;
  --bg: #f4f6f8;
  --card: #ffffff;
  --brand: #1d3a52;      /* Alpro navy — change to match your brand */
  --brand-2: #2f6f9f;
  --go: #1f8a4c;
  --stop: #c2412d;
  --warn: #b7791f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-2); }
.hidden { display: none !important; }

.topbar {
  background: var(--brand); color: #fff; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px; background: #fff; color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.brand small { display: block; font-weight: 500; opacity: .75; font-size: 12px; letter-spacing: 0; }
.topbar .link-btn { background: rgba(255,255,255,.12); color: #fff; border: 0; padding: 8px 14px; border-radius: 999px; font-size: 14px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; }
.wrap-wide { max-width: 1180px; margin: 0 auto; padding: 20px 20px 60px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); }
.sub { color: var(--ink-2); font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Buttons */
.btn {
  border: 1px solid var(--line); background: #fff; padding: 10px 16px; border-radius: 10px;
  font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: #c9d1d9; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #16304a; }
.btn-danger { color: var(--stop); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }

/* Staff login */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.staff-btn {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 12px;
  font-weight: 600; font-size: 16px; text-align: center;
}
.staff-btn:hover { border-color: var(--brand-2); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: #e6eef5; color: var(--brand);
  display: grid; place-items: center; margin: 0 auto 8px; font-weight: 700;
}
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 22px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand); }
.pin-dots span.on { background: var(--brand); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.pinpad button {
  height: 64px; border-radius: 14px; border: 1px solid var(--line); background: #fff;
  font-size: 24px; font-weight: 600;
}
.pinpad button:active { background: #eef3f7; }
.pinpad .ghost { border-color: transparent; background: transparent; font-size: 15px; color: var(--ink-2); }
.error { color: var(--stop); text-align: center; min-height: 22px; margin-top: 12px; font-weight: 500; }

/* Clock screen */
.now-time { font-size: 52px; font-weight: 700; letter-spacing: -.02em; text-align: center; font-variant-numeric: tabular-nums; }
.now-date { text-align: center; color: var(--ink-2); margin-bottom: 18px; }
.status {
  text-align: center; padding: 12px; border-radius: 12px; margin-bottom: 16px; font-weight: 600;
  background: #eef2f5; color: var(--ink-2);
}
.status.on { background: #e7f5ec; color: var(--go); }
.big-btn {
  width: 100%; border: 0; border-radius: 18px; padding: 26px 16px; font-size: 24px; font-weight: 800;
  color: #fff; letter-spacing: .02em; box-shadow: var(--shadow);
}
.big-btn.in { background: var(--go); }
.big-btn.out { background: var(--stop); }
.big-btn:disabled { opacity: .6; }
.note-input { width: 100%; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

.week-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.week-row:last-child { border-bottom: 0; }
.week-row .d { font-weight: 600; min-width: 90px; }
.week-row .t { color: var(--ink-2); font-size: 14px; flex: 1; }
.week-row .h { font-weight: 700; font-variant-numeric: tabular-nums; }
.total { display: flex; justify-content: space-between; font-weight: 800; padding-top: 12px; font-size: 17px; }

/* Sheet / dialog */
dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 24px));
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(10, 20, 30, .45); }
.dlg-body { padding: 22px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); background: #fafbfc; flex-wrap: wrap; }
.choice { display: grid; gap: 10px; margin: 14px 0; }
.choice button {
  text-align: left; padding: 16px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 16px; font-weight: 600;
}
.choice button small { display: block; font-weight: 400; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.choice button.suggested { border-color: var(--brand-2); background: #f2f7fb; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%;
}
.field .hint { font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 12px; }

/* Admin */
.tabs { display: flex; gap: 4px; background: #fff; border-radius: 12px; padding: 4px; box-shadow: var(--shadow); margin-bottom: 16px; width: fit-content; }
.tabs button { border: 0; background: transparent; padding: 9px 16px; border-radius: 9px; font-weight: 600; color: var(--ink-2); }
.tabs button.active { background: var(--brand); color: #fff; }
.period-nav { display: flex; align-items: center; gap: 8px; }
.period-nav .label { font-weight: 700; min-width: 210px; text-align: center; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total-row td { font-weight: 800; background: #fafbfc; }
.table-scroll { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f5; color: var(--ink-2); }
.pill.go { background: #e7f5ec; color: var(--go); }
.pill.warn { background: #fdf3e2; color: var(--warn); }
.pill.stop { background: #fbeae7; color: var(--stop); }
.banner { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.banner.warn { background: #fdf3e2; color: #7a5212; }
.banner.ok { background: #e7f5ec; color: #145c33; }
.results li { margin-bottom: 6px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 10px; font-weight: 500; z-index: 50; box-shadow: var(--shadow); max-width: 90vw;
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .now-time { font-size: 44px; }
  .period-nav .label { min-width: 0; }
}
a.btn { text-decoration: none; color: inherit; }
.pill { white-space: nowrap; }
.ot-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.roster-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.roster-grid label { font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: center; display: block; }
.roster-grid input { width: 100%; padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
small.ot { display: block; font-size: 11px; color: var(--warn); font-weight: 600; }
td small.sub2 { display: block; font-size: 11px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.hint { font-size: 12px; color: var(--muted); }
td.cell-edit { cursor: pointer; transition: background .12s; }
td.cell-edit:hover { background: #eef4fa; }
td.cell-edit:hover .add-hint { color: var(--brand-2); font-weight: 700; }
small.times { display: block; font-size: 11px; color: var(--muted); font-weight: 500; white-space: nowrap; }
small.loc-flag { display: block; font-size: 11px; color: var(--warn); font-weight: 700; }
a.pill { text-decoration: none; }
a.pill:hover { text-decoration: underline; }
td.loc-cell { white-space: nowrap; }

/* ---------- Onboarding ---------- */
.btn-block { width: 100%; justify-content: center; padding: 14px 16px; font-size: 16px; margin-top: 6px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.onb-hero h1 { font-size: 24px; margin-bottom: 6px; }
.onb-bar { height: 8px; background: #e6eef5; border-radius: 999px; overflow: hidden; margin-top: 14px; }
.onb-bar span { display: block; height: 100%; background: var(--go); border-radius: 999px; transition: width .3s; }
.step-list { list-style: none; margin: 0; padding: 0; }
.step-list li + li { border-top: 1px solid var(--line); }
.step-list button { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: none; border: 0; text-align: left; }
.step-list button.next { background: #f2f7fb; }
.step-text { flex: 1; }
.step-text small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.chev { color: var(--muted); font-size: 22px; }
.step-num { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--ink-2); flex: none; }
.step-num.done { background: var(--go); border-color: var(--go); color: #fff; }
.radio-group { border: 0; padding: 0; margin: 0 0 16px; }
.radio-group legend { font-weight: 700; font-size: 15px; margin-bottom: 8px; padding: 0; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 2px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; }
.radio.on { border-color: var(--brand-2); background: #f2f7fb; }
.radio input { margin-top: 3px; width: auto; }
.radio small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; font-weight: 400; }
.sub-fields { border-left: 3px solid var(--brand-2); padding-left: 14px; margin: 4px 0 16px; }
.check-list { list-style: none; padding: 0; margin: 0 0 14px; }
.check-list li { padding: 6px 0; color: var(--ink-2); }
.check-list li.done { color: var(--go); font-weight: 600; }
.file-list { list-style: none; padding: 0; margin: 0 0 14px; }
.file-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.file-list small { display: block; color: var(--ink-2); font-size: 12px; }
.upload-box { background: #fafbfc; border: 1px dashed #c9d1d9; border-radius: 12px; padding: 14px; }
.policy { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.policy summary { display: flex; align-items: center; gap: 10px; padding: 14px; cursor: pointer; list-style: none; }
.policy summary::-webkit-details-marker { display: none; }
.policy[open] summary { border-bottom: 1px solid var(--line); background: #fafbfc; }
.policy-body { padding: 4px 14px; font-size: 15px; line-height: 1.5; }
.policy-body h3 { margin: 14px 0 4px; }
.policy-body ul { padding-left: 20px; }
.policy-body a { word-break: break-all; }
.sign-row { display: flex; gap: 8px; padding: 12px 14px 14px; flex-wrap: wrap; }
.sign-row input { flex: 1; min-width: 180px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.signed { color: var(--go); font-weight: 600; font-size: 13px; padding: 0 14px 12px; margin: 6px 0 0; }
.module { border: 1px solid var(--line); border-radius: 12px; padding: 14px 0 12px; margin-bottom: 12px; }
.module h2 { padding: 0 14px; margin-bottom: 4px; }
.module.done { border-color: #b9e0c8; background: #f7fcf9; }
.module .points { padding: 6px 14px 2px; }
.module .points .check { align-items: flex-start; font-size: 15px; }
.module .points input { margin-top: 3px; width: 20px; height: 20px; flex: none; }
.module > .btn { margin: 4px 14px 0; }
.module .signed { padding: 0 14px; }
.sig-pad { width: 100%; height: 170px; border: 2px dashed #c9d1d9; border-radius: 12px; background: #fff; touch-action: none; display: block; }
.sig-img { max-width: 320px; max-height: 130px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* Manager onboarding */
dialog.dlg-wide { width: min(760px, calc(100vw - 24px)); }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; margin-bottom: 10px; }
.check-grid .check { margin-bottom: 6px; }
.check input, .check-grid input { width: auto; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fafbfc; }
td.chips .pill { margin: 1px 0; }
.progress-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 16px; }
.prog { background: #fdf3e2; border-radius: 10px; padding: 10px; text-align: center; }
.prog b { display: block; font-size: 18px; color: var(--warn); }
.prog span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.prog.done { background: #e7f5ec; }
.prog.done b { color: var(--go); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-block { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
table.kv th { width: 40%; background: none; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink-2); }
table.kv td, table.kv th { padding: 6px 4px; }
.note-box { background: #f4f6f8; border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; font-size: 14px; color: var(--ink-2); white-space: pre-wrap; }
.upload-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.upload-row select, .upload-row input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.mini-date { padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; margin-left: 6px; }
.check.task { align-items: flex-start; }
.check.task input { margin-top: 3px; }
.check.task.done .t { color: var(--muted); text-decoration: line-through; }
p.no, .no { color: var(--stop); font-weight: 600; }
@media (max-width: 760px) {
  .detail-grid, .check-grid { grid-template-columns: 1fr; }
  .progress-row { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 .field:first-child { grid-column: 1 / -1; }
}

/* ---------- Vehicles & insurance ---------- */
.grid-3b { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.grid-svc { display: grid; grid-template-columns: 170px 130px 2fr 1.2fr 110px; gap: 12px; }
.grid-svc input { min-width: 0; }
.tabs { flex-wrap: wrap; max-width: 100%; }
#fleetMain a[data-open] { color: inherit; text-decoration: none; }
#fleetMain a[data-open]:hover b { text-decoration: underline; }
@media (max-width: 760px) {
  .grid-3b { grid-template-columns: 1fr 1fr; }
  .grid-svc { grid-template-columns: 1fr 1fr; }
  .grid-svc .field:nth-child(3) { grid-column: 1 / -1; }
}

/* ---------- Leave & incidents ---------- */
.extra-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.extra-btn { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 14px 10px; font-weight: 700; font-size: 14px; text-align: center; }
.extra-btn span { display: block; font-size: 24px; margin-bottom: 4px; }
.extra-btn.warn { border-color: #f0d9b5; background: #fffaf2; }
.link-sm { background: none; border: 0; color: var(--brand-2); font-size: 12px; padding: 2px 0; text-decoration: underline; }
.balances { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.balances div { background: #eef4fa; border-radius: 10px; padding: 8px 12px; }
.balances b { display: block; font-size: 18px; color: var(--brand); }
.balances span { font-size: 12px; color: var(--ink-2); }
dialog.dlg-full { width: min(680px, calc(100vw - 16px)); max-height: calc(100vh - 16px); }
.banner.stop-banner { background: #fbeae7; color: #7a1d0e; }
.pill.leave { background: #ece8fb; color: #5b3fb5; }
.tab-badge { background: var(--stop); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; margin-left: 4px; }
.leave-req { display: grid; grid-template-columns: 1fr minmax(260px, 340px); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.leave-req:last-child { border-bottom: 0; }
.big-date { font-size: 17px; font-weight: 700; margin: 4px 0; }
.leave-actions { display: grid; gap: 8px; align-content: start; }
.leave-actions input[data-note] { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.leave-actions .row { justify-content: flex-end; }
.step-card .step-inner { margin: 12px 0 0 44px; }
.step-card.done { border-left: 4px solid var(--go); }
.pre { white-space: pre-wrap; margin: 0 0 8px; }
.photo-row { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-chip { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; text-decoration: none; color: inherit; font-size: 13px; }
.photo-chip small { color: var(--muted); }
.check.task .link-sm { margin-left: auto; }
@media (max-width: 760px) {
  .leave-req { grid-template-columns: 1fr; }
  .step-card .step-inner { margin-left: 0; }
}
