/* ============================================================
   AL MUBARAK — "Xdesk" skin (v39)
   ------------------------------------------------------------
   Loaded LAST, after style.css + ui.css. Presentation only:
   no class the pages depend on is renamed, nothing here changes
   what a form posts or what a link opens.

   Shell: navy sidebar (248px) · white blurred top bar (64px)
          · content max 1400px · phone drawer + bottom tab bar.

   Token note: style.css already uses --muted as a light BACKGROUND
   in ~40 places (CSS, inline styles, the new app). Re-pointing it
   at the Xdesk slate text colour would turn those backgrounds grey,
   so the Xdesk "muted text" colour lives in --muted-fg (the name the
   old sheets already use for muted text) and --muted stays a tint.
   ============================================================ */

@font-face { font-family:'Inter'; src:url('fonts/InterVariable.woff2') format('woff2');
  font-weight:100 900; font-display:swap;
  unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Inter'; src:url('fonts/InterVariable-ext.woff2') format('woff2');
  font-weight:100 900; font-display:swap;
  unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family:'IBM Plex Sans Arabic'; src:url('fonts/IBMPlexSansArabic-Regular.woff2') format('woff2');
  font-weight:400; font-display:swap; unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family:'IBM Plex Sans Arabic'; src:url('fonts/IBMPlexSansArabic-SemiBold.woff2') format('woff2');
  font-weight:600; font-display:swap; unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }

/* ---------- design tokens (every theme) ---------- */
:root {
  --canvas:#F6F7F9; --surface:#FFFFFF; --ink:#0F172A; --line:#E5E7EB;
  --navy:#0B1736; --navy-2:#13224A;
  --primary-600:#4338CA; --primary-50:#EEF2FF;
  --brand:#F5A524; --success:#059669; --warning:#D97706; --danger:#DC2626;
  --r-card:12px; --r-input:8px; --r-tile:10px;
  --shadow-card:0 1px 2px rgba(16,24,40,.04);
  --shadow-pop:0 20px 25px -5px rgba(0,0,0,.10),0 8px 10px -6px rgba(0,0,0,.10);
  --sidebar-w:248px; --topbar-h:64px;
  --font:'Inter','IBM Plex Sans Arabic',ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --tint:#F8FAFC;
}

/* ---------- default (Light) theme = Xdesk colours, mapped onto the old token names ---------- */
:root:not([data-theme]) {
  --background:#F6F7F9; --card:#FFFFFF; --foreground:#0F172A;
  --muted:#F1F5F9; --muted-fg:#64748B; --border:#E5E7EB; --input:#E5E7EB;
  --primary:#4F46E5; --primary-fg:#FFFFFF; --primary-hover:#4338CA;
  --gold:#F5A524; --gold-d:#B45309; --gold-soft:#FFFBEB;
  --ok:#059669; --ok-soft:#ECFDF5; --bad:#DC2626; --bad-soft:#FEF2F2;
  --warn:#D97706; --warn-soft:#FFFBEB;
  --ring:rgba(79,70,229,.15);
  --accent:#F1F5F9; --accent-fg:#0F172A; --hover:#F8FAFC;
  --radius:12px; --radius-lg:12px; --radius-md:8px; --radius-sm:6px;
  --shadow:0 1px 2px rgba(16,24,40,.04); --shadow-md:0 4px 12px -2px rgba(16,24,40,.08);
  --shadow-lg:0 20px 25px -5px rgba(0,0,0,.10),0 8px 10px -6px rgba(0,0,0,.10);
  --mut:#64748B; --sel-arrow:#64748B;
}
[data-theme="midnight"], [data-theme="carbon"] { --tint:var(--muted); --primary-50:rgba(129,140,248,.16); }

html, body { background:var(--background); }
body {
  font-family:var(--font); font-size:14px; line-height:1.5; letter-spacing:0;
  font-feature-settings:'cv11','ss01'; -webkit-font-smoothing:antialiased;
}
html[lang='ar'] body, [lang='ar'] { font-family:'IBM Plex Sans Arabic','Inter',sans-serif; }
.tabular, .num, td.num, th.num, .money, .card .v, .ringcard .rv, .kpi__value { font-variant-numeric:tabular-nums; }

/* ============================================================
   SHELL
   ============================================================ */
.sidebar {
  position:fixed; top:0; bottom:0; inset-inline-start:0; width:var(--sidebar-w);
  background:var(--navy); display:flex; flex-direction:column; z-index:70;
  color:#CBD5E1;
}
.sidebar__head {
  height:var(--topbar-h); flex:none; display:flex; align-items:center; gap:10px;
  padding:0 16px 0 20px; border-bottom:1px solid rgba(255,255,255,.05);
}
.brand-tile {
  width:36px; height:36px; border-radius:var(--r-tile); background:var(--brand); color:var(--navy);
  display:grid; place-items:center; font-weight:700; font-size:15px; flex-shrink:0; letter-spacing:0;
}
img.brand-tile { object-fit:contain; background:#fff; padding:2px; }
.sidebar__id { min-width:0; flex:1 1 auto; }
.sidebar__name { color:#fff; font-weight:600; font-size:14px; line-height:1.2;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sidebar__tag { color:#94A3B8; font-size:11px; line-height:1.3; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sidebar__x { display:none; }

/* #mainnav keeps its id (app JS closes the drawer on click) — id selectors here beat style.css */
#mainnav.sidebar__nav {
  display:block; position:static; flex:1 1 auto; overflow-y:auto; padding:4px 12px 12px;
  background:transparent; border:0; box-shadow:none; max-height:none; gap:0;
  scrollbar-width:thin; scrollbar-color:rgba(255,255,255,.12) transparent;
  overscroll-behavior:contain;
}
.nav-section { margin:16px 0 6px; padding:0 12px; font-size:11px; font-weight:600; letter-spacing:.06em;
  text-transform:uppercase; color:#64748B; }
#mainnav.sidebar__nav a.nav-item {
  display:flex; align-items:center; gap:12px; height:34px; min-height:34px; padding:0 12px; margin:1px 0;
  border-radius:var(--r-input); color:#CBD5E1; font-size:13.5px; font-weight:400;
  background:transparent; transition:background .15s, color .15s; text-decoration:none;
}
.nav-item svg { width:18px; height:18px; flex:none; color:#94A3B8; }
.nav-item span.nav-label { flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#mainnav.sidebar__nav a.nav-item:hover { background:rgba(255,255,255,.05); color:#fff; }
#mainnav.sidebar__nav a.nav-item.is-active { background:rgba(255,255,255,.10); color:#fff; font-weight:500; }
.nav-item.is-active svg { color:var(--brand); }
.nav-item .navbadge {
  margin-inline-start:auto; min-width:20px; height:18px; padding:0 6px; border-radius:999px;
  background:var(--danger); color:#fff; font-size:11px; font-weight:600; line-height:18px; text-align:center;
}
.sidebar__foot { flex:none; padding:12px 20px; border-top:1px solid rgba(255,255,255,.05);
  font-size:11px; color:#64748B; padding-bottom:calc(12px + env(safe-area-inset-bottom)); }
.sidebar__foot a { color:#94A3B8; }

.app { padding-inline-start:var(--sidebar-w); min-height:100vh; min-height:100dvh; display:flex; flex-direction:column; }
.app > main { flex:1 0 auto; }

/* ---------- top bar ---------- */
.app > .topbar {
  position:sticky; top:0; z-index:40; height:var(--topbar-h); display:flex; align-items:center; gap:12px;
  padding:0 24px; background:rgba(255,255,255,.9); -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line); box-shadow:none; color:var(--foreground);
}
[data-theme] .app > .topbar { background:color-mix(in srgb, var(--card) 90%, transparent); border-bottom-color:var(--border); }
.topbar__title { font-size:14px; font-weight:600; color:var(--foreground); min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.topbar__right { margin-inline-start:auto; display:flex; align-items:center; gap:8px; }
.icon-btn {
  position:relative; width:40px; height:40px; display:grid; place-items:center; border:0; background:none;
  border-radius:var(--r-tile); color:#475569; cursor:pointer; flex:none; -webkit-tap-highlight-color:transparent;
}
.icon-btn svg { width:20px; height:20px; }
.icon-btn:hover { background:var(--accent); text-decoration:none; }
.app > .topbar .burger { display:none; padding:0; margin:0; }
.dot-count {
  position:absolute; top:5px; inset-inline-end:4px; min-width:16px; padding:0 4px; border-radius:999px;
  background:var(--danger); color:#fff; font-size:10px; font-weight:600; line-height:16px; text-align:center;
}

/* user chip + dropdown (a <details>, so it needs no JS) */
.user-menu { position:relative; }
.user-menu > summary { list-style:none; cursor:pointer; }
.user-menu > summary::-webkit-details-marker { display:none; }
.user-chip { display:flex; align-items:center; gap:8px; padding:4px 8px 4px 4px; border-radius:var(--r-tile); }
.user-chip:hover, .user-menu[open] .user-chip { background:var(--accent); }
.avatar {
  width:32px; height:32px; border-radius:999px; background:var(--primary-50); color:var(--primary);
  display:grid; place-items:center; font-size:12px; font-weight:600; flex:none; letter-spacing:.02em;
}
.user-chip__text { display:flex; flex-direction:column; line-height:1.2; min-width:0; }
.user-chip__name { font-size:13px; font-weight:500; color:var(--foreground); max-width:160px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.user-chip__role { font-size:11px; color:var(--muted-fg); text-transform:capitalize; }
.user-chip__caret { width:16px; height:16px; color:var(--muted-fg); }
.user-pop {
  position:absolute; top:calc(100% + 6px); inset-inline-end:0; z-index:80; width:240px;
  background:var(--card); border:1px solid var(--border); border-radius:var(--r-card);
  box-shadow:var(--shadow-pop); padding:6px;
}
.user-pop__who { padding:8px 10px 10px; border-bottom:1px solid var(--border); margin-bottom:6px; }
.user-pop__who strong { display:block; font-size:13.5px; font-weight:600; }
.user-pop__who small { font-size:12px; color:var(--muted-fg); text-transform:capitalize; }
.user-pop label.user-pop__row { display:flex; flex-direction:row; align-items:center; justify-content:space-between;
  gap:8px; padding:6px 10px; font-size:13px; font-weight:400; color:var(--foreground); }
.user-pop .themesel { min-height:32px; height:32px; font-size:13px; padding:0 28px 0 8px; max-width:none; width:auto; }
.user-pop a.user-pop__item {
  display:flex; align-items:center; gap:10px; height:36px; padding:0 10px; border-radius:var(--r-input);
  color:var(--foreground); font-size:13.5px;
}
.user-pop a.user-pop__item:hover { background:var(--accent); text-decoration:none; }
.user-pop a.user-pop__item svg { width:16px; height:16px; color:var(--muted-fg); }
.user-pop a.user-pop__item.is-danger, .user-pop a.user-pop__item.is-danger svg { color:var(--danger); }

/* ---------- main ---------- */
.app > main.wrap { width:100%; max-width:1400px; margin:0 auto; padding:20px 24px 40px; }
.app > main.wrap > h1:first-child, .app > main.wrap > .flash:first-child + h1 { margin-top:0; }
.app > footer {
  border-top:1px solid var(--border); margin:0; padding:14px 24px; font-size:12px; color:var(--muted-fg);
  text-align:start; background:transparent;
}
.app > footer a { color:var(--muted-fg); }

/* the scrim behind the phone drawer */
.navscrim { display:none; }

/* ============================================================
   TYPE & PAGE HEADER
   ============================================================ */
h1 { font-size:22px; font-weight:600; letter-spacing:-.01em; line-height:1.3; margin:4px 0 16px; color:var(--foreground); }
h1 .hint { font-size:13px; font-weight:400; color:var(--muted-fg); }
h2 { font-size:15px; font-weight:600; letter-spacing:0; }
h3 { font-size:14px; font-weight:600; }
.hint { color:var(--muted-fg); font-size:13px; }
.pagehead, .page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; margin:4px 0 16px; }
.pagehead h1, .page-head h1 { margin:0; }
.page-sub { color:var(--muted-fg); font-size:13.5px; margin-top:2px; }
.page-actions { display:flex; gap:8px; flex-wrap:wrap; }
.back-link { display:inline-flex; align-items:center; gap:4px; font-size:13px; color:var(--muted-fg); margin-bottom:6px; }
.back-link:hover { color:var(--foreground); text-decoration:none; }
a { color:var(--primary); }
a:hover { text-decoration:none; color:var(--primary-hover); }

/* ============================================================
   CARDS, PANELS, KPI TILES
   ============================================================ */
.panel {
  background:var(--card); border:1px solid var(--border); border-radius:var(--r-card);
  box-shadow:var(--shadow-card); padding:20px; margin:16px 0;
}
.panel > strong:first-child, .panel > h2:first-child, .panel > h3:first-child { font-size:15px; font-weight:600; }
.panel > h2:first-child, .panel > h3:first-child { margin-top:0; }
.card {
  background:var(--card); border:1px solid var(--border); border-radius:var(--r-card);
  box-shadow:var(--shadow-card); padding:16px 18px;
}
.card .k { color:var(--muted-fg); font-size:13px; font-weight:400; }
.card .v { font-size:22px; font-weight:600; letter-spacing:-.01em; margin-top:4px; }
.card.ok, .card.bad, .card.warn { border-left-width:1px; }
.card.ok  { box-shadow:inset 3px 0 0 var(--ok),  var(--shadow-card); }
.card.bad { box-shadow:inset 3px 0 0 var(--bad), var(--shadow-card); }
.card.warn{ box-shadow:inset 3px 0 0 var(--warn),var(--shadow-card); }

/* dashboard ring tiles → KPI tile: text left, tinted 36px icon tile right */
.ringrow { display:grid; grid-template-columns:repeat(auto-fit, minmax(190px, 1fr)); gap:16px; margin:16px 0; }
.ringcard {
  display:flex; flex-direction:row-reverse; align-items:flex-start; justify-content:space-between; gap:12px;
  background:var(--card); border:1px solid var(--border); border-radius:var(--r-card);
  box-shadow:var(--shadow-card); padding:16px 18px; min-width:0; text-align:start;
}
.ringcard::before, .ringcard::after { display:none !important; }
.ringcard > svg { width:36px; height:36px; flex:none; padding:5px; border-radius:var(--r-tile); background:var(--primary-50); }
.ringcard > svg text { display:none; }
.ringcard.t-red > svg   { background:#FEF2F2; }
.ringcard.t-green > svg { background:#ECFDF5; }
.ringcard.t-gold > svg, .ringcard.t-orange > svg { background:#FFFBEB; }
.ringcard .rk { font-size:13px; font-weight:400; letter-spacing:0; text-transform:none; color:var(--muted-fg); }
.ringcard .rv { font-size:22px; font-weight:600; letter-spacing:-.01em; margin-top:4px; color:var(--foreground); }
.ringcard .rs { font-size:12px; color:var(--muted-fg); margin-top:2px; }

/* opt-in KPI tile for new screens */
.kpi { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; background:var(--card);
  border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow-card); padding:16px 18px; }
.kpi__label { font-size:13px; color:var(--muted-fg); }
.kpi__value { font-size:22px; font-weight:600; margin-top:4px; }
.kpi__hint { font-size:12px; color:var(--muted-fg); margin-top:2px; }
.kpi__icon { width:36px; height:36px; border-radius:var(--r-tile); display:grid; place-items:center;
  background:var(--primary-50); color:var(--primary); flex:none; }
.dashgrid { gap:16px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn, button.btn {
  min-height:40px; padding:0 16px; border-radius:var(--r-input); font-size:14px; font-weight:500;
  border:1px solid var(--border); background:var(--card); color:var(--foreground); box-shadow:none;
}
.btn:hover, button.btn:hover { background:var(--tint); border-color:#CBD5E1; }
.btn.gold, .btn-sm.gold, button.btn.gold {
  background:var(--primary); border-color:var(--primary); color:var(--primary-fg);
}
.btn.gold:hover, .btn-sm.gold:hover { background:var(--primary-hover); border-color:var(--primary-hover); color:#fff; }
.btn.danger, .btn-sm.danger { background:var(--danger); border-color:var(--danger); color:#fff; }
.btn.danger:hover { background:#B91C1C; border-color:#B91C1C; }
.btn.ghost { border-color:transparent; background:transparent; }
.btn-sm, button.btn-sm { min-height:32px; padding:0 12px; font-size:13px; border-radius:var(--r-input); box-shadow:none; }
.btn:focus-visible, .btn-sm:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline:none; box-shadow:0 0 0 3px var(--ring);
}

/* ============================================================
   FORMS
   ============================================================ */
/* :where() keeps these at plain-element weight, so every page's own input rules still win */
input:where(:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color])),
select, textarea {
  border:1px solid var(--input); border-radius:var(--r-input); background:var(--card);
  color:var(--foreground); box-shadow:none; transition:border-color .15s, box-shadow .15s;
}
input:where(:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]):not([type=hidden])),
select { min-height:40px; padding-inline:12px; font-size:14px; }
textarea { padding:9px 12px; font-size:14px; }
/* inputs inside table grids (quick entry, attendance, time-sheet days) stay compact */
td :where(input, select) { min-height:32px; padding-inline:8px; }
input:focus, select:focus, textarea:focus {
  outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--ring);
}
@media (max-width:768px) { input, select, textarea { font-size:16px; } }   /* iPhone: no zoom-on-tap */
label { font-size:13px; font-weight:500; color:var(--foreground); }
input[readonly] { background:var(--tint); color:var(--muted-fg); }
input[type="checkbox"], input[type="radio"] { accent-color:var(--primary); }
.filters { gap:12px; }
/* opt-in two-column form grid */
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.form-grid > .full { grid-column:1 / -1; }
.field > label, .field-label { display:block; font-size:13px; font-weight:500; margin-bottom:6px; }

/* period chips & tabs */
.pchip { border-radius:999px; }
.pchip.active { background:var(--primary-50); color:var(--primary); border-color:#C7D2FE; }
.tabs { background:var(--muted); border-color:var(--border); border-radius:var(--r-tile); }
.tab.active { color:var(--primary); }
.utabs .tab.active { background:var(--primary); border-color:var(--primary); color:#fff; }

/* ============================================================
   TABLES
   ============================================================ */
.panel > table, .panel > .tscroll, .tscroll { border-radius:0; }
table { background:var(--card); font-size:13.5px; }
th {
  background:var(--tint); color:var(--muted-fg); font-size:12px; font-weight:600;
  text-transform:uppercase; letter-spacing:.04em; padding:10px 16px; border-bottom:1px solid var(--border);
}
td { padding:12px 16px; border-bottom:1px solid var(--border); }
tr:hover td { background:var(--tint); }
td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; }
/* a table that is the whole content of a bare .tscroll gets the card frame */
main.wrap > .tscroll, main.wrap > form > .tscroll {
  background:var(--card); border:1px solid var(--border); border-radius:var(--r-card);
  box-shadow:var(--shadow-card); margin:16px 0; overflow:auto;
}
main.wrap > .tscroll > table tr:last-child td, main.wrap > form > .tscroll > table tr:last-child td { border-bottom:0; }
.grid-entry td, .grid-entry th { padding:6px 8px; }

/* ============================================================
   BADGES — soft background, dark text (stored values untouched)
   ============================================================ */
.badge {
  display:inline-flex; align-items:center; gap:4px; height:22px; padding:0 8px; border-radius:999px;
  font-size:12px; font-weight:500; border:0; background:#F1F5F9; color:#334155; white-space:nowrap;
}
/* green */
.badge.PAID, .badge.LOADING, .badge.paid, .badge.approved, .badge.completed, .badge.verified,
.badge.issued, .badge.done, .badge.DONE, .badge.APPROVED, .badge.is-green { background:#ECFDF5; color:#047857; }
/* amber */
.badge.FILLING, .badge.UNREG, .badge.pending, .badge.partial, .badge.awaiting, .badge.PENDING,
.badge.is-amber { background:#FFFBEB; color:#92400E; }
/* blue */
.badge.open, .badge.OPEN, .badge.in_progress, .badge.submitted, .badge.SUBMITTED, .badge.is-blue { background:#EEF2FF; color:#4338CA; }
/* red */
.badge.UNPAID, .badge.REJECTED, .badge.rejected, .badge.cancelled, .badge.overdue, .badge.duplicate,
.badge.is-red { background:#FEF2F2; color:#B91C1C; }
.badge.REJECTED, .badge.rejected { text-decoration:line-through; }
/* gray */
.badge.draft, .badge.closed, .badge.DRAFT, .badge.CLOSED, .badge.is-gray { background:#F1F5F9; color:#334155; }
/* violet */
.badge.VENDOR, .badge.is-violet { background:#F5F3FF; color:#6D28D9; }
[data-theme="midnight"] .badge, [data-theme="carbon"] .badge { filter:saturate(.9); }

/* ============================================================
   FLASH, PIN PAD, LOGIN
   ============================================================ */
.flash { border-radius:var(--r-input); font-weight:500; }

.pindots i.on { background:var(--primary); border-color:var(--primary); }
.pinpad { gap:12px; }
.pinpad button {
  min-height:64px; border-radius:12px; background:var(--card); border:1px solid var(--line);
  font-size:22px; font-weight:600; color:var(--foreground); box-shadow:none;
}
.pinpad button:active { background:var(--primary-50); border-color:#C7D2FE; }
.pinpad .pgo { background:var(--primary); border-color:var(--primary); color:#fff; }
.pinpad .pgo:active { background:var(--primary-600); }

/* login — split screen. The left half is decoration; the form keeps every id/name it had. */
body.xd-login { background:var(--card); }
.login-split { min-height:100vh; min-height:100dvh; display:grid; grid-template-columns:1fr 1fr; }
.login-hero {
  background:var(--navy); color:#fff; padding:48px 56px; display:flex; flex-direction:column; justify-content:center; gap:28px;
}
.login-hero .brand-tile { width:48px; height:48px; font-size:18px; border-radius:12px; }
.login-hero h2 { font-size:34px; font-weight:600; line-height:1.2; letter-spacing:-.02em; margin:0; color:#fff; max-width:520px; }
.login-hero ul { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:14px; }
.login-hero li { display:flex; gap:12px; align-items:flex-start; color:#CBD5E1; font-size:15px; }
.login-hero li svg { width:20px; height:20px; flex:none; color:var(--brand); margin-top:1px; }
.login-hero .login-foot { font-size:12px; color:#64748B; margin-top:auto; }
.login-split .login-wrap { min-height:0; padding:40px 24px; background:var(--card); }
.login-split .login-box { max-width:380px; border:0; box-shadow:none; padding:0; background:transparent; }
.login-split .login-box input:not([type=hidden]) { width:100%; }
.login-split .login-box .btn { width:100%; min-height:44px; }
.login-split .login-logo { width:100%; max-width:380px; text-align:start; }
.login-split .login-company { font-size:22px; font-weight:600; }
.login-split .login-company small { font-size:13.5px; }
.login-split .login-logo .logo-big { display:none; }
.login-split .pinpad, .login-split .pindots { max-width:380px; }

/* ============================================================
   PHONE / TABLET  (< 1024px): drawer + bottom tab bar
   ============================================================ */
@media (max-width:1023.98px) {
  .app { padding-inline-start:0; }
  .app > .topbar { padding:0 12px; padding-top:env(safe-area-inset-top); height:calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .app > .topbar .burger { display:grid; }
  .app > .topbar .burger span { display:none; }
  .user-chip__text, .user-chip__caret { display:none; }
  .user-chip { padding:4px; }

  .sidebar {
    width:min(84vw, 300px); transform:translateX(-101%); visibility:hidden;
    transition:transform .24s cubic-bezier(.32,.72,0,1), visibility 0s linear .24s;
    box-shadow:var(--shadow-pop); padding-top:env(safe-area-inset-top);
  }
  #navchk:checked ~ .sidebar { transform:none; visibility:visible; transition:transform .24s cubic-bezier(.32,.72,0,1), visibility 0s; }
  .sidebar__x { display:grid; place-items:center; width:34px; height:34px; border-radius:8px; color:#94A3B8; cursor:pointer; flex:none; }
  .sidebar__x:active { background:rgba(255,255,255,.08); }
  #mainnav.sidebar__nav a.nav-item { height:44px; font-size:15px; }
  .navscrim { position:fixed; inset:0; z-index:65; background:rgba(11,23,54,.5); }
  #navchk:checked ~ .navscrim { display:block; animation:scrim-in .2s ease both; }
  body:has(#navchk:checked) { overflow:hidden; }

  .app > main.wrap { padding:16px 16px 40px; }
  .has-tabbar .app > main.wrap { padding-bottom:112px; }
  .has-tabbar .app > footer { margin-bottom:0; padding-bottom:calc(80px + env(safe-area-inset-bottom)); }
  .ringrow { grid-template-columns:1fr 1fr; gap:12px; }
  .ringcard { padding:14px; flex-direction:row-reverse; text-align:start; }
  .ringcard .rv { font-size:19px; }
  .form-grid { grid-template-columns:1fr; }

  /* bottom tab bar: Home · Trips · (raised Add) · Payments · More */
  .tabbar {
    display:flex; align-items:flex-end; position:fixed; left:0; right:0; bottom:0; z-index:50;
    background:var(--card); border-top:1px solid var(--border); box-shadow:none;
    padding:6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabitem {
    flex:1 1 0; min-width:0; display:flex; flex-direction:column; align-items:center; gap:3px;
    padding:6px 2px; border-radius:var(--r-input); color:var(--muted-fg); font-size:11px; font-weight:500;
    text-decoration:none; cursor:pointer; -webkit-tap-highlight-color:transparent;
  }
  .tabitem svg { width:22px; height:22px; }
  .tabitem span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
  .tabitem.on { color:var(--primary); }
  .tabitem:hover { text-decoration:none; }
  .tabitem.tab-add { color:var(--foreground); }
  .tabitem.tab-add .tab-fab {
    width:52px; height:52px; margin-top:-26px; border-radius:999px; display:grid; place-items:center;
    background:var(--primary); color:#fff; box-shadow:0 8px 16px -4px rgba(79,70,229,.45); border:4px solid var(--card);
  }
  .tabitem.tab-add .tab-fab svg { width:22px; height:22px; }
  .tabitem.tab-add.on .tab-fab { background:var(--primary-600); }
}
@media (min-width:1024px) {
  .tabbar { display:none !important; }
  .navscrim { display:none !important; }
}
@media (max-width:1023.98px) and (min-width:768px) {
  .user-chip__text { display:flex; }
}
@media (max-width:520px) {
  .ringcard > svg { width:32px; height:32px; }
  h1 { font-size:20px; }
  .panel { padding:14px; }
}
@media (max-width:1023.98px) {
  .login-split { grid-template-columns:1fr; }
  .login-hero { display:none; }
  .login-split .login-logo { text-align:center; }
  .login-split .login-logo .logo-big { display:inline-block; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .app > .topbar, .tabbar, .navscrim, .no-print { display:none !important; }
  .app { padding:0 !important; display:block; }
  .app > main.wrap { max-width:none; padding:0; }
  html, body { background:#fff !important; }
  .panel, .card, .ringcard, .kpi, main.wrap > .tscroll { box-shadow:none !important; }
  th { background:transparent; }
}

/* driver / vendor PIN portals (/d/, /vd/, /v/): a centred white card on the canvas */
body.xd-portal { background:var(--background); }
.xd-portal .login-box {
  max-width:380px; background:var(--card); border:1px solid var(--border); border-radius:var(--r-card);
  box-shadow:var(--shadow-card); padding:24px;
}
.xd-portal .login-box .btn { width:100%; min-height:44px; }

/* ============================================================
   Reference components (Xdesk kit) — for new and updated screens.
   Names that already meant something here are adapted, not replaced:
   .grid skips <table class="grid"> (time-sheet card print), .card keeps
   its padding unless it is built from .card__head/.card__body.
   ============================================================ */
.page-title { margin:0; font-size:22px; font-weight:600; letter-spacing:-.01em; }
.page-head { align-items:flex-end; margin-bottom:20px; }
.page-sub { margin:2px 0 0; font-size:14px; }
.actions { display:flex; flex-wrap:wrap; gap:8px; }

.card:has(> .card__head), .card:has(> .card__body) { padding:0; }
.card__head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 20px; border-bottom:1px solid var(--border); }
.card__title { margin:0; font-size:15px; font-weight:600; }
.card__body { padding:20px; }
.grid:not(table) { display:grid; gap:16px; }
.grid-4 { grid-template-columns:repeat(4,minmax(0,1fr)); }
.grid-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }

.stat { display:flex; justify-content:space-between; gap:12px; padding:16px; background:var(--card);
  border:1px solid var(--border); border-radius:var(--r-card); box-shadow:var(--shadow-card); }
.stat:hover { border-color:#CBD5E1; }
.stat__label { font-size:13px; color:var(--muted-fg); }
.stat__value { margin-top:4px; font-size:22px; font-weight:600; font-variant-numeric:tabular-nums; }
.stat__hint { margin-top:4px; font-size:12px; color:var(--muted-fg); }
.stat__icon { width:36px; height:36px; border-radius:var(--r-tile); display:grid; place-items:center; flex-shrink:0; background:var(--primary-50); color:var(--primary); }

.btn-primary { background:var(--primary); border-color:var(--primary); color:#fff; box-shadow:0 1px 2px rgba(16,24,40,.05); }
.btn-primary:hover { background:var(--primary-600); border-color:var(--primary-600); color:#fff; }
.btn-secondary { background:var(--card); color:var(--foreground); border-color:var(--border); }
.btn-secondary:hover { background:var(--tint); }
.btn-ghost { background:none; border-color:transparent; color:#475569; }
.btn-ghost:hover { background:#F1F5F9; }
.btn-danger { background:var(--card); color:var(--danger); border-color:#FECACA; }
.btn-danger:hover { background:#FEF2F2; }
.btn:disabled, button.btn:disabled { opacity:.6; cursor:not-allowed; }

.field { display:block; }
.field > label, .label { display:block; margin-bottom:6px; font-size:13px; font-weight:500; color:var(--foreground); }
.field__hint { margin-top:4px; font-size:12px; color:var(--muted-fg); }
.field__error { margin-top:4px; font-size:12px; color:var(--danger); }
.input, select.input, textarea.input { width:100%; height:40px; padding:0 12px; border:1px solid var(--border);
  border-radius:var(--r-input); background:var(--card); color:var(--foreground); font:14px var(--font); }
textarea.input { height:auto; min-height:88px; padding:10px 12px; }
.input::placeholder { color:#94A3B8; }
.input:disabled { background:var(--tint); }

.table-wrap { overflow-x:auto; }
.table { width:100%; border-collapse:collapse; font-size:14px; }
.table thead tr { background:rgba(248,250,252,.6); border-bottom:1px solid var(--border); }
.table th { padding:10px 16px; text-align:start; font-weight:500; }
.table tbody tr:last-child td { border-bottom:0; }
.table .num, .table .r { text-align:end; font-variant-numeric:tabular-nums; white-space:nowrap; }

.badge-gray  { background:#F1F5F9; color:#334155; }
.badge-blue  { background:#EEF2FF; color:#4338CA; }
.badge-green { background:#ECFDF5; color:#047857; }
.badge-amber { background:#FFFBEB; color:#92400E; }
.badge-red   { background:#FEF2F2; color:#B91C1C; }
.badge-violet{ background:#F5F3FF; color:#6D28D9; }

/* tabs → pills; the existing .tab.active works the same as .is-active */
.tabs { display:flex; gap:4px; overflow-x:auto; background:none; border:0; padding:0; }
.tab { display:inline-flex; align-items:center; justify-content:center; height:32px; padding:0 12px; border-radius:999px;
  border:1px solid var(--border); background:var(--card); color:#475569; font-size:13px; cursor:pointer; box-shadow:none; }
.tab:hover { text-decoration:none; background:var(--tint); }
.tab.active, .tab.is-active, .utabs .tab.active { background:var(--navy); border-color:var(--navy); color:#fff; box-shadow:none; }
[data-theme="midnight"] .tab.active, [data-theme="carbon"] .tab.active { background:var(--primary); border-color:var(--primary); }

.alert { padding:12px 16px; border-radius:var(--r-input); font-size:14px; border:1px solid; }
.alert-error { background:#FEF2F2; border-color:#FECACA; color:#B91C1C; }
.alert-success { background:#ECFDF5; border-color:#A7F3D0; color:#047857; }
.empty { padding:48px 16px; text-align:center; color:var(--muted-fg); }

.pin-card { max-width:380px; margin:48px auto; padding:24px; background:var(--card); border:1px solid var(--border); border-radius:var(--r-card); }
.pin-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.pin-key { height:64px; border-radius:12px; border:1px solid var(--border); background:var(--card); font:600 22px var(--font); color:var(--foreground); cursor:pointer; }
.pin-key:active { background:var(--primary-50); border-color:var(--primary); }
.pinpad button:active { border-color:var(--primary); }

@media (max-width:1023.98px) {
  .grid-4 { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .grid-2 { grid-template-columns:1fr; }
}
@media (max-width:767px) {
  .page-title { font-size:20px; }
  .stat__value { font-size:18px; }
  .stat__icon { display:none; }
  .table thead { display:none; }
  .table, .table tbody, .table tr, .table td { display:block; width:100%; }
  .table tr { padding:12px 16px; border-bottom:1px solid var(--border); }
  .table td { padding:2px 0; border:0; display:flex; justify-content:space-between; gap:12px; text-align:end; }
  .table td::before { content:attr(data-label); color:var(--muted-fg); font-size:12px; text-align:start; }
}
@media print { .card, .stat { box-shadow:none !important; } }
