/* Hira Express Transport — UI */
:root {
  --gold: #c9a227;
  --gold-strong: #a8851a;
  --gold-soft: #f6eccb;
  --gold-text: #a8851a;
  --ink-surface: #fbf6e6;
  --ink: #1c1b19;
  --bg: #f7f7f5;
  --card: #ffffff;
  --card-2: #faf9f6;
  --text: #1c1b19;
  --muted: #6b6862;
  --line: #e6e3da;
  --line-2: #f0eee8;
  --ok: #15803d;   --ok-bg: #e7f6ec;
  --warn: #b45309; --warn-bg: #fdf1e2;
  --bad: #b91c1c;  --bad-bg: #fde8e8;
  --info: #1d4ed8; --info-bg: #e7eefe;
  --shadow: 0 1px 2px rgba(20, 18, 10, .04), 0 2px 8px rgba(20, 18, 10, .04);
  --shadow-lg: 0 12px 40px rgba(20, 18, 10, .14);
  --radius: 14px;
  --radius-sm: 10px;
  --side: 252px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14.5px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }

/* ---------- Boot / login ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; background: #fff; }
.boot img { width: 96px; height: 96px; border-radius: 50%; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; transform: scale(.96); } }

.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(900px 500px at 50% -10%, #fbf3d9 0%, #ffffff 60%) fixed;
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 20px;
  padding: 32px 28px 26px; box-shadow: 0 20px 60px rgba(20,18,10,.10); color: var(--text);
}
.login-card .brand { text-align: center; margin-bottom: 22px; }
.login-card .brand img { width: 112px; height: 112px; border-radius: 50%; box-shadow: 0 8px 30px rgba(201,162,39,.30); }
.login-card h1 { font-size: 20px; margin: 14px 0 2px; letter-spacing: .02em; }
.login-card .brand p { margin: 0; color: var(--muted); font-size: 13px; }
.login-card .input { height: 46px; }
.login-card .btn-gold { width: 100%; justify-content: center; height: 46px; font-size: 15px; margin-top: 6px; }
.login-roles { display: flex; justify-content: center; gap: 8px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.login-roles span { border: 1px solid var(--line); padding: 3px 10px; border-radius: 99px; }
.login-err { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 6px 8px; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: var(--side); flex: none; background: #fff; color: var(--text); position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; border-right: 1px solid var(--line); z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; text-decoration: none; }
.side-brand img { width: 44px; height: 44px; border-radius: 50%; }
.side-brand b { display: block; color: var(--gold-text); font-size: 15px; letter-spacing: .06em; }
.side-brand small { color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.side nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.nav-group { color: #a29f97; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; padding: 14px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; text-decoration: none;
  color: #4a4843; font-weight: 500; margin: 1px 0; transition: background .12s, color .12s;
}
.nav-link:hover { background: #f4f3ef; color: var(--text); }
.nav-link.active { background: var(--gold-soft); color: var(--gold-text); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
.side-foot { border-top: 1px solid var(--line); padding: 12px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: #1a1505; font-weight: 700; font-size: 13px;
  display: grid; place-items: center; flex: none;
}
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { display: block; color: var(--text); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who small { color: var(--muted); text-transform: capitalize; font-size: 11.5px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: transparent;
  color: inherit; cursor: pointer; flex: none;
}
.icon-btn:hover { background: #f1f0ec; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: #fff;
  border-bottom: 1px solid var(--line); padding: 14px 28px; display: flex; align-items: center; gap: 12px; min-height: 64px;
}
.topbar h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }
.topbar .menu-btn { display: none; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.uae-clock { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card-2); font-size: 13px; white-space: nowrap; flex: none; }
.uae-clock svg { width: 15px; height: 15px; color: var(--gold); }
.uae-clock b { font-variant-numeric: tabular-nums; }
.uae-clock small { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.content { padding: 24px 28px 48px; width: 100%; } /* full window width on every page and role */
.mobile-brand { display: none; }

.bottom-nav { display: none; }
.scrim { display: none; }

/* ---------- Building blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { margin: 0; font-size: 15px; }
.card-b { padding: 16px 18px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 26px 0 12px; font-weight: 600; }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.kpi .value { font-size: 30px; font-weight: 700; margin: 4px 0 2px; letter-spacing: -.02em; }
.kpi .hint { font-size: 12.5px; color: var(--muted); }
.kpi .value.gold { color: var(--gold-text); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s; text-decoration: none;
}
.btn:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg.i { width: 16px; height: 16px; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1a1505; }
.btn-gold:hover { background: #d6b03a; border-color: #d6b03a; }
.btn-dark { background: var(--gold); border-color: var(--gold); color: #1a1505; }
.btn-dark:hover { background: #d6b03a; border-color: #d6b03a; }
.btn-danger { color: var(--bad); }
.btn-danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(127,127,127,.12); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; border-radius: 12px; }

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  outline: none; transition: border-color .15s, box-shadow .15s; font-size: 14px;
}
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
.input.input-sm { height: 32px; font-size: 13px; padding: 0 8px; border-radius: 8px; }
select.input { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.field { margin-bottom: 14px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-sec { margin: 6px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.form-grid > .form-sec:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-sec h4 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--text); }
.form-sec h4 svg { width: 16px; height: 16px; color: var(--gold-text); }
.form-sec .help { margin-top: 2px; }
/* dropdown of names in use + "+ New…" text box (Facility → Department → Group) */
.pick-wrap { display: grid; gap: 6px; }
/* Users & Access: who an HR / transport login manages */
.scope-pick { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card-2); }
.sc-body { display: grid; gap: 12px; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.sc-tree { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.sc-fac { display: grid; gap: 4px; }
.sc-fac .sc-h { font-weight: 700; }
.sc-fac .sc-h ~ .sc-dep { margin-left: 26px; }
.sc-dep { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.sc-d { font-weight: 600; min-width: 160px; }
.sc-grps { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.sc-grps .check { font-size: 13px; }
.sc-grps input:disabled + *, .sc-grps .check:has(input:disabled) { opacity: .55; }
.sc-list { display: grid; gap: 4px; max-height: 180px; overflow: auto; margin-top: 8px; }
.sc-list .check span { margin-left: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search .input { padding-left: 34px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .02em; white-space: nowrap; background: var(--line-2); color: var(--muted);
}
.badge.code { color: #fff; background: var(--c, #555); font-family: var(--mono); font-size: 11px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.gold { background: var(--gold-soft); color: var(--gold-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--c, #999); flex: none; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; margin-bottom: 12px; }
.alert svg.i { margin-top: 1px; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert b { font-weight: 700; }

.tabs { display: inline-flex; background: var(--line-2); border-radius: 11px; padding: 3px; gap: 2px; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.tabs button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--card-2); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.off td { opacity: .5; }
table.t td.actions { text-align: right; white-space: nowrap; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg.i { width: 36px; height: 36px; color: var(--gold); margin-bottom: 8px; }
.empty h4 { margin: 0 0 4px; color: var(--text); font-size: 15px; }

.link-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--info); text-decoration: none; padding: 3px 8px; border-radius: 6px; background: var(--info-bg); white-space: nowrap; }
.link-chip svg.i { width: 13px; height: 13px; }
.link-chip.missing { color: var(--warn); background: var(--warn-bg); }

/* ---------- Dispatch ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.datenav { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.datenav .input { border: 0; height: 32px; width: 150px; box-shadow: none; }
.datenav .icon-btn { width: 32px; height: 32px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip.on { border-color: var(--gold); background: var(--gold-soft); }
.chip b { font-weight: 800; }

.time-group { margin-bottom: 22px; }
.time-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.time-head .t { font-family: var(--mono); font-size: 16px; font-weight: 700; background: var(--gold-soft); color: var(--gold-text); padding: 4px 10px; border-radius: 8px; }
.time-head .line { flex: 1; height: 1px; background: var(--line); }
.runs { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.run { overflow: hidden; display: flex; flex-direction: column; border-top: 3px solid var(--c, var(--gold)); }
.run.unassigned { box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent); }
.run.cancelled { opacity: .55; }
.run-h { padding: 12px 14px 10px; display: flex; gap: 10px; align-items: flex-start; }
.run-h .title { font-weight: 700; font-size: 14px; }
.run-h .route { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.run-h .route svg.i { width: 13px; height: 13px; }
.run-assign { padding: 0 14px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.run-assign .full { grid-column: 1 / -1; }
.run-assign label { font-size: 11px; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .06em; }
.pax { border-top: 1px solid var(--line-2); padding: 6px 6px; flex: 1; }
.pax-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 13px; }
.pax-row:hover { background: var(--card-2); }
.pax-row .n { width: 20px; color: var(--muted); font-size: 11.5px; text-align: right; flex: none; }
.pax-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pax-row .ar { color: var(--muted); font-size: 12px; white-space: nowrap; }
.pax-row .icon-btn { width: 26px; height: 26px; border-radius: 7px; color: var(--muted); }
.pax-row .icon-btn svg.i { width: 14px; height: 14px; }
.pax-row .icon-btn.has { color: var(--info); }
.run-f { border-top: 1px solid var(--line-2); padding: 8px 10px 8px 14px; display: flex; align-items: center; gap: 8px; background: var(--card-2); }
.cap { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.cap .bar { flex: 1; max-width: 120px; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.cap .bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.cap.over .bar i { background: var(--bad); }
.cap.over { color: var(--bad); font-weight: 700; }

/* ---------- Roster grid ---------- */
.roster { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
.roster th, .roster td { border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); padding: 0; }
.roster thead th { position: sticky; top: 0; background: var(--card-2); z-index: 2; padding: 8px 6px; font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: center; white-space: nowrap; }
.roster thead th b { display: block; color: var(--text); font-size: 13px; }
.roster thead th.today b { color: var(--gold-strong); }
.roster .nm { position: sticky; left: 0; background: var(--card); z-index: 1; padding: 8px 12px; min-width: 190px; max-width: 240px; text-align: left; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster thead .nm { z-index: 3; background: var(--card-2); }
.roster .cell { min-width: 96px; height: 44px; text-align: center; cursor: pointer; transition: background .1s; }
.roster .cell:hover { background: var(--gold-soft); }
.roster .cell .dc { font-size: 10.5px; color: var(--muted); font-weight: 700; display: block; line-height: 1.2; }
.roster .cell .badge { height: 19px; font-size: 10.5px; padding: 0 6px; }
.roster tfoot td { background: var(--card-2); font-weight: 700; text-align: center; padding: 8px 4px; }
.roster tfoot .nm { background: var(--card-2); }
.roster-wrap { overflow: auto; max-height: calc(100vh - 230px); border-radius: var(--radius); }

/* ---------- Upload ---------- */
.drop {
  border: 2px dashed color-mix(in srgb, var(--gold) 55%, var(--line)); border-radius: 18px; padding: 44px 20px; text-align: center; cursor: pointer;
  background: color-mix(in srgb, var(--gold-soft) 45%, var(--card)); transition: background .15s, border-color .15s;
}
.drop:hover, .drop.over { background: var(--gold-soft); border-color: var(--gold); }
.drop svg.i { width: 44px; height: 44px; color: var(--gold-strong); stroke-width: 1.5; }
.drop h3 { margin: 12px 0 4px; font-size: 17px; }
.drop p { margin: 0; color: var(--muted); }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.step i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; background: var(--line-2); font-size: 12px; }
.step.on { color: var(--text); }
.step.on i { background: var(--gold); color: #1a1505; }
.step.done i { background: var(--ok); color: #fff; }
.step-sep { width: 28px; height: 1px; background: var(--line); align-self: center; }
.preview td.unk .badge { outline: 2px solid var(--bad); outline-offset: 1px; }
.preview tr.skip td { opacity: .4; }

/* ---------- Driver ---------- */
.driver-head { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text); border-radius: 18px; padding: 18px 20px; margin-bottom: 18px; display: flex; align-items: center; gap: 14px; }
.driver-head .big { font-size: 22px; font-weight: 700; }
.driver-head .muted { color: var(--muted); }
.driver-head .stat { text-align: center; padding: 0 10px; }
.driver-head .stat b { display: block; font-size: 22px; color: var(--gold-text); }
.driver-head .stat small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.duty { margin-bottom: 16px; overflow: hidden; border-left: 4px solid var(--c, var(--gold)); }
.duty-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.duty-time { font-family: var(--mono); font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.duty-top .meta { flex: 1; min-width: 0; }
.duty-top .meta b { display: block; font-size: 15px; }
.stop { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line-2); }
.stop .pin { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--line-2); color: var(--muted); font-weight: 700; font-size: 12px; }
.stop.dest .pin { background: var(--gold-soft); color: var(--gold-text); }
.stop .who { flex: 1; min-width: 0; }
.stop .who b { display: block; font-size: 14.5px; }
.stop .who small { color: var(--muted); }
.stop .go { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 12px; border-radius: 10px; text-decoration: none; font-weight: 700; font-size: 13px; background: var(--info-bg); color: var(--info); }
.stop .go.call { background: var(--ok-bg); color: var(--ok); padding: 0; width: 40px; }
.stop .go.nolink { background: var(--line-2); color: var(--muted); }
.duty-actions { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line-2); background: var(--card-2); }
.duty-actions .btn { flex: 1; justify-content: center; height: 44px; }
.day-label { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 2px 10px; }

/* ---------- Routes & km ---------- */
.eta { font-family: var(--mono); font-weight: 700; font-size: 12px; color: var(--gold-text); background: var(--gold-soft); border-radius: 5px; padding: 1px 5px; margin-right: 6px; white-space: nowrap; }
.pax-row .eta { margin-right: 0; flex: none; }
.pax-row .icon-btn.nopos { color: var(--warn); }
.run-route { display: flex; align-items: center; gap: 6px; padding: 7px 10px 7px 14px; margin: 0 0 8px; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); background: var(--card-2); font-size: 12.5px; }
.run-route > svg.i { width: 15px; height: 15px; color: var(--gold-strong); }
.run-route .icon-btn { width: 30px; height: 30px; }
.run-route .icon-btn svg.i { width: 16px; height: 16px; }
.km-btn { color: var(--muted); font-family: var(--mono); }
.route-sum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 16px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.route-sum > svg.i { color: var(--gold-strong); }
.start-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line-2); background: color-mix(in srgb, var(--gold-soft) 35%, var(--card)); }
.start-row .pin { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--gold); color: #1a1505; }
.start-row .pin svg.i { width: 16px; height: 16px; }
.start-row .who { flex: 1; min-width: 0; }
.start-row .who b { display: block; font-size: 14px; }
.start-row .who small { color: var(--muted); }
.km-line { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }
.km-line b { color: var(--text); }
.off-card { display: flex; align-items: center; gap: 10px; padding: 14px 16px; margin-bottom: 16px; color: var(--warn); background: var(--warn-bg); border-color: transparent; }

/* ---------- Driver duty rota ---------- */
.rota .nm b { display: block; }
.rota .nm small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.rota .rcell { min-width: 128px; padding: 6px; vertical-align: top; text-align: left; cursor: pointer; transition: background .1s; }
.rota .rcell:hover { background: var(--gold-soft); }
.rota .rcell.is-off { background: repeating-linear-gradient(135deg, #fbfaf7 0 6px, #f4f2ec 6px 12px); }
.rota .rcell.clash { box-shadow: inset 0 0 0 2px var(--bad); }
.rota .rcell .note { font-size: 11px; color: var(--muted); margin-top: 3px; white-space: normal; }
.rt { display: flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 3px 6px; margin-bottom: 3px; border-radius: 6px; background: color-mix(in srgb, var(--c) 12%, #fff); border-left: 3px solid var(--c); white-space: nowrap; }
.rt b { font-family: var(--mono); }
.rt small { margin-left: auto; color: var(--muted); font-weight: 700; }
.rota .hrs { font-size: 10.5px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.rota .free { font-size: 11.5px; color: #b5b1a7; }
.rota tfoot td { font-size: 12px; }
.rrow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.rota-day .section-title { margin: 18px 0 8px; }

/* ---------- Bars (dashboard) ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.timeline-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); align-items: center; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item .t { font-family: var(--mono); font-weight: 700; width: 52px; }
details.trip { border-bottom: 1px solid var(--line-2); }
details.trip:last-child { border-bottom: 0; }
details.trip > summary { list-style: none; cursor: pointer; border-bottom: 0; border-radius: 10px; }
details.trip > summary::-webkit-details-marker { display: none; }
details.trip > summary:hover { background: var(--gold-soft); }
.trip-chev { display: inline-flex; color: var(--muted); transition: transform .15s; }
.trip-chev svg { width: 16px; height: 16px; }
details.trip[open] .trip-chev { transform: rotate(90deg); }
.trip-body { padding: 4px 0 14px 64px; }
.trip-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.trip-facts label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.trip-facts b svg { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- Clients ---------- */
.loc { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.loc .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--gold-soft); color: var(--gold-strong); display: grid; place-items: center; flex: none; }
.loc .ico svg.i { width: 16px; height: 16px; }

/* ---------- Reports ---------- */
.report { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.report .ico { width: 42px; height: 42px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-text); display: grid; place-items: center; }
.report h3 { margin: 0; font-size: 15.5px; }
.report p { margin: 0; color: var(--muted); font-size: 13px; flex: 1; }

/* ---------- Modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(28,27,25,.35); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.modal { background: var(--card); border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: rise .18s ease; border: 1px solid var(--line); }
.modal.wide { max-width: 760px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 14px 22px; border-bottom: 1px solid var(--line-2); }
.modal-h h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-b { padding: 18px 22px; overflow-y: auto; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line-2); }
.modal-err { margin-bottom: 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #fff; color: var(--text); border: 1px solid var(--line); padding: 11px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; animation: rise .2s ease; max-width: 92vw; }
.toast svg.i { color: var(--ok); }
.toast.err svg.i { color: var(--bad); }
.toast-act { pointer-events: auto; margin-left: 4px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--gold); background: #fff; color: var(--text); border-radius: 8px; padding: 4px 10px; font: inherit; font-weight: 600; cursor: pointer; }
.toast-act:hover { background: var(--gold-soft); }
.toast-act svg.i { color: inherit !important; width: 14px; height: 14px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive: tablet (icon rail) ---------- */
@media (max-width: 1100px) {
  :root { --side: 76px; }
  .side-brand { justify-content: center; padding: 16px 0 10px; }
  .side-brand div, .nav-group, .nav-link span, .side-foot .who { display: none; }
  .side nav { padding: 6px 12px; }
  .nav-link { justify-content: center; padding: 11px 0; }
  .nav-link svg.i { width: 20px; height: 20px; }
  .side-foot { flex-direction: column; padding: 10px 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 20px 20px 40px; }
  .topbar { padding: 12px 20px; }
}

/* ---------- Responsive: phone ---------- */
@media (max-width: 720px) {
  :root { --side: 270px; }
  body { font-size: 15px; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .shell.drawer .side { transform: none; }
  .shell.drawer .scrim { display: block; position: fixed; inset: 0; background: rgba(28,27,25,.3); z-index: 35; }
  .side-brand { justify-content: flex-start; padding: 18px; }
  .side-brand div, .nav-group, .nav-link span, .side-foot .who { display: block; }
  .nav-link { justify-content: flex-start; padding: 11px 12px; }
  .side-foot { flex-direction: row; padding: 12px; }
  .topbar { padding: 10px 14px; min-height: 58px; flex-wrap: wrap; }
  .topbar .menu-btn { display: inline-grid; margin-left: -6px; }
  .topbar h2 { font-size: 17px; }
  .topbar .actions { width: 100%; margin-left: 0; justify-content: flex-start; order: 10; }
  .topbar .actions:empty { display: none; }
  .uae-clock { padding: 4px 8px; font-size: 12.5px; }
  .content { padding: 14px 16px 90px; }
  .kpis { gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .value { font-size: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .runs { grid-template-columns: 1fr; }
  .modal-bg { align-items: end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; }
  .modal-f .btn { flex: 1; justify-content: center; height: 44px; }
  .datenav { flex: 1 1 100%; }
  .trip-body { padding-left: 0; }
  .datenav .input { flex: 1; width: auto; min-width: 0; }
  .toolbar > .btn, .toolbar > .search { flex: 1 1 auto; }
  .input, select.input { height: 44px; font-size: 16px; }
  .input.input-sm { height: 36px; font-size: 14px; }
  .roster-wrap { max-height: calc(100vh - 260px); }
  .driver-head .stat { padding: 0 4px; }
  .start-row { flex-wrap: wrap; }
  .start-row .who { flex-basis: calc(100% - 44px); }
  .start-row .btn { flex: 1; justify-content: center; height: 40px; }
  .route-sum .btn { flex: 1; justify-content: center; height: 40px; }
  .driver-head .big { font-size: 18px; }

  /* tables collapse into cards */
  table.t.stack-sm thead { display: none; }
  table.t.stack-sm, table.t.stack-sm tbody, table.t.stack-sm tr, table.t.stack-sm td { display: block; width: 100%; }
  table.t.stack-sm tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.t.stack-sm td { border: 0; padding: 3px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  table.t.stack-sm td::before { content: attr(data-l); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex: none; }
  table.t.stack-sm td.primary { font-size: 15px; font-weight: 700; justify-content: flex-start; text-align: left; }
  table.t.stack-sm td.primary::before { display: none; }
  table.t.stack-sm td.actions { justify-content: flex-end; padding-top: 6px; }
  table.t.stack-sm td.actions::before { display: none; }

  .bottom-nav.on {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(20,18,10,.05);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; border-radius: 10px; }
  .bottom-nav a.active { color: var(--gold-text); background: var(--gold-soft); }
  .bottom-nav svg.i { width: 22px; height: 22px; }
}

@media print {
  .side, .topbar, .bottom-nav { display: none !important; }
  .content { padding: 0; }
}

/* native date/time pickers: keep text from colliding with the icon */
input[type="time"].input, input[type="date"].input { min-width: 0; }
.run-h input[type="time"] { width: 118px !important; }

/* ---------- smoothness ---------- */
html { scroll-behavior: smooth; }
.content.enter { animation: page .18s ease-out; }
@keyframes page { from { opacity: 0; transform: translateY(4px); } }
.card, .btn, .chip, .input { will-change: auto; }
.btn, .chip, .nav-link, .icon-btn, .input { transition-duration: .12s; }
.skeleton { display: grid; gap: 14px; }
.skeleton i { display: block; height: 84px; border-radius: var(--radius); background: linear-gradient(90deg, #f1f0ec 25%, #f8f7f4 50%, #f1f0ec 75%); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; }
.skeleton i:first-child { height: 46px; width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

@media (max-width: 720px) {
  .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  table.t.stack-sm td.empty { display: none; }
}

/* ---------- Menu badges ---------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }
.bottom-nav a { position: relative; }
.bottom-nav .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; }
@media (max-width: 1100px) and (min-width: 721px) {
  .nav-link { position: relative; }
  .nav-link .nav-badge { position: absolute; top: 4px; right: 8px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
}

/* ---------- Master rota (two layers per cell) ---------- */
.dc { display: inline-flex; align-items: center; gap: 3px; height: 19px; padding: 0 6px; border-radius: 6px; font-family: var(--font); font-size: 11px; font-weight: 800; letter-spacing: .02em;
  color: var(--c, #64748b); background: color-mix(in srgb, var(--c, #64748b) 12%, #fff); border: 1px solid color-mix(in srgb, var(--c, #64748b) 28%, transparent); white-space: nowrap; }
.dc small { font-weight: 600; font-size: 10px; opacity: .85; }
.rota2 .nm small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.rota2 .cell2 { position: relative; min-width: 112px; height: 52px; padding: 4px 6px; text-align: center; vertical-align: middle; cursor: pointer; transition: background .1s; }
.rota2 .cell2:hover { background: var(--gold-soft); }
.rota2 .cell2 .l1 { display: flex; gap: 4px; justify-content: center; align-items: center; flex-wrap: wrap; }
.rota2 .cell2 .badge { height: 19px; font-size: 10.5px; padding: 0 6px; }
.van { display: flex; align-items: center; justify-content: center; gap: 3px; margin-top: 3px; font-size: 10.5px; color: var(--info); font-weight: 600; white-space: nowrap; overflow: hidden; max-width: 150px; margin-inline: auto; }
.van span { overflow: hidden; text-overflow: ellipsis; }
.van svg.i { width: 12px; height: 12px; }
.van.none { color: var(--warn); }
.rota2 .cell2.pending { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--warn) 55%, transparent); }
.pdot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.pdot.static { position: static; display: inline-block; }
.rota2 .cell2.saving { opacity: .55; }
.roster.painting .cell2 { cursor: crosshair; }
.roster.painting .cell2:hover { box-shadow: inset 0 0 0 2px var(--gold); }
.plotbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 14px; border: 1px dashed var(--line); border-radius: 12px; background: var(--card); }
.plotbar.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold-soft) 55%, #fff); }
.plotbar .input { width: auto; min-width: 150px; }
.plotbar .check svg.i { width: 16px; height: 16px; color: var(--gold-strong); }

.celldlg .layer { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.layer-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.layer-h svg.i { color: var(--gold-strong); width: 16px; height: 16px; }
.layer .ro { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.leg { border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: 10px; }
.leg:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.leg-h { display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.leg .field { margin-bottom: 8px; }
.leg .small svg.i { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- Change requests ---------- */
.reqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.req { display: flex; flex-direction: column; overflow: hidden; }
.req-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.req-h .badge svg.i { width: 13px; height: 13px; }
.req-b { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.req-date { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.req-date svg.i { width: 15px; height: 15px; color: var(--gold-strong); }
.req-change { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 12.5px; }
.req-change .from { padding: 4px 8px; border-radius: 7px; background: var(--line-2); color: var(--muted); }
.req-change .to { padding: 4px 8px; border-radius: 7px; background: var(--gold-soft); color: var(--gold-text); font-weight: 700; }
.req-change svg.i { width: 15px; height: 15px; color: var(--muted); }
.req-reason { font-size: 13px; color: var(--text); background: var(--card-2); border-left: 3px solid var(--gold); padding: 6px 10px; border-radius: 0 8px 8px 0; }
.req-f { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-2); background: var(--card-2); }
.req .alert { margin-bottom: 0; }
.req.mine.cancelled, .req.mine.resubmitted { opacity: .6; }

/* ---------- Staff portal ---------- */
.month-name { min-width: 150px; text-align: center; font-size: 14px; }
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cal { overflow: hidden; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); padding: 10px 8px 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 0 8px 12px; }
.cal-day { position: relative; min-height: 92px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  border-top: 3px solid var(--c, transparent); transition: border-color .1s, box-shadow .1s; font: inherit; color: inherit; }
.cal-day:hover { border-color: var(--gold); }
.cal-day.other { opacity: .45; }
.cal-day.blank { visibility: hidden; cursor: default; }
.cal-grid.one, .cal-head.one { grid-template-columns: 1fr; text-align: left; }
.cal-head.one { padding-left: 12px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); }
.cal-grid.one .cal-day { min-height: 120px; padding: 12px; align-items: flex-start !important; }
.cal-grid.one .cal-day .c2, .cal-grid.one .cal-day .c3 { display: flex !important; }
.cal-day.today .num { background: var(--gold); color: #1a1505; }
/* past days: dithered (dotted grey, colours washed out) — still tappable to look back */
.cal-day.past, .past-key { background: radial-gradient(#d9d6ce 0.8px, #f7f6f2 0.9px) 0 0 / 5px 5px; border-top-color: #cfccc4; }
.cal-day.past > * { filter: grayscale(1); opacity: .55; }
.cal-day.past.sel > * { opacity: .85; }
.past-key { display: inline-block; width: 16px; height: 12px; border-radius: 3px; border: 1px solid var(--line); }
.roster.group th.past { opacity: .5; }
.roster.group td.gcell.past { background: radial-gradient(#e2dfd8 0.8px, #faf9f6 0.9px) 0 0 / 5px 5px; }
.roster.group td.gcell.past > * { filter: grayscale(1); opacity: .55; }
.cal-day.sel { box-shadow: 0 0 0 2px var(--gold); border-color: var(--gold); }
.cal-day .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }
.cal-day .c2 .badge { height: 18px; font-size: 10px; padding: 0 5px; }
.cal-day .c3 { display: flex; align-items: center; gap: 3px; font-size: 10.5px; color: var(--info); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day .c3 svg.i { width: 12px; height: 12px; }
.rq { position: absolute; top: 7px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); display: grid; place-items: center; }
.rq.returned { background: var(--info); }
.rq.rejected { background: none; width: auto; height: auto; color: var(--bad); }
.rq.rejected svg.i { width: 13px; height: 13px; }
.rq.static { position: static; display: inline-block; }
.day-panel { position: sticky; top: 84px; }
.shift-big { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--c) 9%, #fff); border-left: 4px solid var(--c); margin-bottom: 12px; }
.shift-big > .code { font-family: var(--font); font-size: 22px; font-weight: 800; color: var(--c); min-width: 44px; text-align: center; }
.ride { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.ride-h { display: flex; align-items: center; gap: 8px; }
.ride-h svg.i { width: 16px; height: 16px; color: var(--gold-strong); }
.ride .btn { align-self: flex-start; margin-top: 4px; }
.ask { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ask .btn { flex: 1 1 auto; justify-content: center; }
.ro-line { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--card-2); font-size: 13.5px; margin-bottom: 14px; }
.ro-line svg.i { width: 16px; height: 16px; color: var(--gold-strong); }
.req-types { display: flex; width: 100%; }
.req-types button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.req-types svg.i { width: 15px; height: 15px; }
.tabs button svg.i { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; }
.roster.group .gcell { min-width: 96px; height: 42px; text-align: center; }
.roster.group .gcell .dc { margin-right: 3px; }
.roster.group .gcell .badge { height: 19px; font-size: 10.5px; padding: 0 6px; }
.roster.group tr.me td { background: var(--gold-soft); }
.roster.group tr.me td.nm { background: var(--gold-soft); }

/* ---------- Driver: lifecycle, telematics, notices ---------- */
.drv-tabs { display: flex; margin-bottom: 14px; }
.drv-tabs button { flex: 1; }
.notice { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; border-bottom: 1px solid color-mix(in srgb, var(--warn) 20%, transparent); }
.notice svg.i { flex: none; }
.duty.cancelled { opacity: .7; border-left-color: var(--bad); }
.steps-line { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 16px 12px; }
.steps-line .sl { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.steps-line .sl i { display: block; height: 5px; border-radius: 99px; background: var(--line); margin-bottom: 4px; }
.steps-line .sl.on i { background: var(--gold); }
.steps-line .sl.on b { color: var(--text); }
.steps-line .sl small { font-family: var(--mono); font-size: 11.5px; min-height: 15px; }
.telem { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-2); background: var(--card-2); }
.telem small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.telem b { font-family: var(--mono); font-size: 13.5px; white-space: nowrap; }
.telem.trip-log { grid-template-columns: repeat(5, minmax(0, 1fr)) auto; border: 1px solid var(--line-2); border-radius: 10px; margin: 10px 0 0; padding: 10px 12px; }
.telem.trip-log.need { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 5%, #fff); }
@media (max-width: 900px) { .telem.trip-log { grid-template-columns: repeat(3, minmax(0, 1fr)); } .telem.trip-log .btn { grid-column: 1 / -1; justify-content: center; } }
.stop.done .who b { text-decoration: line-through; color: var(--muted); }
.stop .pin.tick { border: 2px solid var(--gold); background: #fff; color: var(--gold-text); cursor: pointer; }
.stop.done .pin, .stop.done .pin.tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.stop .pin svg.i { width: 15px; height: 15px; }
.stop .go.set { background: var(--line-2); color: var(--muted); padding: 0; width: 40px; border: 0; cursor: pointer; }
.eta.live { color: var(--info); background: var(--info-bg); }
.eta.manual { color: #1a1505; background: var(--gold); }
.duty-actions .btn-ghost { flex: 0 0 auto; }

@media (max-width: 900px) {
  .cal-wrap { grid-template-columns: 1fr; }
  .day-panel { position: static; }
}
@media (max-width: 720px) {
  .reqs { grid-template-columns: 1fr; }
  .cal-grid { gap: 3px; padding: 0 4px 8px; }
  .cal-head { padding: 8px 4px 4px; font-size: 10.5px; }
  .cal-day { min-height: 62px; padding: 4px 3px; border-radius: 8px; gap: 2px; align-items: center; }
  .cal-day .num { width: 22px; height: 22px; font-size: 12px; }
  .cal-day .dc { padding: 0 4px; font-size: 10px; height: 18px; }
  .cal-day .dc small, .cal-day .c2, .cal-day .c3 { display: none; }
  .rq { top: 3px; right: 3px; width: 7px; height: 7px; }
  .rq.rejected svg.i { width: 10px; height: 10px; }
  .rq.rejected { top: 2px; right: 2px; }
  .month-name { min-width: 0; flex: 1; }
  .telem { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telem .btn { grid-column: 1 / -1; justify-content: center; height: 40px; }
  .plotbar .input { flex: 1 1 140px; min-width: 0; }
  .req-f .btn { height: 38px; }
  .ask .btn { height: 40px; }
}

/* ---------- Standard period filter (Today · Week · Custom) ---------- */
.period { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period .datenav .input { width: 140px; }
.period .datenav .muted { padding: 0 2px; }

/* ---------- Notification bell ---------- */
.bell-btn { position: relative; color: var(--muted); }
.bell-btn.has { color: var(--warn); }
.bell-count { position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center; }
.bell-panel { position: absolute; top: calc(100% + 6px); right: 16px; width: min(420px, calc(100vw - 32px)); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden; animation: rise .15s ease; }
.bell-h { display: flex; align-items: center; padding: 10px 10px 8px 16px; border-bottom: 1px solid var(--line-2); }
.bell-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); text-decoration: none; font-size: 13.5px; }
.bell-item:last-child { border-bottom: 0; }
.bell-item:hover { background: var(--card-2); }
/* account menu (phones) */
.me-btn { display: none; }
.me-btn .avatar.sm { width: 30px; height: 30px; }
.me-btn:hover { background: transparent; }
.me-panel { width: min(280px, calc(100vw - 32px)); }
.me-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.me-h b { display: block; font-size: 14px; }
.me-h small { color: var(--muted); font-size: 12px; text-transform: capitalize; }
button.bell-item { width: 100%; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.me-out, .me-out svg.i { color: var(--bad); }
.acct-out { align-self: flex-start; }
.bell-item.warn > svg.i { color: var(--warn); }
.bell-item.bad > svg.i { color: var(--bad); }
.bell-item.info > svg.i { color: var(--info); }
.bell-item .btn { pointer-events: none; }
.bell-empty { display: flex; align-items: center; gap: 10px; padding: 18px 16px; color: var(--ok); font-size: 13.5px; }
.login-help { text-align: center; color: var(--muted); font-size: 12px; margin: 12px 0 0; }

/* ---------- Dashboard: trips edited in place ---------- */
details.trip .codes { display: inline-flex; gap: 4px; flex-wrap: wrap; flex: 0 0 170px; }
/* Trip ID beside the time: fixed width, so time, ID, codes and title line up from trip to trip */
details.trip .trip-id { flex: 0 0 auto; min-width: 112px; font: 600 11.5px/1 var(--mono); letter-spacing: .02em; color: var(--gold-text, #8a6d12);
  background: var(--gold-soft, #f6ecca); border-radius: 6px; padding: 5px 7px; text-align: center; }
.trip-edit .sub { margin-top: 4px; }
details.trip.is-done > summary { opacity: .5; filter: grayscale(.85); }
details.trip.is-done[open] > summary { opacity: .75; }
details.trip.is-done > .trip-body { opacity: .8; }
details.trip.is-late > summary { box-shadow: inset 3px 0 0 var(--bad); background: var(--bad-bg); }
details.trip.is-cancelled > summary { opacity: .45; text-decoration: line-through; }
.no-driver { color: var(--warn); font-weight: 700; }
.day-head { font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-text); padding: 16px 0 6px; border-bottom: 1px solid var(--line); }
.day-head:first-child { padding-top: 8px; }
.trip-body { padding: 4px 4px 16px 64px; }
.trip-edit { display: grid; grid-template-columns: 130px repeat(2, minmax(0, 1fr)) 170px; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); margin-bottom: 10px; }
.trip-edit label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.trip-edit .flag { color: var(--bad); text-transform: none; letter-spacing: 0; }
.trip-edit.extra-route { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* additional trip: its typed-in route */
.input.bad { border-color: var(--bad); }
.trip-body .run-route { margin: 0 0 10px; border: 1px solid var(--line-2); border-radius: 10px; }
.pax-t td, .pax-t th { padding: 8px 10px; }
.pax-t td, .pax-t th { vertical-align: middle; padding-left: 7px; padding-right: 7px; }
.pax-t td.primary { min-width: 130px; }
.pax-t td.actions .btn { padding: 0 8px; }
.pax-t th.sel, .pax-t td.sel { width: 36px; padding-right: 0; }
.pax-t .pick { width: 16px; height: 16px; display: block; }
.pax-t th.num, .pax-t td.num { width: 30px; text-align: center; }
.pax-t td.actions, .pax-t th.actions { white-space: nowrap; text-align: right; }
.pax-t th.actions .badge { font-size: 10px; text-transform: none; letter-spacing: 0; margin-left: 4px; }
/* Pick up / Drop: a dropdown of locations and a pin to its map */
.stop-cell { display: flex; align-items: center; gap: 4px; min-width: 150px; }
.stop-cell select { flex: 1; min-width: 0; }
.stop-pin { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--info); background: var(--info-bg, #eef4ff); }
.stop-pin svg.i { width: 15px; height: 15px; }
.stop-pin.warn, .stop-pin.missing { color: var(--warn); background: var(--warn-bg, #fff6e5); }
.reorder { display: inline-flex; gap: 0; margin-right: 4px; vertical-align: middle; }
.reorder .icon-btn { width: 28px; height: 28px; }
.reorder .icon-btn:disabled { opacity: .3; cursor: default; }
.trip-foot .sel-count { color: var(--muted); margin-left: 6px; }
.trip-foot .sel-count b { color: var(--text); }
.pax-t td.actions .icon-btn { width: 30px; height: 30px; vertical-align: middle; }
.trip-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.move-opt { justify-content: flex-start; height: auto; padding: 10px 12px; gap: 8px; flex-wrap: wrap; }

/* ---------- Users ---------- */
.role-cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.role-card { text-align: left; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; }
.role-card.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.danger-zone .card-h svg.i { color: var(--bad); }
.danger-zone .btn { justify-content: center; }

/* ---------- Master rota as a spreadsheet ---------- */
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: #fff; color: var(--text); }
.sheet { outline: none; }
.sheet:focus-visible { box-shadow: 0 0 0 2px var(--gold-soft); }
.sheet .cell2 { user-select: none; -webkit-user-select: none; }
.rota2 .cell2.sel { background: color-mix(in srgb, var(--gold-soft) 75%, #fff); }
.rota2 .cell2.act { box-shadow: inset 0 0 0 2px var(--gold); background: var(--gold-soft); }
.rota2 .cell2.locked { background: repeating-linear-gradient(135deg, #fff 0 6px, #f8f6f0 6px 12px); }
/* past days: dithered */
.rota2 .cell2.past { background: radial-gradient(#e2dfd8 0.8px, #faf9f6 0.9px) 0 0 / 5px 5px; }
.rota2 .cell2.past > :not(.lk) { filter: grayscale(1); opacity: .55; }
.rota2 .cell2.past.sel, .rota2 .cell2.past.act { background: var(--gold-soft); }
.rota2 thead th.past { color: var(--muted); opacity: .6; }
.rota2 .cell2.locked.sel { background: repeating-linear-gradient(135deg, var(--gold-soft) 0 6px, #f3e6bd 6px 12px); }
.rota2 .cell2 .lk { position: absolute; bottom: 3px; right: 3px; color: var(--muted); display: inline-flex; }
.rota2 .cell2 .lk svg.i { width: 11px; height: 11px; }
.rota2 .cell2.editing { padding: 2px; box-shadow: inset 0 0 0 2px var(--gold); background: #fff; }
.cell-input { width: 100%; height: 34px; border: 0; outline: none; text-align: center; font: 700 13px var(--mono); text-transform: uppercase; background: transparent; }
.cell-hint { display: block; font-size: 10px; color: var(--gold-text); font-weight: 700; }
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px 8px 14px; margin-bottom: 12px; border: 1px solid var(--gold); border-radius: 12px; background: color-mix(in srgb, var(--gold-soft) 55%, #fff); box-shadow: var(--shadow); font-size: 13px; }
.bulkbar .input { width: auto; min-width: 150px; }
.bulkbar .badge svg.i { width: 12px; height: 12px; }
.bulkbar { min-height: 50px; }
.bulkbar.idle { border-color: var(--line); background: var(--card); box-shadow: none; }
.bulkbar.idle .legend { margin: 0; }
.help-tip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: help; white-space: nowrap; }
.help-tip svg.i { color: var(--gold-strong); width: 15px; height: 15px; }
/* Fixed columns: the name column stays narrow and the days share the rest, so a week fits and one day fills the width. */
.rota2 { table-layout: fixed; min-width: calc(200px + var(--days, 7) * 100px); }
.rota2 col.c-nm { width: 200px; }
.rota2 .nm { min-width: 0; max-width: none; }
.rota2 .cell2 { min-width: 0; }
/* Week cells: chips and the vehicle line stay centred under the day header; long text shortens with … instead of spilling sideways. */
.rota2 .cell2 .l1 { min-width: 0; }
.rota2 .cell2 .van { max-width: 100%; }
.rota2:not(.one-day) .cell2.locked:not(.editing) { padding-right: 14px; }
.van span { min-width: 0; }
/* One day: shift | transport | vehicle in fixed columns, left-aligned next to the name. */
.rota2.one-day { min-width: 760px; }
.rota2.one-day col.c-nm { width: 240px; }
.rota2.one-day .cell2 { text-align: left; padding: 6px 30px 6px 14px; height: 56px; }
.day1 { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.3fr) minmax(200px, 1.6fr); gap: 16px; align-items: center; }
.day1.l-shift { grid-template-columns: minmax(150px, 1fr) minmax(180px, 2.9fr); }
.day1.l-van { grid-template-columns: minmax(200px, 1fr); }
.day1 > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.day1 small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.day1 .badge, .day1 .dc { flex: none; height: 22px; font-size: 12px; padding: 0 9px; }
.day1 .muted { font-size: 12px; }
.day1 .d-van { flex-direction: column; align-items: flex-start; gap: 2px; }
.day1 .d-van > div { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--info); white-space: nowrap; min-width: 0; max-width: 100%; overflow: hidden; }
.day1 .d-van > div.none { color: var(--warn); }
.day1 .d-van span { font-family: var(--mono); font-weight: 600; }
.day1 .d-van span.muted { font-family: var(--font); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.day1 .d-van svg.i { width: 14px; height: 14px; flex: none; }
.rota2.one-day .cell2 .lk { top: 50%; bottom: auto; right: 10px; transform: translateY(-50%); }
.rota2.one-day .cell2 .lk svg.i { width: 13px; height: 13px; }

/* ---------- Change requests: rows grouped by day ---------- */
.req-t tr.grp td { background: var(--card-2); font-size: 12.5px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.req-t tr.grp svg.i { width: 14px; height: 14px; color: var(--gold-strong); vertical-align: -2px; margin-right: 6px; }
.req-t tr.child td:first-child { box-shadow: inset 3px 0 0 var(--gold-soft); }
.req-t td { vertical-align: top; }
.req-t .req-change { font-size: 12px; }
.req-why { margin-top: 4px; color: var(--muted); font-style: italic; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

@media (max-width: 1100px) {
  .trip-edit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .period { width: 100%; }
  .period .tabs { flex: 1 1 100%; }
  .period .tabs button { flex: 1; }
  .period .datenav { flex: 1 1 100%; }
  .period .datenav .input { flex: 1; width: auto; }
  .trip-body { padding: 4px 0 14px; }
  .trip-edit { grid-template-columns: 1fr 1fr; }
  details.trip .codes { flex-basis: auto; }
  .rota2 { min-width: calc(150px + var(--days, 7) * 92px); }
  .rota2 col.c-nm { width: 150px; }
  .rota2.one-day { min-width: 0; }
  .rota2.one-day col.c-nm { width: 130px; }
  .rota2.one-day .cell2 { height: auto; padding: 6px 24px 6px 8px; }
  .day1, .day1.l-shift, .day1.l-van { grid-template-columns: 1fr; gap: 3px; }
  .bulkbar.idle .legend { display: none; }
  .bulkbar .input { flex: 1 1 140px; min-width: 0; }
  .bell-panel { right: 8px; }
  .topbar .bell-btn { order: 2; }
  .topbar .me-btn { display: inline-grid; order: 2; margin-right: -6px; }
  .topbar .actions { order: 3; }
  details.trip > summary { flex-wrap: wrap; row-gap: 4px; }
  details.trip > summary .t { order: 1; width: auto; }
  details.trip > summary .trip-id { order: 1; min-width: 0; }
  details.trip > summary .codes { order: 2; max-width: none; }
  details.trip > summary > .badge, details.trip > summary > [data-st] { order: 3; margin-left: auto; }
  /* phones: tick box and number share one line above the name */
  table.t.stack-sm.pax-t td.sel, table.t.stack-sm.pax-t td.num { display: inline-flex; width: auto; padding: 0 10px 0 0; vertical-align: middle; }
  table.t.stack-sm.pax-t td.sel::before, table.t.stack-sm.pax-t td.num::before { display: none; }
  .pax-t td.primary { min-width: 0; }
  details.trip > summary .trip-chev { order: 4; }
  details.trip > summary .grow { order: 5; flex: 1 1 100%; padding-left: 2px; }
  .req-t tr.grp { display: block; }
}
.bulkbar.idle span { flex: 1; min-width: 0; }

/* WhatsApp alerts: template text with a copy button */
.wa-tpl { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; margin-top: 6px; padding: 8px 10px; background: var(--line-2); border-radius: 10px; color: var(--text); }
.wa-tpl code { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.wa-tpl .btn { flex: none; }
.wa-text { max-width: 460px; white-space: normal; }

/* Driver trip cards fold to the header: tap the header to show or hide the stops */
.duty-top[data-fold] { cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
.fold-chev { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 99px; background: var(--line-2); color: var(--muted); transition: transform .2s; transform: rotate(180deg); }
.duty.collapsed .fold-chev { transform: none; }
.duty-peek { display: none; padding: 0 16px 12px; font-size: 13px; color: var(--muted); }
.duty-peek span { display: block; font-weight: 600; }
.duty-peek small { display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.duty.collapsed .duty-peek { display: block; }
.duty.collapsed .duty-body, .duty.collapsed .open-only { display: none; }

/* ---------- Dashboard: each trip and each upload is its own row card ---------- */
.trip-list { padding: 12px 14px 14px; background: var(--card-2); border-radius: 0 0 var(--radius) var(--radius); }
.trip-list details.trip { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 0 0 8px; box-shadow: var(--shadow); }
.trip-list details.trip:last-child { margin-bottom: 0; border-bottom: 1px solid var(--line); }
.trip-list details.trip > summary { padding: 11px 14px; border-radius: 11px; }
.trip-list details.trip[open] { border-color: var(--gold); }
.trip-list details.trip[open] > summary { border-radius: 11px 11px 0 0; border-bottom: 1px solid var(--line-2); }
.trip-list details.trip.is-late { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.trip-list details.trip.is-late > summary { box-shadow: inset 4px 0 0 var(--bad); }
.trip-list .trip-body { padding: 12px 14px 14px; }
.trip-list .day-head { margin: 6px 2px 8px; }
.trip-list .day-head:first-child { margin-top: 0; }
.row-list { padding: 12px 14px 14px; background: var(--card-2); border-radius: 0 0 var(--radius) var(--radius); }
.row-list table.t { border-collapse: separate; border-spacing: 0 8px; margin: -8px 0; }
.row-list table.t td { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.row-list table.t tr:last-child td { border-bottom: 1px solid var(--line); }
.row-list table.t td:first-child { border-left: 1px solid var(--line); border-radius: 12px 0 0 12px; }
.row-list table.t td:last-child { border-right: 1px solid var(--line); border-radius: 0 12px 12px 0; }
.row-list table.t tr:hover td { background: var(--ink-surface); }
@media (max-width: 720px) {
  .trip-list, .row-list { padding: 10px; }
  .trip-list .trip-body { padding: 10px 12px 12px; }
  .row-list table.t { border-spacing: 0; margin: 0; }
  .row-list table.t.stack-sm tr { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
  .row-list table.t.stack-sm tr:last-child { margin-bottom: 0; }
  .row-list table.t.stack-sm td, .row-list table.t.stack-sm td:first-child, .row-list table.t.stack-sm td:last-child { background: none; border: 0; border-radius: 0; }
}

/* ---------- Desktop: menu folds to an icon rail ---------- */
.side-toggle {
  display: flex; align-items: center; gap: 12px; margin: 0 10px 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.side-toggle:hover { background: #f4f3ef; color: var(--text); }
.side-toggle svg.i { width: 16px; height: 16px; }
.side, .main { transition: width .18s ease; }
@media (min-width: 1101px) {
  .shell.side-mini { --side: 76px; }
  .shell.side-mini .side-brand { justify-content: center; padding: 16px 0 10px; }
  .shell.side-mini .side-brand div, .shell.side-mini .nav-group, .shell.side-mini .nav-link span, .shell.side-mini .side-foot .who, .shell.side-mini .side-toggle span { display: none; }
  .shell.side-mini .side nav { padding: 6px 12px; }
  .shell.side-mini .nav-link { justify-content: center; padding: 11px 0; position: relative; }
  .shell.side-mini .nav-link svg.i { width: 20px; height: 20px; }
  .shell.side-mini .nav-link .nav-badge { position: absolute; top: 4px; right: 8px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .shell.side-mini .side-toggle { justify-content: center; margin: 0 12px 8px; padding: 8px 0; }
  .shell.side-mini .side-foot { flex-direction: column; padding: 10px 0; }
}
/* Tablet already shows the rail; phones use the drawer. */
@media (max-width: 1100px) { .side-toggle { display: none; } }

/* ---------- Master rota: legend behind (i), floating selection bar, taller grid ---------- */
.legend-tip { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: help; white-space: nowrap; outline: none; }
.legend-tip > svg.i { color: var(--gold-strong); width: 16px; height: 16px; }
.legend-tip:hover, .legend-tip:focus-within { border-color: var(--gold); color: var(--text); }
.legend-pop {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; z-index: 25; width: min(420px, calc(100vw - 32px)); padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); white-space: normal; cursor: default;
  font-weight: 400; color: var(--text);
}
.legend-pop > b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 0 4px; }
.legend-pop > b:first-child { margin-top: 0; }
.legend-pop .legend { margin: 0; }
.legend-pop p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.legend-tip:hover .legend-pop, .legend-tip:focus-within .legend-pop { display: block; }
.bulkbar[hidden] { display: none; }
#bulk.bulkbar { position: fixed; z-index: 28; bottom: 18px; left: calc(var(--side) + 28px); right: 28px; margin: 0; box-shadow: var(--shadow-lg); background: #fff; }
.sheet.roster-wrap { max-height: calc(100vh - 170px); max-height: calc(100dvh - 170px); }
@media (max-width: 720px) {
  #bulk.bulkbar { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  .legend-tip span { display: none; }
  .legend-pop { position: fixed; top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; }
  .sheet.roster-wrap { max-height: calc(100dvh - 230px); }
}

/* ---------- Master rota (v2 layout): filter card, # / name / shift-type columns, tinted shift tiles, legend footer ---------- */
.rota-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; padding: 14px 16px; margin-bottom: 14px; }
.rota-filters .period { align-self: flex-end; }
.ff { display: flex; flex-direction: column; gap: 4px; }
.ff > span { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ff .input { width: 150px; height: 38px; }
.rota-filters .search { min-width: 180px; }
.rota-filters > .check { height: 38px; white-space: nowrap; }
.rota-filters .search .input { height: 38px; }
.rf-row { flex: 1 1 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: -2px; }
.rota-card { overflow: hidden; }
.rota-card .roster-wrap { border-radius: var(--radius) var(--radius) 0 0; }
.sheet.roster-wrap { max-height: calc(100vh - 300px); max-height: calc(100dvh - 300px); min-height: 320px; }

.rota2 { min-width: calc(334px + var(--days, 7) * 108px); }
.rota2 col.c-no { width: 44px; }
.rota2 col.c-nm { width: 180px; }
.rota2 col.c-ty { width: 110px; }
.rota2 thead th { height: 52px; padding: 8px 6px; background: var(--card-2); border-bottom: 1px solid var(--line); font-size: 11.5px; }
.rota2 thead th b { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.rota2 thead th.today { background: var(--gold-soft); box-shadow: inset 0 -2px 0 var(--gold); }
.rota2 thead th.no, .rota2 thead th.nm, .rota2 thead th.ty { text-align: left; color: var(--text); font-size: 12.5px; font-weight: 700; }
.rota2 .no { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.rota2 .nm { left: 44px; padding: 8px 12px; }
.rota2 .ty { position: sticky; left: 224px; z-index: 1; background: var(--card); padding: 6px 10px; box-shadow: 1px 0 0 var(--line); }
.rota2 thead .no, .rota2 thead .ty { z-index: 3; background: var(--card-2); }
.rota2 tfoot .no, .rota2 tfoot .ty { background: var(--card-2); }
.rota2 tbody tr:hover > td.no, .rota2 tbody tr:hover > td.nm, .rota2 tbody tr:hover > td.ty { background: #fbf8ee; }
.shift-pill { display: inline-flex; align-items: center; max-width: 100%; height: 24px; padding: 0 10px; border-radius: 7px; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: color-mix(in srgb, var(--c) 75%, #1c1b19); background: color-mix(in srgb, var(--c) 14%, #fff); border: 1px solid color-mix(in srgb, var(--c) 28%, #fff); }

.rota2:not(.one-day) .cell2 { height: 60px; padding: 5px 4px; }
.rota2:not(.one-day) .cell2.locked:not(.editing) { padding-right: 6px; }
.rota2 .cell2:hover { background: transparent; }
.tile { height: 100%; min-height: 46px; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 4px 7px; border-radius: 8px; text-align: left; min-width: 0;
  background: color-mix(in srgb, var(--c) 13%, #fff); border: 1px solid color-mix(in srgb, var(--c) 30%, #fff); transition: border-color .1s, box-shadow .1s; }
.cell2:hover .tile { border-color: color-mix(in srgb, var(--c) 60%, #fff); }
.tile.empty { --c: #a8a49b; align-items: center; color: var(--muted); background: #f6f5f1; border-color: #eeece6; }
.tile.off { --c: #9ca3af; align-items: flex-start; }
.tile .t1, .tile .t2 { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; line-height: 1.2; }
.tile .t1 { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--c) 70%, #1c1b19); }
.tile .t1 span, .tile .t2 span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tile .t2 { font-size: 11px; color: var(--muted); gap: 4px; }
.tile b { font-weight: 800; color: color-mix(in srgb, var(--c) 75%, #1c1b19); }
.tile .t2 b:not(.dcode) { font-weight: 700; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tile .dcode { flex: none; padding: 0 5px; border-radius: 4px; background: color-mix(in srgb, var(--c) 18%, #fff); font-size: 10.5px; line-height: 16px; }
.tile i.bus { display: inline-flex; flex: none; color: color-mix(in srgb, var(--c) 70%, #1c1b19); }
.tile i.bus svg.i { width: 12px; height: 12px; }
.tile i.bus.none { color: var(--warn); }
.rota2 .cell2.sel .tile { box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 55%, transparent); }
.rota2 .cell2.act .tile { box-shadow: 0 0 0 2px var(--gold); }
.rota2 .cell2.pending .tile { border-style: dashed; border-color: var(--warn); }
.rota2 .cell2.pending { box-shadow: none; }
.rota2:not(.one-day) .cell2 .lk, .lk-ico { position: absolute; top: 8px; right: 10px; bottom: auto; width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; }
.rota2 .cell2 .lk.go, .lk-ico.go { background: var(--ok); }
.rota2 .cell2 .lk.done, .lk-ico.done { background: var(--info); }
.rota2 .cell2 .lk svg.i, .lk-ico svg.i { width: 9px; height: 9px; stroke-width: 3; }
.rota2 .cell2 .pdot { top: 8px; right: 10px; }
.rota2 .cell2.locked .pdot { right: 30px; }
.rota2 .cell2.locked, .rota2 .cell2.locked.sel { background: transparent; }

.rota-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--card-2); font-size: 12px; color: var(--muted); }
.rota-legend > b { color: var(--text); font-size: 12.5px; }
.rota-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rota-legend span svg.i { width: 15px; height: 15px; }
.rota-legend .lk-ico { position: static; }
.rota-legend .legend-tip { height: 30px; }
.rota-legend .legend-pop { top: auto; bottom: calc(100% + 8px); }
.rota-legend .sep { width: 1px; height: 18px; background: var(--line); }
@media (max-width: 720px) {
  .rota-filters { padding: 12px; gap: 10px; }
  .ff { flex: 1 1 calc(50% - 10px); }
  .ff .input { width: 100%; }
  .rota-filters .search { flex: 1 1 100%; }
  .rota2 { min-width: calc(140px + var(--days, 7) * 118px); }
  .rota2 .no, .rota2 .ty, .rota2 col.c-no, .rota2 col.c-ty { display: none; }
  .rota2 .nm { left: 0; }
  .rota2 col.c-nm { width: 140px; }
  .rota-legend .sep { display: none; }
  .sheet.roster-wrap { max-height: calc(100dvh - 260px); }
}
.rota2 .cell2 .lk.go, .rota2 .cell2 .lk.done { color: #fff; width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; }

/* ---------- Master rota: row ticks for group updates, whole-row select, full screen ---------- */
.pickbox { display: flex; align-items: center; justify-content: center; gap: 6px; height: 100%; cursor: pointer; }
.pick { width: 15px; height: 15px; accent-color: var(--gold); cursor: pointer; margin: 0; }
.pickbox span { min-width: 14px; text-align: right; }
.rota2 col.c-no { width: 58px; }
.rota2 .nm { left: 58px; cursor: pointer; }
.rota2 .ty { left: 238px; }
.rota2 .nm:hover { color: var(--gold-text); }
.rota2 tr.picked > td.no, .rota2 tr.picked > td.nm, .rota2 tr.picked > td.ty { background: var(--gold-soft); }
/* ticked rows: only the days the update goes to light up (From–To range and day chips in the bar) */
.rota2 tr.picked > td.cell2.sel { background: color-mix(in srgb, var(--gold-soft) 60%, #fff); }
.rota2 tr.picked .cell2.sel .tile { box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 55%, transparent); }
.sheet.selecting { padding-bottom: 76px; } /* the floating bar never hides the last rows */
body.rota-max .side { display: none !important; } /* top bar stays: Undo / Redo / Excel / PDF live there */
body.rota-max .content { padding: 12px 14px; }
body.rota-max .rota-filters { padding: 10px 14px; margin-bottom: 10px; }
body.rota-max .sheet.roster-wrap { max-height: calc(100vh - 240px); max-height: calc(100dvh - 240px); }
body.rota-max #bulk.bulkbar { left: 28px; }
@media (max-width: 720px) {
  .rota2 .no, .rota2 col.c-no { display: table-cell; }
  .rota2 col.c-no { display: table-column; width: 34px; }
  .pickbox span { display: none; }
  .rota2 .nm { left: 34px; }
  body.rota-max .sheet.roster-wrap { max-height: calc(100dvh - 330px); }
}
.pickbox span { line-height: 15px; }

/* ---------- Rota cells v3: one card per cell (corner code · shift in the middle · transport below), clear rows ---------- */
.tile { position: relative; justify-content: center; gap: 2px; padding: 5px 8px; }
.tile .corner { position: absolute; top: 4px; right: 5px; padding: 0 5px; border-radius: 5px; font-size: 10.5px; line-height: 16px; font-weight: 800;
  color: color-mix(in srgb, var(--c) 75%, #1c1b19); background: color-mix(in srgb, var(--c) 20%, #fff); }
.tile .mid { display: flex; flex-direction: column; min-width: 0; padding-right: 26px; line-height: 1.2; }
.tile .mid b { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--c) 70%, #1c1b19); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .mid small, .tile .mid span { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t2 { margin-top: 1px; }
.rota2:not(.one-day) .cell2 { height: 70px; }
.rota2:not(.one-day) .cell2 .lk, .rota2 .cell2 .pdot { top: auto; bottom: 9px; right: 9px; }
.rota2 .cell2.locked .pdot { right: 29px; }
/* One day: the same card, wider, placed right next to the name */
.rota2.one-day { min-width: 640px; }
.rota2.one-day .cell2 { height: auto; padding: 6px 10px; }
.tile.wide { max-width: 620px; min-height: 58px; padding: 8px 12px; gap: 4px; }
.tile.wide .corner { top: 8px; right: 10px; font-size: 12px; line-height: 20px; padding: 0 8px; }
.tile.wide .mid { flex-direction: row; align-items: baseline; gap: 8px; }
.tile.wide .mid b { font-size: 13px; }
.tile.wide .mid span { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--c) 55%, #1c1b19); }
.tile.wide .tr { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; color: var(--muted); }
.tile.wide .tr .badge { height: 20px; font-size: 11px; padding: 0 7px; flex: none; }
.tile.wide .tr span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.wide .lg { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 0; }
.tile.wide .lg b { color: var(--text); font-weight: 700; }
.tile.wide .lg .tm { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--info); }
.tile.wide .lg.none b { color: var(--warn); }
.tile.wide.empty { align-items: flex-start; padding-left: 14px; font-size: 12px; }
.rota2.one-day .cell2 .lk { top: auto; bottom: 10px; right: auto; left: min(calc(100% - 26px), 604px); transform: none; }
/* Rows: zebra + a clear line, so each person's row stands apart */
.rota2 tbody td { border-bottom: 1px solid var(--line); }
.rota2 tbody tr:nth-child(even) > td { background: #faf9f5; }
.rota2 tbody tr:nth-child(even) > td.past { background: radial-gradient(#e2dfd8 0.8px, #f6f5f0 0.9px) 0 0 / 5px 5px; }
.rota2 tbody tr:hover > td { background: #fbf6e6; }
.rota2 tbody tr:hover > td.no, .rota2 tbody tr:hover > td.nm, .rota2 tbody tr:hover > td.ty { background: #f8efd2; }
.rota2 tbody tr.picked > td:not(.cell2), .rota2 tbody tr.picked > td.cell2.sel { background: color-mix(in srgb, var(--gold-soft) 60%, #fff); }
.rota-filters > .legend-tip { height: 38px; }
.rota-filters > .legend-tip .legend-pop { right: 0; }
@media (max-width: 720px) {
  .rota2.one-day { min-width: 0; }
  .tile.wide .lg span:not(.tm) { display: none; }
}
.rota2:not(.one-day) .tile { padding: 5px 6px; }
.rota2:not(.one-day) .tile .corner { top: 4px; right: 4px; padding: 0 4px; font-size: 9.5px; line-height: 15px; }
.rota2:not(.one-day) .tile .mid { padding-right: 0; }
.rota2:not(.one-day) .tile .mid b { padding-right: 24px; font-size: 11.5px; letter-spacing: -.01em; }
.rota2:not(.one-day) .tile .mid small { padding-right: 0; }
.rota2:not(.one-day) .tile .t2 b:not(.dcode) { flex: none; overflow: visible; } /* the transport code always shows in full; the time gives way */

/* ---------- Master rota v4 (from the user's mockup): page icon, export buttons, range pill, one-row filters, two-line cells, legend ---------- */
.page-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--gold-soft); color: var(--gold-strong); }
.page-ico svg.i { width: 20px; height: 20px; }
.page-ico[hidden] { display: none; }
.ico-xls svg.i { color: #16a34a; }
.ico-pdf svg.i { color: #dc2626; }
.btn.icon-only { width: 38px; height: 38px; padding: 0; justify-content: center; }
/* Period written out ("Sun 25 Oct – Sat 31 Oct 2026"); a click opens the date picker */
.rangenav { display: inline-flex; align-items: center; gap: 2px; height: 38px; padding: 0 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.rangenav .icon-btn { width: 30px; height: 30px; }
.rangepill { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px; border-radius: 7px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; font-variant-numeric: tabular-nums; }
.rangepill:hover { background: var(--line-2); }
.rangepill svg.i { width: 15px; height: 15px; color: var(--gold-strong); }
.rangepill input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; border: 0; padding: 0; }
/* Filters on one row (wraps only on narrow windows) */
.rota-filters { flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.rota-filters .ff > span { text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 600; }
.rota-filters .ff .input { width: 140px; }
.rota-filters .search { flex: 1 1 200px; min-width: 180px; }
.rota-filters .badge.warn { height: 38px; padding: 0 12px; }
/* Grid header: day name over the date, today tagged */
.rota2 thead th { height: 54px; }
.rota2 thead th b { display: block; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); }
.rota2 thead th span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.rota2 thead th.today b, .rota2 thead th.today span { color: var(--gold-text); }
.rota2 .today-tag { display: none; }
/* # column: the row number; the tick box shows on hover, or for every row once ticking has started */
.rota2 .pickbox { position: relative; }
.rota2 .pickbox .pick { display: none; }
.rota2 .pickbox span { min-width: 0; text-align: center; }
.rota2 tr:hover .pickbox .pick, .rota2.picking .pickbox .pick, .rota2 .pickbox .pick:focus-visible { display: block; }
.rota2 tr:hover .pickbox span, .rota2.picking .pickbox span { display: none; }
.rota2 thead .pickbox span { font-weight: 700; color: var(--text); }
/* Week cells: two short lines, nothing cut off */
.rota2:not(.one-day) .cell2 { height: 56px; padding: 4px 4px; }
.rota2:not(.one-day) .tile { min-height: 46px; padding: 5px 8px; gap: 3px; justify-content: center; border-radius: 8px; }
.rota2:not(.one-day) .tile .t1 { display: block; font-size: 12px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: color-mix(in srgb, var(--c) 72%, #1c1b19); }
.rota2:not(.one-day) .tile .t2 { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; min-width: 0; margin: 0; }
.rota2:not(.one-day) .tile .t2 b { flex: none; font-weight: 700; color: color-mix(in srgb, var(--c) 70%, #1c1b19); }
.rota2:not(.one-day) .tile .t2 > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rota2:not(.one-day) .tile .t2 b + span::before { content: '·'; margin-right: 4px; }
.tile .dcode { font-style: normal; font-weight: 800; color: color-mix(in srgb, var(--c) 75%, #1c1b19); }
.tile.off .t1 { color: var(--muted) !important; }
.rota2:not(.one-day) .tile.empty { color: #b9b5ac; }
.rota2:not(.one-day) .cell2.locked .tile .t2 { padding-right: 16px; }
.rota2:not(.one-day) .cell2 .lk, .rota2 .cell2 .pdot { bottom: 9px; right: 9px; }
.rota2:not(.one-day) .cell2.locked .tile .t1 { padding-right: 0; }
/* Legend under the grid */
.rota-legend { gap: 8px 16px; padding: 11px 16px; }
.rota-legend .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.rota-legend em { font-style: normal; font-weight: 800; color: var(--text); }
.rota-legend small { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.rota-legend .warn-t svg.i { color: var(--warn); }
.rota-legend .spacer { flex: 1; }
.rota-legend .legend-tip { height: 30px; }
.rota-legend .legend-pop { right: 0; left: auto; top: auto; bottom: calc(100% + 8px); }
.sheet.roster-wrap { max-height: calc(100vh - 290px); max-height: calc(100dvh - 290px); }
@media (max-width: 1100px) {
  .page-ico { display: none; }
}
@media (max-width: 720px) {
  .rangenav { width: 100%; }
  .rangepill { flex: 1; justify-content: center; }
  .rota-filters .ff .input { width: 100%; }
  .rota-legend .spacer { display: none; }
  .rota-legend .legend-pop { left: 16px; right: 16px; bottom: 16px; }
}
.topbar .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rota2:not(.one-day) .tile { padding: 5px 6px 5px 7px; }
.rota2:not(.one-day) .tile .t1 { font-size: 11.5px; letter-spacing: -.015em; }
.rota-filters .ff .input { width: 132px; }
.rota-filters .search { flex: 1 1 160px; min-width: 150px; }
.rota-filters .tabs button { padding: 7px 12px; }
.rota-filters #layerF { width: 142px; }
.rota-filters .search { flex: 1 1 140px; min-width: 130px; }
@media (max-width: 720px) {
  .rota2 .pickbox .pick { display: block; } /* phones: no hover, so the tick box stays */
  .rota2 .pickbox span { display: none; }
  .rota-filters .ff { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .rota-filters .ff .input, .rota-filters #layerF { width: 100%; }
  .rota-filters .search { flex: 1 1 0; min-width: 0; }
  #pageActions .btn .lbl { display: none; } /* toolbar as icons on phones (titles explain them); Add employee keeps its text */
  #pageActions .btn:has(.lbl) { width: 40px; padding: 0; justify-content: center; }
}
@media (max-width: 720px) {
  .rota-filters .search { flex: 1 1 calc(100% - 52px); }
}
.topbar h2 { white-space: nowrap; }
@media (max-width: 1280px) {
  #pageActions .lbl-x { display: none; } /* "Export Excel" → "Excel" */
  #undoBtn .lbl, #redoBtn .lbl { display: none; }
  #undoBtn, #redoBtn { width: 38px; padding: 0; justify-content: center; }
}

/* ---------- Rota cells v5 (user's layout): duty code top-left · transport code in the middle · pickup time below ---------- */
.dchip { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 10px; line-height: 15px; font-weight: 800; letter-spacing: .01em;
  color: #fff; background: var(--c); }
.rota2:not(.one-day) .cell2 { height: 66px; }
.rota2:not(.one-day) .tile.v4 { min-height: 58px; padding: 4px 6px 4px 6px; gap: 1px; justify-content: flex-start; }
.rota2:not(.one-day) .tile.v4 .t0 { display: flex; line-height: 15px; height: 15px; }
.rota2:not(.one-day) .tile.v4 .t1 { font-size: 12.5px; line-height: 17px; margin-top: 1px; }
.rota2:not(.one-day) .tile.v4:not(:has(.t0)) { justify-content: center; } /* no duty corner: centre the two lines */
.rota2:not(.one-day) .tile.v4 .t2 { font-size: 11px; line-height: 15px; gap: 4px; }
.rota2:not(.one-day) .tile.v4 .t2 b { color: var(--text); font-variant-numeric: tabular-nums; }
.rota2:not(.one-day) .tile.v4 .t2 b + span::before { content: none; }
.rota2:not(.one-day) .tile.v4 .t2 > span { color: var(--muted); }
.rota2:not(.one-day) .tile.v4:has(.bus.none) .t2 > span { color: var(--warn); }
.tile.v4.off .t1 { font-weight: 600; }
.rota2:not(.one-day) .tile.v4.empty { justify-content: center; }
/* status marks sit top-right, next to the duty corner, so the time line stays free */
.rota2:not(.one-day) .cell2 .lk, .rota2:not(.one-day) .cell2 .pdot { top: 9px; bottom: auto; right: 9px; }
.rota2:not(.one-day) .cell2.locked .pdot { right: 29px; }
.rota2:not(.one-day) .cell2.locked .tile .t2 { padding-right: 0; }
.rota2 col.c-ty { width: 64px; }
.rota2 .ty { padding: 6px 8px; text-align: center; }
.rota2 thead th.ty { text-align: center; }
.rota2 .shift-pill { font-weight: 800; min-width: 30px; text-align: center; }
.rota2:not(.one-day) { min-width: calc(302px + var(--days, 7) * 104px); }

/* One day: one compact line per person (was a big card) — duty · hours | transport code + name | vehicles */
.rota2.one-day col.c-nm { width: 260px; }
.rota2.one-day .cell2 { height: 48px; padding: 4px 8px; }
.tile.v4.wide { max-width: none; min-height: 38px; padding: 5px 12px; display: grid; grid-template-columns: 150px minmax(180px, 1fr) minmax(220px, 1.6fr);
  align-items: center; gap: 14px; flex-direction: row; }
.tile.v4.wide .d-duty { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tile.v4.wide .dchip { font-size: 11px; line-height: 18px; padding: 0 7px; }
.tile.v4.wide .hrs { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--c) 72%, #1c1b19); white-space: nowrap; }
.tile.v4.wide.off .hrs { color: var(--muted); font-weight: 600; }
.tile.v4.wide .d-trip { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; color: var(--muted); }
.tile.v4.wide .d-trip .badge { flex: none; height: 20px; font-size: 11px; padding: 0 7px; }
.tile.v4.wide .d-trip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.v4.wide .d-legs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-width: 0; }
.tile.v4.wide .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tile.v4.wide .lg b { color: var(--text); font-weight: 700; }
.tile.v4.wide .lg .tm { color: var(--info); font-variant-numeric: tabular-nums; }
.tile.v4.wide .lg.none b:not(.tm) { color: var(--warn); }
.tile.v4.wide.empty { display: flex; color: #b9b5ac; }
.rota2.one-day .cell2 .lk, .rota2.one-day .cell2 .pdot { top: 50%; bottom: auto; left: auto; right: 18px; transform: translateY(-50%); }
.rota2.one-day .cell2.locked .tile.v4.wide { padding-right: 36px; }
@media (max-width: 900px) {
  .tile.v4.wide { grid-template-columns: 110px minmax(0, 1fr); gap: 4px 10px; }
  .tile.v4.wide .d-legs { grid-column: 1 / -1; }
  .rota2.one-day .cell2 { height: auto; }
}
@media (max-width: 720px) {
  .rota2.one-day col.c-nm { width: 120px; }
  .tile.v4.wide { grid-template-columns: minmax(0, 1fr); }
  .tile.v4.wide .d-trip span { display: none; }
  .tile.v4.wide .lg span:not(.tm) { display: none; }
}
.tile .dchip, .rota2 .tile .dchip { color: #fff; font-weight: 800; }
.tile.v4.off .dchip { background: #9ca3af; }
@media (max-width: 720px) {
  .tile.v4.wide .d-trip span:not(.badge) { display: none; }
  .tile.v4.wide .d-trip .badge { display: inline-flex; }
}

/* ---------- Phone pass (HR, transport, staff): compact top bar, one-day rota cards, request cards ---------- */
.m-filters, .mdays, .m-sum, .mlist, .m-legend, .m-tip { display: none; }
@media (max-width: 720px) {
  /* Top bar: the title never runs under the clock; page buttons stay on one row and scroll sideways */
  .topbar { gap: 8px; }
  .topbar .grow { min-width: 0; }
  .topbar h2 { overflow: hidden; text-overflow: ellipsis; }
  .uae-clock { gap: 3px; padding: 4px 8px; }
  .uae-clock svg { display: none; }
  .uae-clock small { font-size: 10px; }
  .topbar .actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; gap: 6px; }
  .topbar .actions::-webkit-scrollbar { display: none; }
  .topbar .actions .btn { flex: none; height: 40px; }

  /* KPI tiles: smaller, so the trips show sooner */
  .kpi { padding: 10px 12px; }
  .kpi .label { font-size: 10.5px; letter-spacing: .06em; }
  .kpi .value { font-size: 22px; margin: 2px 0 0; }
  .kpi .hint { font-size: 11.5px; }

  /* Master rota on a phone: compact filter card */
  .rota-filters.m-filters { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; margin-bottom: 12px; }
  .m-filters .period { display: flex; flex-direction: column; gap: 8px; }
  .m-filters .period .tabs { width: 100%; }
  .m-filters .period .tabs button { flex: 1; }
  .m-row { display: flex; gap: 8px; }
  .m-row .search { flex: 1; min-width: 0; }
  .m-row .btn { flex: none; height: 44px; }
  .m-row .btn.on { border-color: var(--gold); background: var(--gold-soft); }
  .m-nf { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--gold); color: #fff; font-size: 11px; }
  .m-more { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .m-more[hidden] { display: none; }
  .m-more .ff { min-width: 0; }
  .m-filters > .badge.warn { height: auto; padding: 8px 12px; white-space: normal; justify-content: center; }

  /* Day strip: one chip per day of the period, the number = people on duty (vehicle view: with transport) */
  .mdays { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 10px; padding: 2px 16px 4px; scroll-snap-type: x proximity; }
  .mdays::-webkit-scrollbar { display: none; }
  .mday { flex: 1 0 44px; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 4px 6px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; font: inherit; color: var(--text); }
  .mday small { font-size: 11px; font-weight: 600; color: var(--muted); }
  .mday b { font-size: 17px; line-height: 1.2; font-variant-numeric: tabular-nums; }
  .mday i { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--muted); }
  .mday.today { border-color: var(--gold); }
  .mday.today small { color: var(--gold-text); }
  .mday.past { background: radial-gradient(#e2dfd8 0.8px, #f6f5f0 0.9px) 0 0 / 5px 5px; color: var(--muted); }
  .mday.on { background: var(--gold); border-color: var(--gold); color: #fff; box-shadow: 0 4px 12px rgba(201, 162, 39, .35); }
  .mday.on small, .mday.on i { color: rgba(255, 255, 255, .9); }

  /* Day summary + select */
  .m-sum { display: flex; align-items: center; gap: 8px; margin: 2px 2px 10px; }
  .m-sum b { display: block; font-size: 15px; }
  .m-sum small { display: block; font-size: 12px; color: var(--muted); }
  .m-sum .btn { flex: none; height: 36px; }

  /* One card per person */
  .mlist { display: flex; flex-direction: column; gap: 8px; }
  .mcard { position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 12px 11px 14px; background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; box-shadow: var(--shadow); cursor: pointer; overflow: hidden; }
  .mcard::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
  .mcard.none::before { background: var(--line); }
  .mcard:active { background: var(--gold-soft); }
  .mcard.past { background: #f8f7f3; }
  .mcard.past .mc-who b { color: var(--muted); }
  .mcard.picked { border-color: var(--gold); background: color-mix(in srgb, var(--gold-soft) 70%, #fff); }
  .mc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
  .mc-top { display: flex; align-items: center; gap: 10px; }
  .mc-who { flex: 1; min-width: 0; }
  .mc-who b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mc-who small { display: block; font-size: 11.5px; color: var(--muted); }
  .mc-duty { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: color-mix(in srgb, var(--c) 70%, #1c1b19); }
  .mc-duty.muted { color: #b9b5ac; font-weight: 500; }
  .mc-duty .dchip { font-size: 11px; line-height: 18px; padding: 0 6px; border-radius: 5px; background: var(--c); }
  .mcard.none .mc-duty .dchip, .mc-duty .dchip[style*="9ca3af"] { background: #9ca3af; }
  .mc-trip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; }
  .mc-trip .badge { height: 21px; font-size: 11px; }
  .mc-trip .lg { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); white-space: nowrap; }
  .mc-trip .lg svg.i { width: 14px; height: 14px; color: var(--muted); }
  .mc-trip .lg b { color: var(--text); font-weight: 700; }
  .mc-trip .lg .tm { color: var(--info); font-variant-numeric: tabular-nums; }
  .mc-trip .lg em { font-style: normal; font-size: 11px; }
  .mc-trip .lg.none, .mc-trip .lg.none b, .mc-trip .lg.none svg.i { color: var(--warn); }
  .mc-marks { flex: none; display: flex; align-items: center; gap: 6px; }
  .mc-marks .lk-ico { position: static; width: 18px; height: 18px; }
  .mtick { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; background: #fff; }
  .mtick svg.i { width: 14px; height: 14px; stroke-width: 3; }
  .mcard.picked .mtick { background: var(--gold); border-color: var(--gold); color: #fff; }
  .m-legend { display: block; margin-top: 14px; }
  .m-legend .rota-legend { border: 0; }
  .m-tip { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 0; flex-basis: 100%; font-size: 12.5px; color: var(--muted); }
  .m-tip svg.i { flex: none; width: 15px; height: 15px; color: var(--gold-strong); margin-top: 2px; }

  /* Bulk bar on a phone: name line, then the code pickers, then the buttons */
  #bulk.bulkbar { padding: 10px; gap: 8px; }
  #bulk.bulkbar > b { flex-basis: calc(100% - 44px); }
  #bulk.bulkbar .input { flex: 1 1 100%; min-width: 0; height: 42px; }
  #bulk.bulkbar .btn { flex: 1; justify-content: center; height: 40px; }
  #bulk.bulkbar .spacer { display: none; }
  #bulk.bulkbar #bClose { position: absolute; top: 6px; right: 6px; }
  body:has(#bulk:not([hidden])) .content { padding-bottom: 240px; }

  /* Change requests (HR): one clear card per request instead of label/value lines */
  table.req-t tr.grp, table.req-t tr.grp td { display: block; }
  table.req-t tr.grp { padding: 0; }
  table.req-t tr.grp td { display: block; text-align: left; padding: 10px 14px; font-size: 13px; }
  table.req-t tr.grp td::before { content: none; }
  table.req-t tbody tr:not(.grp) { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "emp type" "day status" "chg chg" "act act";
    gap: 8px 10px; padding: 14px; align-items: center; }
  table.req-t tbody tr:not(.grp) > td { display: block; padding: 0; text-align: left; min-width: 0; }
  table.req-t tbody tr:not(.grp) > td::before { content: none; }
  table.req-t tr:not(.grp) > td:nth-child(1) { display: none; }
  table.req-t td:nth-child(2) { grid-area: emp; font-size: 14.5px; }
  table.req-t td:nth-child(3) { grid-area: type; justify-self: end; text-align: right; }
  table.req-t td:nth-child(4) { grid-area: day; font-size: 13.5px; }
  table.req-t td:nth-child(4)::before { content: 'Shift day · '; display: inline; color: var(--muted); font-size: 12.5px; font-weight: 500; }
  table.req-t td:nth-child(5) { grid-area: chg; padding: 10px 12px; border-radius: 10px; background: var(--card-2); }
  table.req-t td:nth-child(6) { grid-area: status; justify-self: end; text-align: right; }
  table.req-t td:nth-child(6) .small { font-size: 11.5px; }
  table.req-t tbody tr:not(.grp) > td.actions { grid-area: act; display: flex; gap: 8px; padding-top: 2px; }
  table.req-t td.actions .btn { flex: 1; justify-content: center; height: 42px; }
  table.req-t td.actions a.btn { flex: none; width: 42px; padding: 0; }
  table.req-t td.actions:empty { display: none; }
  table.req-t .req-change { flex-wrap: wrap; }

  /* Staff list (HR): name on top, the facts in two columns, buttons along the bottom */
  table.t.stack-sm.staff-t tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 14px; }
  table.t.stack-sm.staff-t tbody td { display: block; padding: 0; text-align: left; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  table.t.stack-sm.staff-t tbody td::before { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 1px; }
  table.t.stack-sm.staff-t tbody td.primary, table.staff-t tbody td[data-l="Pickup"], table.staff-t tbody td.actions { grid-column: 1 / -1; }
  table.t.stack-sm.staff-t tbody td.primary { font-size: 15.5px; }
  table.t.stack-sm.staff-t tbody td[data-l="Pickup"] { white-space: normal; }
  table.t.stack-sm.staff-t tbody td.actions { display: flex; gap: 8px; padding-top: 6px; }
  table.t.stack-sm.staff-t tbody td.actions .btn:not(.btn-ghost) { flex: 1; justify-content: center; }

  /* Staff: own request cards — date on top, type and status below */
  .req-h { flex-wrap: wrap; row-gap: 6px; }
  .req-h > b.grow { order: -1; flex: 1 1 100%; font-size: 15px; }
  .req-h > .badge:last-child { margin-left: auto; }

  /* Driver duty rota: narrower driver column so a day fits beside it */
  .drota th:first-child, .drota td:first-child { min-width: 128px; max-width: 128px; width: 128px; }
}
@media (max-width: 720px) { .lbl-m { display: none; } }
@media (max-width: 720px) { table.t.stack-sm.staff-t tbody td.primary::before { display: none; } }
.overdue-bar { flex-wrap: wrap; margin-bottom: 12px; }
.overdue-days { display: flex; flex-wrap: wrap; gap: 6px; }
.overdue-days .btn { background: #fff; }

/* ---------- Master rota: edit bar as the header of the grid (change a cell right there), duty code in the cell ---------- */
#bulk.bulkbar.editbar { position: static; margin: 0; min-height: 58px; padding: 9px 14px; gap: 10px; flex-wrap: nowrap; border: 0; border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0; box-shadow: none; background: color-mix(in srgb, var(--gold-soft) 50%, #fff); font-size: 13px; }
#bulk.editbar.idle { background: var(--card-2); color: var(--muted); }
#bulk.editbar.idle > svg.i { color: var(--gold-strong); flex: none; }
#bulk.editbar.idle > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bulk.editbar.idle b { color: var(--text); }
.bulkbar .bwho { white-space: nowrap; font-size: 13.5px; }
.bulkbar .bwho span { font-weight: 500; color: var(--muted); margin-left: 4px; }
/* ticked staff: which days the update goes to */
.bulkbar .bdays { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.bulkbar .bday { display: inline-flex; align-items: center; gap: 3px; height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.bulkbar .bday small { font-weight: 500; opacity: .8; }
.bulkbar .bday.on { border-color: var(--gold); background: var(--gold-soft); color: var(--text); }
.bulkbar .bday:disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.bulkbar .bpick { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.bulkbar .bpick > span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.bulkbar .bpick .input { min-width: 190px; max-width: 260px; height: 36px; border-color: var(--gold); background: #fff; font-weight: 600; }
/* a layer this login may not write: shown locked */
.bulkbar .bpick.is-locked > .input { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 0 12px; border-color: var(--line); background: var(--card-2);
  color: var(--muted); cursor: not-allowed; font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; }
/* ticked staff: From–To range of the update */
.bulkbar .brange { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.bulkbar .brange label { display: inline-flex; align-items: center; gap: 5px; margin: 0; }
.bulkbar .brange label > span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.bulkbar .brange .input { width: 150px; height: 36px; border-color: var(--gold); background: #fff; font-weight: 600; }
.sheet.roster-wrap { max-height: calc(100vh - 350px); max-height: calc(100dvh - 350px); min-height: 320px; }
@media (max-width: 1100px) { #bulk.bulkbar.editbar { flex-wrap: wrap; } #bulk.editbar.idle > span { white-space: normal; } }
/* week cell without transport: the duty code (D, N, M8…) big in the middle */
.rota2:not(.one-day) .tile .t1.dcode-mid { font-size: 15px; font-weight: 800; letter-spacing: .02em; }
.rota2:not(.one-day) .tile.v4:has(.dcode-mid):not(:has(.t2)) { align-items: center; justify-content: center; }
@media (max-width: 720px) {
  #bulk.bulkbar .bpick { flex: 1 1 100%; flex-direction: column; align-items: stretch; gap: 3px; }
  #bulk.bulkbar .bpick .input { max-width: none; width: 100%; height: 42px; }
}
.rota2:not(.one-day) .tile.v4:has(.dcode-mid) { align-items: center; text-align: center; }
.rota2:not(.one-day) .tile.v4:has(.dcode-mid) .t2 { justify-content: center; }

/* ---------- Portal switch (one login for an office portal + the Staff portal) ---------- */
.portal-switch { display: flex; gap: 4px; margin: 0 14px 6px; padding: 4px; border-radius: 12px; background: var(--line-2); border: 1px solid var(--line); }
.portal-switch button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border: 0; border-radius: 9px; background: transparent;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.portal-switch button svg.i { width: 15px; height: 15px; }
.portal-switch button.on { background: #fff; color: var(--gold-text); box-shadow: var(--shadow); }
.portal-switch button:not(.on):hover { color: var(--text); }
.shell.side-mini .portal-switch { flex-direction: column; margin: 0 8px 6px; }
.shell.side-mini .portal-switch button { font-size: 0; gap: 0; }
@media (max-width: 1100px) and (min-width: 721px) {
  .portal-switch { flex-direction: column; margin: 0 8px 6px; }
  .portal-switch button { font-size: 0; gap: 0; }
}
/* Rota: no Shift column — the duty code sits in each cell; the name column carries the divider */
.rota2 { min-width: calc(238px + var(--days, 7) * 108px); }
.rota2 .nm { box-shadow: 1px 0 0 var(--line); }
.tile .t1 .dcode { display: inline-block; margin-right: 5px; padding: 0 5px; border-radius: 5px; font-size: 10.5px; line-height: 16px;
  background: color-mix(in srgb, var(--c) 16%, #fff); border: 1px solid color-mix(in srgb, var(--c) 32%, #fff); }
.tile.v4.wide .d-duty .dcode { padding: 0 6px; border-radius: 5px; font-size: 11.5px; line-height: 18px;
  background: color-mix(in srgb, var(--c) 16%, #fff); border: 1px solid color-mix(in srgb, var(--c) 32%, #fff); }
/* A page's filter bar as the second row of the top bar (Master Rota) */
.topbar { flex-wrap: wrap; }
.topbar .page-tools { order: 20; flex: 1 1 100%; min-width: 0; }
.topbar .page-tools:empty { display: none; }
.rota-filters.in-top { margin: 0; padding: 10px 0 0; border-top: 1px solid var(--line); align-items: center; gap: 8px 10px; }
.rota-filters.in-top .period { align-self: center; }
.sheet.roster-wrap { max-height: calc(100vh - 250px); max-height: calc(100dvh - 250px); }
/* the rota grid runs down to the window edge (rota.js fitSheet): a small gap under it, not the pages' 48px */
.content:has(> .rota-card) { padding-bottom: 14px; }
body.rota-max .sheet.roster-wrap { max-height: calc(100vh - 220px); max-height: calc(100dvh - 220px); }
/* Top bar: one even row — title left; Undo / Redo, then Excel / PDF; clock, bell and the user at the end */
.topbar { row-gap: 10px; }
.topbar .grow { min-width: 0; }
.topbar .actions { align-items: center; flex-wrap: nowrap; }
.topbar .actions .btn { height: 36px; }
.topbar .uae-clock, .topbar .bell-btn { align-self: center; }

/* ---------- Design pass (user's mockup, kept white + gold): sidebar, top bar, filters, rota cells ---------- */
/* Sidebar: bigger brand, roomier links, the company line at the bottom */
.side-brand { padding: 20px 18px 16px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.side-brand img { width: 48px; height: 48px; }
.side-brand b { font-size: 16px; letter-spacing: .08em; }
.nav-link { padding: 10px 14px; font-size: 14px; }
.nav-link svg.i { width: 19px; height: 19px; }
.side nav { display: flex; flex-direction: column; }
.side-tag { margin: auto 14px 6px; padding-top: 18px; font-size: 11.5px; line-height: 1.55; font-weight: 600; color: var(--gold-text); }
.side-tag i { display: block; width: 30px; height: 2px; border-radius: 2px; background: var(--gold); margin-bottom: 8px; }
.side-tag span { display: block; }
@media (min-width: 1101px) { .shell.side-mini .side-tag { display: none; } }
@media (max-width: 1100px) and (min-width: 721px) { .side-tag { display: none; } }

/* Top bar: the signed-in user at the right — avatar, name, role, ▾ */
.topbar .me-btn { display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 10px 0 4px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--text); cursor: pointer; flex: none; }
.topbar .me-btn:hover { background: #faf8f1; border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.topbar .me-btn .avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.me-who { display: flex; flex-direction: column; min-width: 0; max-width: 170px; text-align: left; line-height: 1.2; }
.me-who b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-who small { font-size: 11px; color: var(--muted); text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .me-btn > svg.i { width: 15px; height: 15px; color: var(--muted); }
@media (max-width: 1100px) {
  .topbar .me-btn { height: auto; padding: 0; border: 0; background: transparent; }
  .me-who, .topbar .me-btn > svg.i { display: none; }
}
.topbar h2 { font-size: 20px; font-weight: 700; }
.topbar .page-ico { border: 1px solid color-mix(in srgb, var(--gold) 30%, #fff); }
.topbar .actions .btn { font-size: 13px; font-weight: 600; padding: 0 12px; gap: 7px; }

/* Filter row: labels above the choices, a gold segmented Today / Week / Custom */
.rota-filters.in-top { align-items: flex-end; gap: 8px 10px; }
.rota-filters.in-top .search { flex: 1 1 120px; min-width: 120px; }
.rota-filters.in-top .period { align-self: flex-end; }
.rota-filters.in-top .ff > span { font-size: 11.5px; font-weight: 600; color: var(--text); }
.rota-filters.in-top .ff .input, .rota-filters.in-top .search .input { height: 38px; }
.rota-filters.in-top .ff .input { width: 124px; }
.rota-filters.in-top #layerF { width: 140px; }
.rota-filters .tabs { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.rota-filters .tabs button { padding: 6px 13px; border-radius: 7px; }
.rota-filters .tabs button.on { background: var(--gold); color: #1a1505; box-shadow: none; }
.rota-filters .tabs button:not(.on):hover { background: #f6f3ea; color: var(--text); }

/* Grid: clear rows, bold names */
.rota2 .nm { font-weight: 600; }
.rota2 thead th { height: 50px; }
.rota2 tbody td { border-bottom: 1px solid var(--line); }
.rota2 tbody tr:hover > td.cell2 { background: #fdfbf5; }

/* Cells v5: [shift code] hours on top · bus, transport code, pickup time and vehicle below */
.rota2:not(.one-day) .cell2 { height: 62px; padding: 5px 4px; }
.rota2 .tile.v5 { height: 100%; min-height: 50px; padding: 5px 5px 5px 6px; overflow: hidden; gap: 3px; justify-content: center; align-items: stretch; border-radius: 8px;
  background: color-mix(in srgb, var(--c) 11%, #fff); border: 1px solid color-mix(in srgb, var(--c) 32%, #fff); }
.tile.v5 .r1, .tile.v5 .r2 { display: flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; line-height: 16px; }
.tile.v5 .r1 > span, .tile.v5 .r2 > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tile.v5 .r1 { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.035em; color: color-mix(in srgb, var(--c) 75%, #1c1b19); }
.tile.v5 .dcode { flex: none; padding: 0 3px; border-radius: 4px; background: var(--c); color: #fff; font-style: normal; font-size: 9.5px; line-height: 15px; font-weight: 800; }
.tile.v5 .r2 { font-size: 11px; gap: 4px; color: var(--muted); }
.tile.v5 .r2 b { flex: none; font-weight: 700; color: var(--text); }
.tile.v5 .r2 .tc { color: color-mix(in srgb, var(--c) 75%, #1c1b19); }
.tile.v5 .r2 .tm { font-variant-numeric: tabular-nums; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tile.v5 .r2 .lbl { font-weight: 600; color: color-mix(in srgb, var(--c) 60%, #1c1b19); }
.tile.v5 i.bus svg.i { width: 13px; height: 13px; }
.tile.v5:has(.bus.none) .r2 > span { color: var(--warn); }
.rota2 .tile.v5.off { background: #f5f5f3; border-color: #e7e5df; }
.tile.v5.off .r1 { color: var(--muted); font-weight: 600; }
.tile.v5.off .dcode { background: #a3a3a3; }
.rota2:not(.one-day) .tile.empty { background: #f6f5f1; border-color: #eeece6; }
.rota2 .cell2.pending .tile.v5 { border-style: dashed; border-color: var(--warn); }
.rota2 .cell2.locked .tile.v5 .r1, .rota2 .cell2.pending .tile.v5 .r1 { padding-right: 16px; }
.rota-legend .bus-t svg.i { color: var(--gold-strong); }
/* Week grid: a little more room for the day columns (hours like 22:00–06:00 show in full on a 1366px laptop) */
@media (min-width: 721px) {
  .rota2 col.c-no { width: 46px; }
  .rota2 .nm { left: 46px; }
  .rota2:not(.one-day) col.c-nm { width: 168px; }
  .rota2:not(.one-day) { min-width: calc(214px + var(--days, 7) * 108px); }
}

/* Account menu: Settings section (HR) and the Staff portal sign-in */
.me-sec { display: flex; align-items: center; gap: 7px; padding: 12px 16px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #a29f97; }
.me-sec svg.i { width: 13px; height: 13px; color: var(--gold-strong); }
.me-panel .bell-item { padding: 10px 16px; }
.me-panel .bell-item svg.i { width: 17px; height: 17px; color: #6b6862; }
.me-panel .bell-item:hover { background: #faf8f1; }
.me-panel .bell-item.on { background: var(--gold-soft); color: var(--gold-text); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold); }
.me-panel .bell-item.on svg.i { color: var(--gold-strong); }
.me-panel .me-portal { border-top: 1px solid var(--line); }
.me-panel .me-portal small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.me-panel .me-portal > svg.i:last-child { width: 15px; height: 15px; color: var(--muted); }
.topbar .me-btn.on { border-color: var(--gold); background: var(--gold-soft); }
.me-sec-line { border-top: 1px solid var(--line); margin-top: 2px; }
.me-panel .bell-item.on > svg.i:last-child { color: var(--gold-strong); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 6px 0 2px; }
.checks .check { margin: 0; }

/* Master Rota header: title, period, filters, search and the Undo / Redo / Excel / PDF buttons share ONE row once the top bar
   is wide enough (a container query, so a folded or open menu both count); narrower, the filters drop to a second row.
   No field labels: each choice names itself (Shift + vehicle, All staff…) and hovering shows the label. */
.topbar { container: topbar / inline-size; }
.rota-filters.in-top .ff > span { display: none; }
.rota-filters.in-top, .rota-filters.in-top .period { align-items: center; align-self: center; }
@container topbar (min-width: 913px) {
  .page-tools:not(:empty):not(:has(#vanF)) { order: 0; flex: 1 1 0; min-width: 0; } /* measured from 0: the breakpoint guarantees the room */
  .page-tools:not(:empty):not(:has(#vanF)) .rota-filters.in-top { padding: 0; border-top: 0; flex-wrap: nowrap; gap: 8px; }
  .page-tools:not(:empty):not(:has(#vanF)) .rota-filters.in-top .search { flex: 1 1 120px; }
  .grow:has(~ .page-tools:not(:empty)) { flex: none; } /* :has() cannot nest, so not per variant */
  .page-ico:has(~ .page-tools:not(:empty)) { display: none; }
  .page-tools:not(:empty):not(:has(#vanF)) ~ .actions { margin-left: 0; padding-left: 10px; border-left: 1px solid var(--line); gap: 6px; flex-wrap: nowrap; }
  .page-tools:not(:empty):not(:has(#vanF)) ~ .actions .btn { width: 36px; padding: 0; justify-content: center; }
  .page-tools:not(:empty):not(:has(#vanF)) ~ .actions .btn .lbl { display: none; }
  .page-tools:not(:empty):not(:has(#vanF)) ~ .uae-clock { display: none; }
  .page-tools:not(:empty):not(:has(#vanF)) ~ .me-btn .me-who, .page-tools:not(:empty):not(:has(#vanF)) ~ .me-btn > svg.i { display: none; }
  .page-tools:not(:empty):not(:has(#vanF)) ~ .me-btn { padding: 0 4px; }
}
@container topbar (min-width: 1530px) {
  .page-tools:not(:empty):not(:has(#vanF)) ~ .uae-clock { display: inline-flex; }
  .page-tools:not(:empty):not(:has(#vanF)) ~ .me-btn .me-who { display: flex; }
  .page-tools:not(:empty):not(:has(#vanF)) ~ .me-btn > svg.i { display: inline-block; }
  .page-tools:not(:empty):not(:has(#vanF)) ~ .me-btn { padding: 0 10px 0 4px; }
}
@container topbar (min-width: 995px) {
  .page-tools:has(#vanF) { order: 0; flex: 1 1 0; min-width: 0; } /* measured from 0: the breakpoint guarantees the room */
  .page-tools:has(#vanF) .rota-filters.in-top { padding: 0; border-top: 0; flex-wrap: nowrap; gap: 8px; }
  .page-tools:has(#vanF) .rota-filters.in-top .search { flex: 1 1 120px; }
  .grow:has(~ .page-tools:not(:empty)) { flex: none; } /* :has() cannot nest, so not per variant */
  .page-ico:has(~ .page-tools:not(:empty)) { display: none; }
  .page-tools:has(#vanF) ~ .actions { margin-left: 0; padding-left: 10px; border-left: 1px solid var(--line); gap: 6px; flex-wrap: nowrap; }
  .page-tools:has(#vanF) ~ .actions .btn { width: 36px; padding: 0; justify-content: center; }
  .page-tools:has(#vanF) ~ .actions .btn .lbl { display: none; }
  .page-tools:has(#vanF) ~ .uae-clock { display: none; }
  .page-tools:has(#vanF) ~ .me-btn .me-who, .page-tools:has(#vanF) ~ .me-btn > svg.i { display: none; }
  .page-tools:has(#vanF) ~ .me-btn { padding: 0 4px; }
}
@container topbar (min-width: 1655px) {
  .page-tools:has(#vanF) ~ .uae-clock { display: inline-flex; }
  .page-tools:has(#vanF) ~ .me-btn .me-who { display: flex; }
  .page-tools:has(#vanF) ~ .me-btn > svg.i { display: inline-block; }
  .page-tools:has(#vanF) ~ .me-btn { padding: 0 10px 0 4px; }
}
/* Narrower top bar, still one row: the title drops its subtitle and the filters get tighter (no second filter row) */
.rota-filters.in-top .tabs button { padding: 6px 11px; }
.rota-filters.in-top .ff .input { width: 116px; }
.rota-filters.in-top #layerF { width: 136px; }
.rota-filters.in-top .search { min-width: 104px; }
.rota-filters.in-top .period { flex-wrap: nowrap; flex: none; }
.rota-filters.in-top #maxBtn { flex: none; }
.rota-filters.in-top .rota-warn { flex: none; white-space: nowrap; } /* "N unassigned" (transport): short, the full text on hover */
@container topbar (max-width: 1404px) {
  .grow:has(~ .page-tools:not(:empty)) .sub { display: none; }
  .grow:has(~ .page-tools:not(:empty)) h2 { font-size: 17px; }
  .rota-filters.in-top .tabs button { padding: 6px 8px; }
  .rota-filters.in-top .ff .input { width: 96px; }
  .rota-filters.in-top #layerF { width: 118px; }
  .rota-filters.in-top .search { min-width: 44px; } /* squeezed: the search box gives way first */
  .rota-filters.in-top .rota-warn .lbl { display: none; } /* icon + count, the full text on hover */
}
/* Code-only cells (no hours): the code large and centred — N, M8, O */
.tile.v5 .r1.solo { justify-content: center; }
.tile.v5 .r1.solo b { font-size: 15px; font-weight: 800; letter-spacing: 0; color: color-mix(in srgb, var(--c) 78%, #1c1b19); }
.tile.v5.off .r1.solo b { color: #8f8b83; font-weight: 700; }

/* ---------- Cells v6 (user's mockup): [duty chip] top-left · transport code large in its own box · bus + shift hours ---------- */
.rota2:not(.one-day) .cell2:has(.tile.v6) { height: 86px; padding: 5px 4px; }
.rota2 .tile.v6 { height: 100%; min-height: 0; padding: 5px 6px 6px; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 3px; overflow: hidden; border-radius: 10px;
  background: color-mix(in srgb, var(--c) 8%, #fff); border: 1.5px solid color-mix(in srgb, var(--c) 38%, #fff); }
.cell2:hover .tile.v6 { border-color: color-mix(in srgb, var(--c) 65%, #fff); }
.tile.v6 .r0 { display: flex; height: 17px; flex: none; }
.tile.v6 .dcode { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 5px; background: var(--c); color: #fff; font-style: normal; font-size: 10.5px; line-height: 1; font-weight: 800; }
.tile.v6 .code { flex: 1 1 auto; display: grid; place-items: center; min-height: 0; margin: 0 2px; padding: 0 4px; border-radius: 7px;
  background: color-mix(in srgb, var(--c) 12%, #fff); border: 1px solid color-mix(in srgb, var(--c) 34%, #fff); }
.tile.v6 .code b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 800; letter-spacing: .01em; line-height: 22px; color: color-mix(in srgb, var(--c) 80%, #1c1b19); }
.tile.v6 .foot { display: flex; align-items: center; justify-content: center; gap: 4px; flex: none; min-width: 0; height: 16px; white-space: nowrap; font-size: 11px; color: var(--muted); }
.tile.v6 .foot b { flex: none; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: color-mix(in srgb, var(--c) 80%, #1c1b19); }
.tile.v6 .foot > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tile.v6 i.bus { color: color-mix(in srgb, var(--c) 80%, #1c1b19); }
.tile.v6 i.bus svg.i { width: 14px; height: 14px; }
.tile.v6 i.bus.none, .tile.v6:has(.bus.none) .foot > span { color: var(--warn); }
/* Duty only: chip + hours, or the code alone, large and centred */
.tile.v6 .mid { flex: 1 1 auto; display: grid; place-items: center; min-height: 0; }
.tile.v6 .mid .hrs { font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap; color: color-mix(in srgb, var(--c) 80%, #1c1b19); }
.tile.v6 .mid .solo { font-size: 18px; font-weight: 800; color: color-mix(in srgb, var(--c) 80%, #1c1b19); }
.rota2 .tile.v6.off { background: #f5f5f3; border-color: #e3e1db; }
.tile.v6.off .dcode { background: #a3a3a3; }
.tile.v6.off .mid .solo { color: #8f8b83; font-weight: 700; }
.rota2 .cell2.pending .tile.v6 { border-style: dashed; border-color: var(--warn); }
.rota2:not(.one-day) .cell2:has(.tile.v6) .lk, .rota2:not(.one-day) .cell2:has(.tile.v6) .pdot { top: 10px; right: 10px; bottom: auto; }
.rota2:not(.one-day) .cell2.locked:has(.tile.v6) .pdot { right: 30px; }
.tile.v6 .code.long b { font-size: 11.5px; letter-spacing: -.01em; } /* AUH-DXB-M, DXB-AUH-E: whole code, smaller */
.rota2 .tile.v6 .mid b.solo { font-size: 18px; font-weight: 800; color: color-mix(in srgb, var(--c) 80%, #1c1b19); }
.rota2 .tile.v6.off .mid b.solo { color: #8f8b83; font-weight: 700; }
/* WhatsApp: which number the Phone number ID sends from */
.wa-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.wa-line .badge svg.i { width: 12px; height: 12px; margin-right: 4px; }
/* Check connection: one line per step (token, Phone number ID, business number, templates, sending) */
.wa-steps { display: grid; gap: 6px; margin-top: 10px; }
.wa-step { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); font-size: 12.5px; }
.wa-step > svg.i { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.wa-step b { display: block; font-size: 12.5px; }
.wa-step span { color: var(--muted); overflow-wrap: anywhere; }
.wa-step.ok > svg.i { color: var(--ok); }
.wa-step.warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); } .wa-step.warn > svg.i { color: var(--warn); }
.wa-step.bad { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: color-mix(in srgb, var(--bad) 5%, #fff); } .wa-step.bad > svg.i { color: var(--bad); }
/* One day without the vehicle part: shift · transport code and route, the route gets the rest of the row */
.tile.v4.wide.nolegs { grid-template-columns: 150px minmax(0, 1fr); }
@media (max-width: 900px) { .tile.v4.wide.nolegs { grid-template-columns: 110px minmax(0, 1fr); } }
@media (max-width: 720px) { .tile.v4.wide.nolegs { grid-template-columns: minmax(0, 1fr); } }

/* rota: the real trip time of a cell; amber when transport moved the trip off its code's time */
.rota2 .tile .foot.moved b, .ttime.moved { color: var(--warn); }
.ttime { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ttime svg.i { width: 12px; height: 12px; }

/* Trip codes: "Staff are…" options */
.dir-rows { display: grid; gap: 8px; margin-bottom: 12px; }
.dir-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; }
.dir-row select.input { width: auto; }
.dir-row .small svg.i { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; }
.linkish { border: 0; background: none; padding: 0 0 0 6px; color: var(--gold-ink, #8a6d12); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.linkish svg.i { width: 12px; height: 12px; }
@media (max-width: 720px) { .dir-row { grid-template-columns: 1fr auto; } .dir-row .input { grid-column: 1 / -1; } }

/* Laptop widths (a 1366px screen at 125%): the rota header still keeps ONE row. The title gives way (the menu shows the page),
   the filters tighten, "Back to today" becomes an icon and the search shrinks to its icon until there is room. */
.period [data-ptoday] svg.i { display: none; }
.topbar:has(.rota-filters.in-top) { column-gap: 8px; }
@container topbar (min-width: 913px) and (max-width: 1179px) {
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) > .grow { display: none; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .rota-filters.in-top .period { gap: 5px; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .rota-filters.in-top { gap: 5px; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .rota-filters.in-top .tabs button { padding: 6px 5px; font-size: 12px; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .rangepill { padding: 0 5px; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .rangepill svg.i, .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .rangepill .yr { display: none; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .rangenav .icon-btn { width: 24px; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .rangepill { font-size: 12.5px; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) [data-ptoday] { width: 34px; height: 34px; padding: 0; justify-content: center; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) [data-ptoday] svg.i { display: inline-block; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) [data-ptoday] .lbl { display: none; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .rota-filters.in-top .ff .input { width: 92px; padding-left: 9px; padding-right: 22px; background-position: right 6px center; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) #layerF { width: 100px; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .rota-filters.in-top .search { flex: 1 1 36px; min-width: 36px; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .actions { gap: 3px; padding-left: 6px; }
  .topbar:has(.rota-filters.in-top):not(:has(#vanF)) .actions .btn { width: 34px; }
}
@container topbar (min-width: 995px) and (max-width: 1289px) {
  .topbar:has(#vanF) > .grow { display: none; }
  .topbar:has(#vanF) .rota-filters.in-top .period { gap: 5px; }
  .topbar:has(#vanF) .rota-filters.in-top { gap: 5px; }
  .topbar:has(#vanF) .rota-filters.in-top .tabs button { padding: 6px 5px; font-size: 12px; }
  .topbar:has(#vanF) .rangepill { padding: 0 5px; }
  .topbar:has(#vanF) .rangepill svg.i, .topbar:has(#vanF) .rangepill .yr { display: none; }
  .topbar:has(#vanF) .rangenav .icon-btn { width: 24px; }
  .topbar:has(#vanF) .rangepill { font-size: 12.5px; }
  .topbar:has(#vanF) [data-ptoday] { width: 34px; height: 34px; padding: 0; justify-content: center; }
  .topbar:has(#vanF) [data-ptoday] svg.i { display: inline-block; }
  .topbar:has(#vanF) [data-ptoday] .lbl { display: none; }
  .topbar:has(#vanF) .rota-filters.in-top .ff .input { width: 92px; padding-left: 9px; padding-right: 22px; background-position: right 6px center; }
  .topbar:has(#vanF) #layerF { width: 100px; }
  .topbar:has(#vanF) #vanF { width: 72px; }
  .topbar:has(#vanF) .rota-filters.in-top .search { flex: 1 1 36px; min-width: 36px; }
  .topbar:has(#vanF) .actions { gap: 3px; padding-left: 6px; }
  .topbar:has(#vanF) .actions .btn { width: 34px; }
}

/* Header on two rows (top bar too narrow for one): the filters keep to ONE second row — the search box gives way —
   instead of leaving the unassigned badge and Full screen alone on a third row. */
@container topbar (min-width: 860px) {
  .rota-filters.in-top { flex-wrap: nowrap; }
  .rota-filters.in-top .search { flex: 1 1 44px; min-width: 44px; }
}
/* Narrow day columns (laptop with the menu open, Custom ranges): the trip time keeps its full "05:00 → 18:00" —
   the bus icon gives way first, then the text tightens — instead of running into the cell's edge. */
.rota2 .tile.v6 { container: tile / inline-size; }
@container tile (max-width: 112px) {
  .tile.v6 .foot i.bus { display: none; }
  .tile.v6 .foot b { font-size: 10.5px; }
}
@container tile (max-width: 84px) {
  .tile.v6 .foot b { font-size: 9.5px; letter-spacing: -.04em; }
}

/* ---------- Master rota: staff by department (open a department for its groups and people) ---------- */
.rota2 tr.dept-row > td { background: var(--card-2); border-top: 1px solid var(--line); height: 40px; }
.rota2 tr.dept-row[data-dtog] { cursor: pointer; }
.rota2 tr.dept-row > td.no, .rota2 tr.dept-row > td.nm { background: var(--card-2); }
.rota2 tr.dept-row:hover > td { background: var(--gold-soft); }
.rota2 tr.dept-row .nm { display: table-cell; white-space: nowrap; color: var(--text); }
.rota2 tr.dept-row .nm b { font-size: 13px; }
.rota2 .dn { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--line-2); color: var(--muted); font-size: 11px; font-weight: 700; line-height: 18px; }
.rota2 .dtog { display: inline-grid; place-items: center; color: var(--gold-text); }
.rota2 .dtog svg { width: 16px; height: 16px; }
.rota2 td.dsum { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rota2 .dgrps { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.rota2 .dchip { min-width: 22px; height: 20px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); font: 700 11px var(--font); cursor: pointer; }
.rota2 .dchip:hover { border-color: var(--gold); }
.rota2 .dchip.on { background: var(--gold); border-color: var(--gold); color: #fff; }
.rota2 tr.grp-row > td { height: 26px; padding: 2px 12px; background: var(--card); border-top: 1px dashed var(--line); font-size: 11.5px; font-weight: 700; color: var(--gold-text); text-transform: uppercase; letter-spacing: .04em; }
.rota2 tr.grp-row > td.nm { cursor: default; }
.rota2 .dall { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--gold-text); cursor: pointer; vertical-align: middle; }
.rota2 .dall svg { width: 14px; height: 14px; }
.m-dept { margin: 10px 2px 2px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--gold-text); }
.rota2 th.nm .nm-head { display: flex; align-items: center; gap: 0; }
.rota2 th.nm #orgF { flex: 1 1 auto; min-width: 0; width: 100%; height: 28px; padding: 0 24px 0 8px; font-size: 12.5px; font-weight: 700; background-position: right 7px center; }
.rota2 th.nm > .muted { display: block; margin-top: 3px; font-size: 11px; font-weight: 600; }
.rota2:has(#orgF) col.c-nm { width: 200px; }
/* Long transport codes (AUH-DXB-ME) are never cut: they break after a dash onto a second line — "AUH-DXB-" / "ME". */
.tile.v6 .code { grid-template-columns: minmax(0, 1fr); text-align: center; }
.tile.v6 .code.long b { white-space: normal; overflow: visible; text-overflow: clip; line-height: 13px; padding: 2px 0; }
/* A code that is not under Trip & Duty Codes: amber dashed, so it stands out to be added (no vehicle is planned for it) */
.rota2 .tile.v6.unknown { background: var(--warn-bg); border: 1.5px dashed color-mix(in srgb, var(--warn) 60%, #fff); }
.tile.v6.unknown .code { background: #fff; border-color: color-mix(in srgb, var(--warn) 35%, #fff); }
.tile.v6.unknown .code b { color: var(--warn); }
.tile.v6.unknown .foot { color: var(--warn); font-weight: 700; font-size: 10.5px; gap: 3px; }
.tile.v6.unknown .foot svg.i { width: 12px; height: 12px; flex: none; }
/* Ticked rows: the days of the update are tinted, without a frame round every cell (72 people × 7 days was a wall of gold) */
.rota2 tr.picked .cell2.sel .tile { box-shadow: none; }
.rota2 tr.picked > td.cell2.sel { background: color-mix(in srgb, var(--gold-soft) 75%, #fff); }
.rota2 tr.picked .cell2.sel .tile.empty { background: transparent; border-color: color-mix(in srgb, var(--gold) 30%, #fff); }

/* Trip code form: "More options" fold */
.form-sec .more-toggle { font-size: 13px; padding: 0; color: var(--text); }
.form-sec .more-toggle svg.i { width: 14px; height: 14px; transition: transform .15s; transform: rotate(-90deg); }
.form-sec.open .more-toggle svg.i { transform: none; }

/* Trip numbers (HX-2611-00042) and the trip search on the Dashboard */
.trip-no { display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 6px; background: var(--gold-soft, #f6ecca); color: var(--gold-ink, #8a6d12);
  font: 600 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; vertical-align: 1px; }
.trip-find { display: inline-flex; align-items: center; gap: 6px; position: relative; }
.trip-find > svg.i { position: absolute; left: 9px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.trip-find .input { padding-left: 28px; width: 250px; }
details.trip.flash { box-shadow: 0 0 0 3px var(--gold, #c9a227); transition: box-shadow .3s; }
@media (max-width: 720px) { .trip-find, .trip-find .input { width: 100%; } }
