:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #0f1b2d;
  --muted: #5d6b80;
  --line: #e3e8ef;
  --side: #0f1d3a;
  --side-2: #16284d;
  --side-text: #c9d3e3;
  --navy: #13294b;
  --accent: #f26b1d;
  --accent-2: #ff8a3d;
  --accent-soft: #fff1e8;
  --ok: #15803d; --ok-bg: #dcfce7;
  --warn: #a16207; --warn-bg: #fef3c7;
  --bad: #b91c1c; --bad-bg: #fee2e2;
  --info: #1d4ed8; --info-bg: #dbeafe;
  --focus: #2563eb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 6px 18px rgba(15, 27, 45, .05);
  --side-w: 262px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; font-weight: 800; } h2 { font-size: 1.05rem; font-weight: 750; } h3 { font-size: .95rem; }
a { color: var(--focus); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.label-caps { font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- Forms ---------- */
label { display: block; font-size: .8rem; font-weight: 650; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit;
}
label input, label select, label textarea { margin-top: 4px; font-weight: 400; color: var(--text); font-size: 14px; }
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); vertical-align: middle; }
label input[type="checkbox"] { margin: 0 6px 0 0; }
.field { margin-bottom: 12px; }
.grid { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
form.row > select { width: auto; max-width: 100%; }
.spacer { flex: 1; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 650;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:disabled { opacity: .55; cursor: not-allowed; }
.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.primary:hover { background: #1c3a68; }
.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.accent:hover { background: var(--accent-2); }
.danger { color: var(--bad); border-color: #f5c9c9; }
.danger:hover { background: var(--bad-bg); }
.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.link { background: none; border: none; padding: 0; color: var(--focus); font-weight: 500; }
.link:hover { background: none; text-decoration: underline; }
.sm { padding: 4px 10px; font-size: .8rem; border-radius: 7px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, #1c3563 0%, var(--side) 60%); }
.login-card { width: 100%; max-width: 420px; }
.brand-head { text-align: center; margin-bottom: 18px; color: #fff; }
.brand-mark { display: block; width: 120px; height: 120px; margin: 0 auto 10px; background: url("/logo.png") center/contain no-repeat; }
.brand-head h1 { margin: 0; font-size: 1.4rem; }
.brand-head .muted { color: #9fb0ca; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; margin-bottom: 18px; border: 1px solid var(--line); }
.tabs button { flex: 1; border: none; background: none; padding: 8px 6px; font-size: .88rem; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.subtabs { display: inline-flex; margin-bottom: 14px; }
.subtabs a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 8px; color: var(--muted); font-weight: 700; text-decoration: none; }
.subtabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.subtabs a.active .ico { color: var(--accent); }
a.stat { text-decoration: none; color: inherit; display: block; }
a.stat:hover { border-color: var(--accent); }
.stats.tight { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.stats.tight .stat { box-shadow: none; padding: 8px 10px; }
.stats.tight .v { font-size: 1.25rem; }
.qr-box { display: flex; justify-content: center; padding: 10px; background: #fff; border-radius: 8px; border: 1px solid var(--line); margin: 10px 0; }
.qr-box svg { max-width: 100%; height: auto; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; background: var(--surface-2); padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); font-size: .88rem; }
.code-input { font-size: 1.4rem; letter-spacing: .35em; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- App layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side-w); flex: none; background: var(--side); color: var(--side-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.side-brand .brand-mark { width: 52px; height: 52px; margin: 0; flex: 0 0 auto; background-image: url("/logo-96.png"); }
.side-brand b { display: block; color: #fff; font-size: 1rem; letter-spacing: .02em; font-weight: 850; line-height: 1.1; }
.side-brand span { display: block; color: var(--accent-2); font-size: .62rem; font-weight: 800; letter-spacing: .08em; line-height: 1.25; margin-top: 2px; }
.side-nav { padding: 10px 10px 16px; flex: 1; }
.side-nav a, .side-nav .grp {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; margin: 2px 0;
  color: var(--side-text); text-decoration: none; font-weight: 600; font-size: .84rem; border: 1px solid transparent; white-space: nowrap;
}
.side-nav a:hover { background: var(--side-2); color: #fff; }
.side-nav a.active { background: rgba(242,107,29,.14); border-color: rgba(242,107,29,.55); color: #fff; }
.side-nav a.active .ico { color: var(--accent-2); }
.side-nav .sub a { padding-left: 30px; font-size: .82rem; }
.side-nav .grp { cursor: pointer; width: 100%; justify-content: flex-start; background: transparent; text-align: left; font-family: inherit; box-shadow: none; min-height: 0; line-height: inherit; }
.side-nav .grp:hover { background: var(--side-2); color: #fff; }
.side-nav .grp.has-active { color: #fff; }
.side-nav .grp .chev { margin-left: auto; font-size: 1.1rem; line-height: 1; color: #8ea0bd; transition: transform .15s; }
.side-nav .grp .count + .chev { margin-left: 6px; }
.side-nav .grp .chev.open { transform: rotate(90deg); }
.ico { width: 16px; height: 16px; flex: none; color: #8ea0bd; }
.side-nav .count { margin-left: auto; background: var(--bad); color: #fff; font-size: .68rem; font-weight: 800; border-radius: 99px; padding: 1px 7px; }
.side-nav .soon { margin-left: auto; font-size: .56rem; font-weight: 800; letter-spacing: .05em; color: #7f90ad; border: 1px solid #2a3c62; border-radius: 99px; padding: 0 5px; }
.side-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.06); font-size: .78rem; color: #8ea0bd; }
.side-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 6px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 10px 18px; flex-wrap: nowrap;
}
.topbar .search { flex: 1 1 200px; min-width: 140px; max-width: 460px; position: relative; }
.topbar .search input { padding-left: 32px; background: var(--surface-2); }
.topbar .search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); }
.fleet-pick { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 2px 4px 2px 10px; }
.fleet-pick select { border: none; padding: 6px 4px; font-weight: 750; width: auto; background: transparent; }
.clock { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.bell { position: relative; padding: 8px 10px; }
.bell .badge-n { position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff; font-size: .65rem; font-weight: 800; border-radius: 99px; padding: 1px 6px; }
.user-chip { display: flex; align-items: center; gap: 8px; line-height: 1.15; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .8rem; flex: none; }
.user-chip small { display: block; color: var(--muted); font-size: .72rem; }
.menu-btn { display: none; }
main { padding: 20px 22px 60px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; }
.card-head h2 { margin: 0; }
.card-head a { margin-left: auto; font-size: .8rem; font-weight: 650; color: var(--text); text-decoration: none; }

/* Hero */
.hero { background: linear-gradient(120deg, #0f1d3a 0%, #1b2f58 70%, #22396a 100%); color: #fff; border-radius: 14px; padding: 22px 24px; margin-bottom: 16px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(242,107,29,.35), transparent 65%); }
.hero .tag { display: inline-block; background: var(--accent); color: #fff; font-size: .62rem; font-weight: 850; letter-spacing: .1em; padding: 3px 8px; border-radius: 4px; margin-right: 8px; }
.hero h1 { color: #fff; font-size: 1.6rem; margin: 10px 0 4px; }
.hero p { margin: 0; color: #c3cfe3; }
.hero .live { position: absolute; right: 24px; bottom: 20px; z-index: 1; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: 99px; padding: 5px 12px; font-size: .76rem; font-weight: 700; }
.hero .live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 7px; }

.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; box-shadow: var(--shadow); }
.stat .v { font-size: 1.35rem; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .v small { font-size: .78rem; color: var(--muted); font-weight: 650; }
.stat .s { font-size: .74rem; color: var(--muted); margin-top: 1px; line-height: 1.3; }
.v.ok { color: var(--ok); } .v.warn { color: var(--accent); } .v.bad { color: var(--bad); } .v.info { color: var(--info); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 40px 44px; gap: 10px; align-items: center; padding: 6px 0; }
.bar { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .75rem; font-weight: 750; border: 1px solid; text-align: center; }
.pill.Talabat { color: #e4572e; border-color: #f6c1b2; background: #fff4f0; }
.pill.Keeta { color: #a16207; border-color: #f2dc8f; background: #fffbea; }
.pill.Noon { color: #854d0e; border-color: #f7e08a; background: #fff9db; }
.pill.Careem { color: #15803d; border-color: #b6e3c4; background: #effbf3; }
.urgent { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.urgent li { display: flex; gap: 10px; align-items: center; padding: 9px 4px 9px 12px; border-left: 3px solid var(--bad); border-bottom: 1px solid var(--line); }
.urgent li.warn { border-left-color: var(--accent); }
.urgent li div { flex: 1; min-width: 0; }
.urgent b { display: block; font-size: .84rem; }
.urgent span { display: block; font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; background: var(--surface); }
th { background: var(--surface-2); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; font-weight: 800; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fbf6f2; }
tr.selected td { background: var(--accent-soft); }
td.num { font-variant-numeric: tabular-nums; }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; }
.nowrap { white-space: nowrap; }

/* Riders Master: wide table with frozen Rider + Platform columns */
.rtable { width: max-content; min-width: 100%; }
.rtable th, .rtable td { white-space: nowrap; }
.rtable .sticky { position: sticky; z-index: 2; }
.rtable th.sticky { z-index: 3; }
.rtable .c-check { left: 0; width: 44px; min-width: 44px; max-width: 44px; text-align: center; }
.rtable .c-rider { left: 44px; width: 250px; min-width: 250px; max-width: 250px; }
.rtable .c-plat { left: 294px; width: 160px; min-width: 160px; max-width: 160px; box-shadow: 6px 0 8px -6px rgba(15,27,45,.18); border-right: 1px solid var(--line); }
.rtable .c-rider b { display: block; overflow: hidden; text-overflow: ellipsis; }
.rtable .c-rider span, .rtable .c-plat span { display: block; font-size: .76rem; color: var(--muted); }
.bulkbar { display: flex; align-items: center; gap: 10px; background: var(--side); color: #fff; padding: 8px 12px; border-radius: 10px; margin-bottom: 10px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .74rem; font-weight: 750; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.change { font-size: .82rem; }
.change b { font-weight: 650; }
.change .old { color: var(--bad); text-decoration: line-through; }
.change .new { color: var(--ok); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { max-width: 320px; }
.filters select { width: auto; }

/* Profile */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.profile-head .avatar { width: 54px; height: 54px; font-size: 1.1rem; background: var(--navy); }
.profile-head h1 { margin: 0; }
.ptabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px -18px -18px; padding: 0 12px; overflow-x: auto; }
.ptabs a { padding: 11px 12px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: .86rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.ptabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.doc-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.doc-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--surface); }
.doc-card h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.doc-card .file { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; font-size: .82rem; }
.doc-card .file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card details { margin-top: 8px; font-size: .82rem; }
.doc-card summary { cursor: pointer; color: var(--muted); font-weight: 650; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.timeline .when { font-size: .76rem; color: var(--muted); }

/* ---------- Dialog / toast ---------- */
dialog { border: none; border-radius: 12px; padding: 0; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10, 18, 32, .5); }
dialog .dlg { padding: 20px; }
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: 10px; font-weight: 650; box-shadow: 0 8px 24px rgba(0,0,0,.18); background: var(--ok-bg); color: var(--ok); }
.toast.error { background: var(--bad-bg); color: var(--bad); }
.error-box { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-weight: 650; font-size: .88rem; }
.info-box { background: var(--surface-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-size: .88rem; }
.soon-page { text-align: center; padding: 50px 20px; }
.soon-page .ico { width: 40px; height: 40px; color: var(--accent); margin-bottom: 10px; }

dl.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 18px; margin: 0; }
dl.kv div { border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
dl.kv dt { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
dl.kv dd { margin: 2px 0 0; font-weight: 650; }

/* Rider portal top bar */
.rider-top { background: var(--side); color: #fff; display: flex; align-items: center; gap: 12px; padding: 10px 18px; }
.rider-top .side-brand { padding: 0; border: 0; }
.rider-top button { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.rider-top main, .rider-main { max-width: 1100px; margin: 0 auto; }

@media (max-width: 1360px) {
  .clock { display: none; }
  .user-chip div { display: none; }
}
@media (max-width: 1000px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .layout.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: inline-flex; }
  .fleet-pick .label-caps { display: none; }
  .topbar { flex-wrap: wrap; }
  .user-chip { display: none; }
  .topbar .search { order: 10; flex-basis: 100%; max-width: none; }
  main { padding: 14px 12px 60px; }
  .card { padding: 14px; }
  .ptabs { margin: 14px -14px -14px; }
  .rtable .c-rider { width: 190px; min-width: 190px; max-width: 190px; }
  .rtable .c-plat { left: 234px; width: 120px; min-width: 120px; max-width: 120px; }
}

/* Import wizard */
.bad-text { color: var(--bad); }
.warn-text { color: var(--warn); }
.verify { display: grid; gap: 6px; min-width: 260px; background: var(--warn-bg); border-radius: 8px; padding: 8px; }
.verify select { width: auto; max-width: 100%; }
tr.imp-review td { background: #fffbeb; }
tr.imp-failed td { background: #fef2f2; }

/* Payslip */
dialog.wide { width: min(860px, calc(100vw - 32px)); }
.payslip { display: grid; gap: 14px; }
.ps-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--navy); padding-bottom: 10px; }
.ps-head .brand-mark { width: 52px; height: 52px; margin: 0; background-image: url("/logo-96.png"); }
.ps-month { font-weight: 800; font-size: 1.1rem; color: var(--accent); }
.ps-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ps-cols table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ps-total td { font-weight: 800; background: var(--surface-2); }
.ps-net { display: flex; justify-content: space-between; align-items: center; background: var(--navy); color: #fff; border-radius: 10px; padding: 12px 16px; font-size: 1.1rem; }
.ps-net b { font-size: 1.4rem; }
@media (max-width: 640px) { .ps-cols { grid-template-columns: 1fr; } }
@media print {
  body.printing .layout, body.printing #toasts, body.printing .rider-top, body.printing .rider-main, body.printing .no-print, body.printing dialog h2 { display: none !important; }
  body.printing dialog { position: static; box-shadow: none; width: 100%; max-width: none; }
  body.printing dialog::backdrop { background: none; }
  .ps-net { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.btn.wa, button.wa { background: #25d366; border-color: #25d366; color: #073b1c; }
.btn.wa:hover, button.wa:hover { background: #3ee07a; }
.bar.big { height: 12px; margin: 8px 0; }

.ok-text { color: var(--ok); }
.warn-box { background: var(--warn-bg); border-color: #f2dc8f; }
.ded-card { padding: 12px 14px; box-shadow: none; }
.ded-card table td { padding: 6px 4px; }
.subtabs.wrap { flex-wrap: wrap; }
tfoot td { background: var(--surface-2); font-weight: 700; }

/* Leave approval steps */
.steps { display: flex; gap: 6px; min-width: 330px; }
.steps .step { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; font-size: .78rem; background: var(--surface); }
.steps .step.ok { border-color: #b6e3c4; background: #effbf3; }
.steps .step.bad { border-color: #f5c9c9; background: #fff4f4; }
.steps .step.warn { border-color: #f2dc8f; background: #fffbea; }
.doc-dates label { display: flex; align-items: center; gap: 6px; margin: 0; }
.doc-dates label input { margin: 0; width: auto; }

/* Performance & ATA */
a.stat.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.badge.band.strong { font-weight: 800; }
table.perf td.num, table.perf th.num { white-space: nowrap; }
table.perf-pv select { min-width: 220px; }
table.perf-pv td.small { min-width: 200px; }
table.perf td:nth-child(2) { min-width: 150px; }

/* Documents & Expiry · scanner */
.scan-grid { display: grid; grid-template-columns: minmax(220px, 380px) 1fr; gap: 20px; align-items: start; }
.scan-files { display: grid; gap: 10px; }
.scan-img { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2, #f6f7f9); }
.checks-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; font-size: .9rem; }
.cands { display: grid; gap: 8px; margin-bottom: 12px; }
.cand { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.cand:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cand input[type=radio] { margin-top: 4px; }
.col { display: grid; gap: 6px; margin-bottom: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 10px 0 16px; }
@media (max-width: 860px) { .scan-grid { grid-template-columns: 1fr; } }
.cand input[type=radio] { width: auto; flex: 0 0 auto; }
.cand > div { flex: 1; text-align: left; }
.col label { display: flex; gap: 8px; align-items: center; }
.col label input { width: auto; }
.checks label { display: flex; gap: 6px; align-items: center; }
.checks label input { width: auto; }

/* Rider app complaints (office) */
.thread { display: grid; gap: 10px; margin-top: 12px; }
.thread .msg { padding: 10px 12px; border-radius: 10px; max-width: 80%; }
.thread .msg.rider { background: var(--surface-2); border: 1px solid var(--line); }
.thread .msg.staff { background: var(--accent-soft); margin-left: auto; }
.thread .msg-body { white-space: pre-wrap; word-wrap: break-word; margin: 4px 0; }

/* Urgent rider issues: red blinking rows, dashboard box, ringing bell, menu badge */
@keyframes rhe-blink { 0%, 100% { background: #fee2e2; } 50% { background: #fecaca; } }
@keyframes rhe-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes rhe-ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-14deg); } 85% { transform: rotate(14deg); } 95% { transform: rotate(-8deg); } }
tr.alert-row td { animation: rhe-blink 1.2s ease-in-out infinite; color: #7f1d1d; }
.urgent-box { background: #fef2f2; border: 2px solid var(--bad); color: #7f1d1d; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; animation: rhe-blink 1.6s ease-in-out infinite; }
.urgent-box h2 { color: var(--bad); }
.urgent-box ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.urgent-box li { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; background: #fff; border-radius: 10px; padding: 8px 10px; }
.badge.prio-urgent { background: var(--bad); color: #fff; border-color: transparent; font-weight: 800; }
.badge.prio-high { background: #fee2e2; color: var(--bad); border-color: #fca5a5; font-weight: 800; }
.badge.prio-normal { color: var(--muted); }
.side-nav .count.urgent { animation: rhe-pulse 1s ease-in-out infinite; }
.side-nav .count.soft { background: var(--side-2); color: var(--side-text); }
.bell.ringing { background: var(--bad); border-color: var(--bad); color: #fff; animation: rhe-ring 1.4s ease-in-out infinite; }
.bell .badge-n.red { background: #fff; color: var(--bad); }
@media (prefers-reduced-motion: reduce) { tr.alert-row td, .urgent-box, .side-nav .count.urgent, .bell.ringing { animation: none; } }

/* View only: buttons that change data are hidden; the server refuses changes anyway */
.view-only-bar { background: var(--info-bg); color: var(--info); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-weight: 650; font-size: .88rem; }
.view-only button.accent, .view-only .btn.accent, .view-only button.primary, .view-only .btn.primary, .view-only button.danger, .view-only button.danger-solid,
.view-only form button[type=submit], .view-only .bulkbar, .view-only input[type=file] { display: none !important; }
.view-only form input:not([type=search]), .view-only form select, .view-only form textarea { pointer-events: none; background: var(--surface-2); }

/* User Settings */
.perm-table th.c, .perm-table td.c { text-align: center; width: 90px; }
.perm-table tr.muted td { color: var(--muted); }
.access-ed { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 6px 0 12px; }
.preview-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; }
.checks label input { width: auto; }

/* Sign-in (dark) */
.auth { background: radial-gradient(1000px 520px at 50% -10%, #1c3563 0%, #0b1428 62%); color: #e2e8f0; align-items: start; }
.auth-inner { width: 100%; max-width: 560px; padding-top: 8px; }
.auth-head { text-align: center; margin-bottom: 18px; }
.auth-logo { width: 104px; height: 104px; margin: 0 auto 14px; border-radius: 22px; background: #16284d; border: 1px solid #253d6b; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.auth-logo .brand-mark { width: 92px; height: 92px; margin: 0; }
.auth h1 { color: #fff; font-size: 1.9rem; font-weight: 900; letter-spacing: .04em; margin: 0 0 6px; }
.auth-sub { color: #9fb0ca; font-size: 1rem; }
.auth-status { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-weight: 650; color: #cbd5e1; font-size: .92rem; }
.auth-status .dot { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; }
.auth-status.ok .dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.auth-status.bad .dot { background: #f87171; box-shadow: 0 0 0 3px rgba(248,113,113,.2); }
.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; border-radius: 16px; background: #111d36; border: 1px solid #22345a; margin-bottom: 16px; }
.auth-tabs button { display: flex; flex-direction: column; gap: 6px; align-items: center; padding: 12px 6px; border: none; border-radius: 12px; background: none; color: #cbd5e1; font-size: 1rem; font-weight: 750; }
.auth-tabs button .ico { width: 22px; height: 22px; }
.auth-tabs button:hover { background: #18284a; }
.auth-tabs button[aria-selected="true"] { background: #f0a30a; color: #0b1428; box-shadow: 0 6px 20px rgba(240,163,10,.35); }
.auth-info { display: flex; gap: 14px; align-items: flex-start; background: #111d36; border: 1px solid #22345a; border-radius: 16px; padding: 16px 18px; margin-bottom: 18px; }
.auth-info b { color: #fff; font-size: 1.12rem; }
.auth-info p { margin: 4px 0 0; color: #9fb0ca; font-size: .95rem; }
.auth-info-ico { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px; background: #2a2412; color: #f0a30a; display: grid; place-items: center; }
.auth-info-ico .ico { width: 22px; height: 22px; }
.auth-form .field { margin-bottom: 16px; }
.auth-label { color: #cbd5e1; font-size: .78rem; font-weight: 800; letter-spacing: .1em; }
.auth-input { display: flex; align-items: center; gap: 10px; margin-top: 8px; background: #0e1830; border: 1px solid #22345a; border-radius: 12px; padding: 0 14px; }
.auth-input:focus-within { border-color: #f0a30a; box-shadow: 0 0 0 3px rgba(240,163,10,.18); }
.auth-input > .ico { width: 20px; height: 20px; color: #7d8ca5; flex: 0 0 auto; }
.auth-input input { flex: 1; background: transparent; border: none; color: #fff; padding: 14px 0; font-size: 1.02rem; letter-spacing: normal; box-shadow: none; outline: none; }
.auth-input input::placeholder { color: #61708a; }
.auth-input input.code-input { letter-spacing: .35em; }
.auth-eye { background: none; border: none; color: #7d8ca5; padding: 4px; }
.auth-eye:hover { background: none; color: #cbd5e1; }
.auth-eye .ico { width: 20px; height: 20px; }
.auth-submit { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 15px; border-radius: 12px; border: none; background: #f0a30a; color: #0b1428; font-size: 1.12rem; font-weight: 850; text-decoration: none; }
.auth-submit:hover { background: #f5b53a; }
.auth-submit .ico { width: 20px; height: 20px; }
.auth-submit.ghost { background: #16284d; color: #e2e8f0; }
.auth-links { text-align: center; margin-top: 18px; }
.auth-links .link, .auth-note .link { color: #9fb0ca; text-decoration: underline; font-size: .98rem; }
.auth-note { color: #9fb0ca; margin: 0 0 16px; }
.auth-check { display: flex; gap: 8px; align-items: center; color: #cbd5e1; font-size: .92rem; margin: -4px 0 16px; }
.auth-check input { width: auto; }
.auth .qr-box { background: #fff; }
.auth .secret { background: #0e1830; border-color: #22345a; color: #fff; }
.auth .error-box { background: #3b1219; color: #fecaca; }
@media (max-width: 480px) { .auth h1 { font-size: 1.5rem; } .auth-tabs button { font-size: .9rem; } }

/* Company Settings */
.company-logo { width: 96px; height: 96px; object-fit: contain; border-radius: 12px; background: var(--side); padding: 6px; flex: none; }

/* Sidebar: recent activity */
.recent { padding: 10px 16px 12px; border-top: 1px solid rgba(255,255,255,.06); }
.recent:empty { display: none; }
.recent-head { display: flex; justify-content: space-between; align-items: center; font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #8ea0bd; margin-bottom: 6px; }
.recent-head a { color: #8ea0bd; letter-spacing: 0; text-transform: none; font-weight: 600; text-decoration: none; }
.recent-head a:hover { color: #fff; }
.recent-item { display: block; padding: 5px 0; text-decoration: none; color: var(--side-text); }
.recent-item:hover .recent-text { color: #fff; }
.recent-top { display: flex; gap: 8px; align-items: baseline; font-size: .68rem; }
.recent-top b { color: var(--accent-2); text-transform: uppercase; letter-spacing: .06em; }
.recent-top span { color: #7f90ad; }
.recent-text { font-size: .78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #dbe3f0; }
.recent-who { font-size: .7rem; color: #8ea0bd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Excel buttons, master sheet */
.excel-btns { gap: 6px; flex-wrap: wrap; }
label.btn input[type=file] { display: none; }
.section-title { margin: 18px 0 8px; font-size: 1rem; }
tr.row-bad td { background: var(--bad-bg, #fdecec); }

/* WhatsApp Dispatch, scan button on the dashboard */
a.btn.wa.done { opacity: .6; }
.hero .hero-scan { margin-top: 12px; position: relative; z-index: 1; }

/* Frozen headings: the page heading (and the rider profile card with its tabs) stay under the top bar while scrolling */
.page-head, .sticky-head { position: sticky; top: var(--topbar-h, 64px); z-index: 15; }
.page-head { background: var(--bg); padding: 10px 0; margin-top: -10px; box-shadow: 0 8px 8px -8px rgba(15, 29, 58, .12); }
.sticky-head { box-shadow: 0 6px 14px -8px rgba(15, 29, 58, .25); }
@media print { .page-head, .sticky-head { position: static; box-shadow: none; } }
/* Loan sheet import */
.w-num { width: 110px; }
.info-text { color: var(--info); }
/* Dashboard: small Captain Support Center card */
.card.compact { padding-bottom: 10px; }
.mini-list { display: grid; gap: 4px; margin-bottom: 6px; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: inherit; text-decoration: none; }
.mini-row:hover { border-color: var(--accent); }
.mini-v { font-size: 1.15rem; font-weight: 800; }
.mini-v.ok { color: var(--ok); } .mini-v.warn { color: var(--warn); } .mini-v.bad { color: var(--bad); }
/* Payslip (Owner's layout) */
.ps2-head { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; text-align: center; }
.ps2-head > div { flex: 1; } .ps2-head b { font-size: 1.15rem; display: block; }
.ps2-head .brand-mark { width: 70px; height: 70px; flex: 0 0 auto; }
.ps2 td.c { text-align: center; } .ps2 td.b { font-weight: 700; }
.ps2-yellow { background: #fff200; font-weight: 700; }
.ps2-bar { background: #ffc000; color: #0f1b2d; text-align: center; }
.ps2-gross { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 0; background: #ffc000; border-radius: 6px; padding: 8px 10px; margin: 10px 0 6px; text-align: center; font-weight: 700; }
.ps2-net { display: flex; justify-content: space-between; align-items: center; background: #92d050; border-radius: 6px; padding: 10px 14px; font-weight: 800; font-size: 1.1rem; }
.ps2 .ps-cols { align-items: start; }
.ps-canvas canvas { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
