/* ==========================================================================
   NEXUSDRIVE ENTERPRISE — Design System
   Dark sidebar + bright workspace, luxury / award-winning feel
   ========================================================================== */

:root {
  /* Brand */
  --brand-50:  #eef4ff;
  --brand-100: #d9e6ff;
  --brand-300: #7aa2ff;
  --brand-500: #2f6bff;
  --brand-600: #1f57e6;
  --brand-700: #1746bf;
  --brand-900: #0c2a78;

  --accent:    #00d4b8;
  --accent-2:  #ff8a3d;
  --gold:      #d4af37;

  /* Surfaces */
  --bg:        #f4f6fb;
  --surface:   #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f8;

  /* Sidebar (dark) */
  --side-bg:        #0d1530;
  --side-bg-2:      #111a3a;
  --side-text:      #c9d4f0;
  --side-text-dim:  #7c89b0;
  --side-active-bg: rgba(47,107,255,.18);
  --side-active-fg: #ffffff;
  --side-border:    rgba(255,255,255,.06);

  /* Text */
  --ink-1:   #0e1530;
  --ink-2:   #2b365a;
  --ink-3:   #5d6a8a;
  --ink-4:   #94a0bd;

  /* Borders / shadow */
  --border:    #e6ebf5;
  --border-2:  #dde4f1;
  --shadow-sm: 0 1px 2px rgba(20, 30, 60, .06);
  --shadow-md: 0 8px 24px rgba(20, 30, 60, .08);
  --shadow-lg: 0 24px 60px rgba(20, 30, 60, .14);
  --ring:      0 0 0 3px rgba(47,107,255,.22);

  /* Interactive states (button hover/active) — always DARKER than rest,
     never lighter, so they remain visible against white cards. */
  --hover-tint:   #e1e8f3;   /* slightly darker than --surface-3 */
  --active-tint:  #d2dceb;   /* even darker for press */
  --hover-ink:    #1746bf;   /* brand-toned text on hover */

  /* Status palette */
  --green:   #16a34a;
  --green-bg:#dcfce7;
  --amber:   #d97706;
  --amber-bg:#fef3c7;
  --red:     #dc2626;
  --red-bg:  #fee2e2;
  --blue:    #2563eb;
  --blue-bg: #dbeafe;
  --purple:  #7c3aed;
  --purple-bg:#ede9fe;
  --slate:   #475569;
  --slate-bg:#e2e8f0;

  /* Radius / spacing */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --side-w: 264px;
  --side-w-collapsed: 76px;
  --topbar-h: 64px;
}

[data-theme="dark"] {
  --bg:        #0a1126;
  --surface:   #111a3a;
  --surface-2: #0e1633;
  --surface-3: #18224a;
  --ink-1:     #ecf0fb;
  --ink-2:     #cad3ec;
  --ink-3:     #97a3c9;
  --ink-4:     #6c789e;
  --border:    rgba(255,255,255,.08);
  --border-2:  rgba(255,255,255,.06);
  --shadow-md: 0 10px 30px rgba(0,0,0,.5);
  --shadow-lg: 0 30px 80px rgba(0,0,0,.6);
  --hover-tint:   rgba(255,255,255,.08);
  --active-tint:  rgba(255,255,255,.14);
  --hover-ink:    #ffffff;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin:0; padding:0; height:100%; }
body {
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
  letter-spacing: -0.005em;
}
button { font: inherit; cursor: pointer; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(120,135,180,.35); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,135,180,.55); }
::-webkit-scrollbar-track { background: transparent; }

/* ============================== Auth screen ============================== */
.auth-wrap {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(47,107,255,.35), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(0,212,184,.25), transparent 60%),
    linear-gradient(160deg, #0a1228 0%, #0d1530 100%);
}
.auth-card {
  width: min(440px, 92vw);
  background: rgba(17, 26, 58, .85);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 22px;
  padding: 36px 32px;
  color: #fff;
  box-shadow: 0 40px 100px rgba(0,0,0,.55);
  backdrop-filter: blur(18px);
}
.auth-card .brand {
  display:flex; align-items:center; gap:12px; margin-bottom:24px;
}
.auth-card .brand .logo {
  width:44px; height:44px; border-radius:12px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent));
  display:grid; place-items:center; color:#fff;
  box-shadow: 0 8px 22px rgba(47,107,255,.5);
}
.auth-card h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing:-0.01em; }
.auth-card p.sub { color:#9aa6c9; margin: 4px 0 22px; font-size: 13px;}
.auth-card .field { margin-bottom: 14px; }
.auth-card label { display:block; font-size:12px; color:#9aa6c9; margin-bottom:6px; }
.auth-card input {
  width:100%; padding: 12px 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  color:#fff; border-radius: 10px;
  outline: none; transition: .15s;
}
.auth-card input:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.auth-card .btn-primary {
  width:100%; margin-top: 10px;
}
.auth-hint {
  text-align:center; margin-top: 16px; font-size: 12px; color:#7c89b0;
}

/* ============================== App shell ============================== */
.app-shell {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "side topbar"
    "side main";
  height: 100vh;
  overflow: hidden;
}
.app-shell.collapsed { grid-template-columns: var(--side-w-collapsed) 1fr; }

/* Sidebar */
.sidebar {
  grid-area: side;
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  color: var(--side-text);
  border-right: 1px solid var(--side-border);
  display: flex; flex-direction: column;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.sidebar::before {
  content:""; position:absolute; inset:0; pointer-events:none;
  background:
    radial-gradient(400px 200px at 0% 0%, rgba(47,107,255,.2), transparent 60%),
    radial-gradient(380px 200px at 100% 100%, rgba(0,212,184,.12), transparent 60%);
}
.brand-row {
  position: relative;
  display:flex; align-items:center; gap:12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--side-border);
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent));
  display:grid; place-items:center; color:#fff;
  box-shadow: 0 10px 22px rgba(47,107,255,.4);
  flex-shrink:0;
}
.brand-name {
  font-weight: 700; color: #fff; font-size: 15px; line-height: 1.1;
}
.brand-name small { display:block; color: var(--side-text-dim); font-weight: 500; font-size: 11px; margin-top:2px; }
.collapsed .brand-name, .collapsed .nav-label, .collapsed .nav-section-label, .collapsed .side-user-meta {
  display:none;
}

.nav {
  position:relative; padding: 14px 10px; overflow-y:auto; flex:1; min-height:0;
}
.nav-section-label {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--side-text-dim); padding: 14px 10px 6px;
}
.nav-item {
  position: relative;
  display:flex; align-items:center; gap:12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--side-text);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; user-select:none;
  transition: background .15s, color .15s, transform .15s;
  margin-bottom: 2px;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: #fff; }
.nav-item.active {
  background: var(--side-active-bg);
  color: var(--side-active-fg);
}
.nav-item.active::before {
  content:""; position:absolute; left:-10px; top: 6px; bottom: 6px; width: 3px;
  background: linear-gradient(180deg, var(--brand-500), var(--accent));
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 12px rgba(47,107,255,.7);
}
.nav-item .icon { width: 20px; height:20px; flex-shrink:0; opacity:.95; }
.nav-item .badge-ct {
  margin-left: auto;
  background: rgba(255,255,255,.08); color: #fff;
  font-size: 10.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
}
.nav-item.active .badge-ct {
  background: linear-gradient(135deg, var(--brand-500), var(--accent));
}

.side-user {
  position: relative;
  display:flex; align-items:center; gap:10px;
  padding: 12px 14px; border-top: 1px solid var(--side-border);
  background: rgba(0,0,0,.15);
}
.side-user .avatar {
  width: 36px; height: 36px; border-radius: 999px;
  background: linear-gradient(135deg, #ffb86c, #ff7676);
  display:grid; place-items:center; color:#fff; font-weight: 700;
  flex-shrink:0;
}
.side-user-meta { font-size: 12px; line-height: 1.2; }
.side-user-meta strong { color: #fff; display:block; }
.side-user-meta span { color: var(--side-text-dim); }

/* Topbar */
.topbar {
  grid-area: topbar;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display:flex; align-items:center; gap:12px;
  padding: 0 22px;
  position: relative; z-index: 5;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display:grid; place-items:center;
  background: transparent; border: 1px solid transparent; color: var(--ink-2);
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}
.icon-btn:hover {
  background: var(--hover-tint);
  color: var(--hover-ink);
  border-color: var(--border-2);
}
.icon-btn:active {
  background: var(--active-tint);
  transform: scale(.96);
}
.icon-btn.has-dot { position: relative; }
.icon-btn.has-dot::after {
  content:""; position:absolute; top:8px; right:8px;
  width:8px; height:8px; border-radius:999px;
  background: #ff5757; box-shadow: 0 0 0 2px var(--surface);
}

.search-box {
  flex:1; max-width: 520px;
  position: relative;
}
.search-box input {
  width:100%; height: 38px;
  padding: 0 12px 0 36px;
  background: var(--surface-3);
  border:1px solid transparent;
  border-radius: 10px;
  outline: none; color: var(--ink-1);
  transition: .15s;
}
.search-box input:focus { background: var(--surface); border-color: var(--brand-500); box-shadow: var(--ring); }
.search-box .ico-search {
  position:absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3);
}
.kbd {
  position:absolute; right:8px; top:50%; transform: translateY(-50%);
  font-size: 10.5px; color: var(--ink-3);
  border: 1px solid var(--border-2); border-radius: 6px; padding: 2px 6px;
  background: var(--surface);
}

.topbar-spacer { flex:1; }
.topbar-right { display:flex; align-items:center; gap:6px; }

.theme-toggle {
  height: 36px; padding: 0 12px;
  background: var(--surface-3); border-radius: 10px;
  border: 1px solid transparent;
  display:flex; align-items:center; gap:8px; color: var(--ink-2);
  font-weight: 600;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.theme-toggle:hover {
  background: var(--hover-tint);
  color: var(--hover-ink);
  border-color: var(--border-2);
  box-shadow: 0 2px 8px rgba(20, 30, 60, .06);
}
.theme-toggle:active {
  background: var(--active-tint);
  transform: translateY(1px);
  box-shadow: none;
}

/* Main workspace */
.main {
  grid-area: main;
  overflow: auto;
  padding: 24px 28px 40px;
  position: relative;
}
.page-header {
  display:flex; align-items:flex-end; justify-content:space-between; gap:12px;
  margin-bottom: 20px;
}
.page-title {
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin:0;
}
.page-subtitle { color: var(--ink-3); margin-top: 4px; font-size: 13px; }
.crumbs { color: var(--ink-3); font-size: 12px; margin-bottom: 6px; }
.crumbs span { color: var(--ink-2); }

/* Buttons --------------------------------------------------------
   Hover state MUST be darker than the rest state so the button never
   blends into a surrounding white card. Active = pressed (slightly
   darker still + tiny scale). All buttons have a focus ring for
   keyboard accessibility.                                            */
.btn {
  display:inline-flex; align-items:center; gap:8px;
  padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 13px;
  border: 1px solid transparent;
  background: var(--surface-3); color: var(--ink-1);
  transition: background .15s ease, color .15s ease, border-color .15s ease,
              transform .12s ease, box-shadow .15s ease;
  position: relative;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  background: var(--hover-tint);
  color: var(--hover-ink);
  border-color: var(--border-2);
  box-shadow: 0 2px 8px rgba(20, 30, 60, .06);
  transform: translateY(-1px);
  text-decoration: none;
}
.btn:active {
  background: var(--active-tint);
  transform: translateY(0);
  box-shadow: none;
}
.btn:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* PRIMARY ----------------------------------------------------------- */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff; border: 1px solid transparent;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .32);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(47, 107, 255, .45);
}
.btn-primary:active {
  background: linear-gradient(135deg, var(--brand-700), var(--brand-900));
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(47, 107, 255, .35);
}

/* GHOST ------------------------------------------------------------- */
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover {
  background: var(--hover-tint);
  color: var(--hover-ink);
  border-color: transparent;
  box-shadow: none;
  transform: none;
}
.btn-ghost:active { background: var(--active-tint); }

/* DANGER ------------------------------------------------------------ */
.btn-danger {
  background: var(--red); color:#fff; border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(220, 38, 38, .28);
}
.btn-danger:hover {
  background: #b91c1c; color:#fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(220, 38, 38, .4);
}
.btn-danger:active { background: #991b1b; transform: translateY(0); }

/* SUCCESS ----------------------------------------------------------- */
.btn-success {
  background: var(--green); color:#fff; border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(22, 163, 74, .25);
}
.btn-success:hover {
  background: #15803d; color:#fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(22, 163, 74, .38);
}
.btn-success:active { background: #166534; transform: translateY(0); }

/* WARNING ----------------------------------------------------------- */
.btn-warning {
  background: var(--amber); color:#fff; border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(217, 119, 6, .25);
}
.btn-warning:hover {
  background: #b45309; color:#fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(217, 119, 6, .38);
}
.btn-warning:active { background: #92400e; transform: translateY(0); }

/* WHATSAPP ---------------------------------------------------------- */
.btn-whatsapp {
  background: #25D366; color:#fff; border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(37, 211, 102, .28);
}
.btn-whatsapp:hover {
  background: #1ebd5a; color:#fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(37, 211, 102, .42);
}
.btn-whatsapp:active { background: #18a64d; transform: translateY(0); }

/* SIZE MODIFIERS ---------------------------------------------------- */
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 12px 18px; font-size: 14px; border-radius: 12px; }

/* DISABLED STATE ---------------------------------------------------- */
.btn[disabled], .btn:disabled,
.icon-btn[disabled], .icon-btn:disabled {
  opacity: .5; pointer-events: none; cursor: not-allowed;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-pad { padding: 18px; }
.card-pad-lg { padding: 24px; }
.card-header {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 700; margin:0; letter-spacing:-0.01em; }
.card-sub { color: var(--ink-3); font-size: 12px; }

/* KPI cards
   ----------------------------------------------------------------
   FIX: previously the icon-tag was absolutely positioned in the
   top-right with zero reserved space, so long labels like
   "PENDING ASSIGNMENT" overflowed under the icon and clipped.
   New layout: explicit 2-column flex — title/value/delta on the
   left, icon on the right — both flow naturally with no overlap. */
.kpi-grid {
  display:grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 20px;
}
.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
  display: grid;
  /* text fills the left column, icon sits in its own auto-sized column */
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label icon"
    "value icon"
    "delta delta";
  column-gap: 12px;
  row-gap: 4px;
}
.kpi::after {
  content:""; position: absolute; inset: auto 0 0 0; height: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--accent));
  opacity: .9;
}
.kpi .label {
  grid-area: label;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700;
  line-height: 1.4;
  min-width: 0;
  /* allow the title to wrap to 2 lines instead of clipping */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kpi .value {
  grid-area: value;
  font-size: 26px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  min-width: 0;
  word-break: break-word;
}
.kpi .delta {
  grid-area: delta;
  margin-top: 4px; font-size: 11.5px;
  color: var(--green); font-weight: 600;
  min-width: 0;
}
.kpi .delta.down { color: var(--red); }
.kpi .icon-tag {
  grid-area: icon;
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--accent));
  box-shadow: 0 6px 14px rgba(47,107,255,.28);
  align-self: start;
  flex-shrink: 0;
}
.kpi .icon-tag svg { width: 18px; height: 18px; }

/* Tables */
.table-wrap { overflow:auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 720px; }
table.t thead th {
  text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  position: sticky; top: 0;
}
table.t tbody td {
  padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle;
}
table.t tbody tr { transition: background .12s ease; }
table.t tbody tr:hover { background: var(--hover-tint); }
table.t tbody tr:last-child td { border-bottom: 0; }

/* Status pills */
.pill {
  display:inline-flex; align-items:center; gap:6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--slate-bg); color: var(--slate);
}
.pill .dot { width:6px; height:6px; border-radius:999px; background: currentColor; }
.pill-green   { background: var(--green-bg);  color: var(--green); }
.pill-amber   { background: var(--amber-bg);  color: var(--amber); }
.pill-red     { background: var(--red-bg);    color: var(--red); }
.pill-blue    { background: var(--blue-bg);   color: var(--blue); }
.pill-purple  { background: var(--purple-bg); color: var(--purple); }

/* Forms */
.form-grid { display:grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field-block { display:flex; flex-direction:column; gap:6px; }
.field-block label { font-size: 12px; color: var(--ink-3); font-weight:600; }
.field-block input, .field-block select, .field-block textarea {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-1);
  border-radius: 10px;
  outline: none; transition: .15s;
  width: 100%;
}
.field-block textarea { min-height: 80px; resize: vertical; }
.field-block input:focus, .field-block select:focus, .field-block textarea:focus {
  border-color: var(--brand-500); box-shadow: var(--ring);
}
.checkbox-row {
  display:flex; align-items:center; gap:10px; padding: 8px 0; cursor: pointer;
}
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--brand-500); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 18, 40, .55);
  backdrop-filter: blur(6px);
  display:grid; place-items:center; z-index: 100;
  animation: fadeIn .15s ease-out;
}
.modal {
  width: min(720px, 94vw); max-height: 90vh; overflow:auto;
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.2,.9,.3,1.2);
}
.modal-lg { width: min(960px, 96vw); }
.modal-header {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; margin:0; }
.modal-body { padding: 20px 22px; }
.modal-footer {
  display:flex; justify-content:flex-end; gap:8px;
  padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2);
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity:0 } to { transform: translateY(0) scale(1); opacity:1 } }

/* Toast */
.toast-stack {
  position: fixed; right: 24px; bottom: 24px; z-index: 200;
  display:flex; flex-direction: column; gap: 10px;
}
.toast {
  min-width: 280px; max-width: 380px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-500);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  display:flex; align-items:flex-start; gap: 10px;
  animation: slideIn .2s ease-out;
}
.toast.success { border-left-color: var(--green); }
.toast.warn    { border-left-color: var(--amber); }
.toast.error   { border-left-color: var(--red); }
.toast .t-title { font-weight: 700; font-size: 13px; margin: 0 0 2px; }
.toast .t-msg { font-size: 12.5px; color: var(--ink-3); margin: 0; }
@keyframes slideIn { from { transform: translateX(20px); opacity:0 } to { transform: translateX(0); opacity:1 } }

/* Misc utilities */
.row { display:flex; align-items:center; gap:8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display:flex; flex-direction:column; gap:8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.muted { color: var(--ink-3); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.center { display:grid; place-items:center; }
.empty {
  padding: 48px 24px; text-align: center; color: var(--ink-3);
}
.empty .em-icon {
  width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 12px;
  display:grid; place-items:center;
  background: var(--surface-3); color: var(--ink-3);
}
.empty h3 { color: var(--ink-2); font-size: 15px; margin: 6px 0 4px; }
.tag {
  display:inline-flex; align-items:center; padding: 2px 8px;
  border-radius: 6px; font-size: 11px; font-weight: 600;
  background: var(--surface-3); color: var(--ink-2);
}

.grid-2 { display:grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display:grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display:grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Live status dot */
.live-dot {
  display:inline-block; width:8px; height:8px; border-radius:999px;
  background: #16a34a; box-shadow: 0 0 0 0 rgba(22,163,74,.7);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22,163,74,.7); }
  70% { box-shadow: 0 0 0 10px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

/* Segmented */
.segmented {
  display:inline-flex; background: var(--surface-3);
  padding: 3px; border-radius: 10px; gap: 2px;
}
.segmented button {
  border: none; background: transparent; padding: 7px 12px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-3);
  border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}
.segmented button:hover:not(.on) {
  background: rgba(120, 135, 180, .12);
  color: var(--ink-1);
}
.segmented button.on {
  background: var(--surface);
  color: var(--ink-1);
  box-shadow: var(--shadow-sm);
}
.chip-ct {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(120, 135, 180, .18);
  color: var(--ink-3);
  font-size: 10.5px; font-weight: 700;
  line-height: 1;
}
.segmented button.on .chip-ct,
.chip.on .chip-ct,
.bd-tab.on .chip-ct {
  background: rgba(255,255,255,.25);
  color: #fff;
}

/* Field chip selector (for form builder) */
.chip-list { display:flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display:inline-flex; align-items:center; gap:6px;
  padding: 7px 11px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; border: 1px solid transparent;
  cursor: pointer; user-select:none;
  transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.chip:hover {
  background: var(--hover-tint);
  color: var(--hover-ink);
  border-color: var(--border-2);
}
.chip.on {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff; box-shadow: 0 4px 12px rgba(47,107,255,.3);
  border-color: transparent;
}
.chip.on:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  color: #fff;
  box-shadow: 0 6px 18px rgba(47,107,255,.45);
}
.chip .x { opacity:.7 }

/* Sectioned form (driver editor) */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px 18px;
  margin-bottom: 14px;
}
.form-section-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.form-section-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .08em;
  background: rgba(0, 212, 184, .12);
  padding: 3px 8px;
  border-radius: 6px;
}
.form-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-1);
}
.form-section-body { /* container for inner grid */ }

/* Document block (insurance / road tax) */
.doc-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.file-pill {
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Incident report modal */
.inc-summary {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  color: #78350f;
}
.inc-summary-line { font-size: 12.5px; margin-bottom: 4px; }
.inc-summary-line:last-child { margin-bottom: 0; }
.inc-summary-line strong {
  display: inline-block; min-width: 72px;
  color: #92400e; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
}
[data-theme="dark"] .inc-summary {
  background: linear-gradient(135deg, rgba(245,158,11,.2), rgba(217,119,6,.3));
  color: #fcd34d;
}

.inc-radio-stack { display: flex; flex-direction: column; gap: 8px; }
.inc-radio-option {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 12px;
  align-items: flex-start !important;
  transition: border-color .15s ease, background .15s ease;
}
.inc-radio-option:hover { border-color: var(--brand-300); background: var(--hover-tint); }
.inc-radio-option input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--brand-500);
}

.inc-replace-tile {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.inc-replace-tile.rep-on {
  border: 2px solid var(--green) !important;
  background: linear-gradient(135deg, rgba(22,163,74,.08), rgba(34,197,94,.12)) !important;
  box-shadow: 0 4px 14px rgba(22,163,74,.2);
}
.inc-replace-tile.rep-on::after {
  content: "✓";
  position: absolute; top: 6px; right: 8px;
  width: 22px; height: 22px;
  background: var(--green); color: #fff;
  border-radius: 999px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 2px 8px rgba(22,163,74,.4);
}

/* Driver tile — blocked state */
.driver-tile.blocked {
  background: linear-gradient(135deg, rgba(254, 226, 226, .35), var(--surface));
}
[data-theme="dark"] .driver-tile.blocked {
  background: linear-gradient(135deg, rgba(127, 29, 29, .35), var(--surface));
}

/* Drop area */
.drop-area {
  border: 1.5px dashed var(--border-2); border-radius: 14px;
  padding: 14px; min-height: 80px;
  background: var(--surface-2);
}

/* Hotel portal (public form) */
.portal-body {
  min-height: 100vh;
  background:
    radial-gradient(800px 400px at 90% -10%, rgba(47,107,255,.15), transparent 70%),
    radial-gradient(700px 350px at -10% 110%, rgba(0,212,184,.12), transparent 70%),
    linear-gradient(180deg, #f6f8ff 0%, #eef1fb 100%);
  padding: 32px 16px;
}
.portal-shell {
  width: min(720px, 100%);
  margin: 0 auto;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(15, 25, 60, .18);
  overflow: hidden;
}
.portal-hero {
  padding: 28px 28px 24px;
  background: linear-gradient(135deg, #0d1530, #1f57e6 140%);
  color: #fff;
  position: relative;
}
.portal-hero h1 { margin: 6px 0 4px; font-size: 22px; letter-spacing:-0.01em; }
.portal-hero .h-sub { color: rgba(255,255,255,.75); font-size: 13px; }
.portal-hero .h-brand { font-size: 11.5px; opacity: .8; letter-spacing: .12em; text-transform: uppercase; }

.portal-body-inner { padding: 24px 26px 28px; }
.portal-success {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #a7f3d0;
  border-radius: 16px;
  padding: 20px;
  color: #065f46;
}

/* ============================================================
   Driver Roster — schedule view for the driver portal
   ============================================================ */
.roster-card { padding: 18px 18px 16px !important; }
.roster-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.roster-head h3 { margin: 0; font-size: 16px; font-weight: 700; }

.r-next {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent));
  color: #fff;
  margin: 6px 0 14px;
  box-shadow: 0 8px 22px rgba(47, 107, 255, .35);
  position: relative;
  overflow: hidden;
}
.r-next::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.25) 50%, transparent 65%);
  background-size: 200% 100%;
  animation: r-shine 5s linear infinite;
}
@keyframes r-shine { from { background-position: 200% 0; } to { background-position: -50% 0; } }
.r-next-left { flex-shrink: 0; }
.r-next-label {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 800; opacity: .9;
}
.r-next-time { font-size: 26px; font-weight: 900; line-height: 1.1; margin-top: 2px; }
.r-next-right { flex: 1; min-width: 0; text-align: right; }
.r-next-right strong { font-size: 14px; }
.r-next-right .muted { color: rgba(255,255,255,.85) !important; font-size: 12px; }

.r-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 14px;
}
.r-stat {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.r-stat-label {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 700; color: var(--ink-3);
}
.r-stat-value { font-size: 17px; font-weight: 800; color: var(--ink-1); margin-top: 2px; }
.r-stat-sub { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

.r-section-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin: 16px 0 6px;
}

.r-strip {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.r-strip::-webkit-scrollbar { height: 4px; }
.r-day {
  flex: 0 0 auto;
  width: 58px; min-height: 70px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 4px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
  scroll-snap-align: start;
  position: relative;
}
.r-day:hover { transform: translateY(-1px); border-color: var(--brand-300); }
.r-day-name { font-size: 10px; font-weight: 700; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.r-day-num { font-size: 18px; font-weight: 800; color: var(--ink-1); line-height: 1.1; margin-top: 2px; }
.r-day-badge {
  margin-top: 4px;
  font-size: 10px; font-weight: 800;
  background: var(--brand-500); color: #fff;
  padding: 2px 7px; border-radius: 999px;
  box-shadow: 0 2px 5px rgba(47,107,255,.35);
}
.r-day.today {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  border-color: var(--brand-600);
  box-shadow: 0 6px 18px rgba(47,107,255,.35);
}
.r-day.today .r-day-name,
.r-day.today .r-day-num { color: #fff; }
.r-day.today .r-day-badge { background: #fff; color: var(--brand-700); box-shadow: 0 2px 5px rgba(255,255,255,.4); }
.r-day.leave {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-color: #c4b5fd;
  color: #5b21b6;
}
.r-day.leave .r-day-num,
.r-day.leave .r-day-name { color: #5b21b6; }
.r-day.past {
  opacity: .55;
  background: var(--surface-3);
  border-style: dashed;
}
.r-day-leaveic {
  position: absolute; top: 2px; right: 4px;
  font-size: 11px;
}

.r-day-group {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.r-day-group.is-today { border-color: var(--brand-500); background: linear-gradient(135deg, rgba(47,107,255,.04), rgba(0,212,184,.04)); }
.r-day-header {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; margin-bottom: 8px;
  font-size: 12.5px;
}
.r-day-header strong { color: var(--ink-1); }
.r-day-header .muted { font-size: 11.5px; }

.r-job {
  display: grid;
  /* time column auto-sizes so the response pill never overflows into the meta column */
  grid-template-columns: minmax(76px, auto) minmax(0, 1fr) auto;
  gap: 12px; align-items: flex-start;
  padding: 12px 0;
  border-top: 1px dashed var(--border);
}
.r-job:first-child { border-top: 0; padding-top: 4px; }
.r-job-time { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.r-job-time strong { font-size: 15px; font-weight: 800; color: var(--ink-1); line-height: 1; }
.r-job-time .pill { white-space: nowrap; font-size: 10.5px; padding: 2px 8px; }
.r-job-meta { min-width: 0; word-break: break-word; }
.r-job-meta strong { font-size: 13.5px; }
.r-job-meta .muted { font-size: 11.5px; word-break: break-word; }
.r-job-amt { text-align: right; min-width: 80px; word-break: break-word; }
.r-job-amt strong { font-size: 14px; color: #7c2d12; font-weight: 800; }
.r-job-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

@media (max-width: 480px) {
  .r-job {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "time amt"
      "meta meta";
    gap: 6px 10px;
  }
  .r-job-time {
    grid-area: time;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  .r-job-meta { grid-area: meta; }
  .r-job-amt  { grid-area: amt; }
}

/* ============================================================
   Driver portal — Combo Carousel (Leave + Earnings in one card)
   ============================================================ */
.combo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-top: 18px;
  box-shadow: var(--shadow-sm);
}
.combo-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.combo-tabs {
  display: flex; gap: 4px;
  flex: 1; min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.combo-tabs::-webkit-scrollbar { display: none; }
.combo-tab {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid transparent;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
  color: var(--ink-3);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.combo-tab:hover:not(.on) {
  background: var(--surface-3);
  color: var(--ink-1);
}
.combo-tab.on {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  box-shadow: 0 4px 12px rgba(47, 107, 255, .35);
}
.combo-tab .tab-ct {
  font-size: 10px; font-weight: 800;
  padding: 1px 6px; border-radius: 999px;
  background: rgba(255,255,255,.25);
  margin-left: 2px;
}
.combo-tab:not(.on) .tab-ct {
  background: var(--surface-3);
  color: var(--ink-3);
}

.combo-dots {
  display: flex; gap: 5px;
  flex-shrink: 0;
  padding-left: 8px;
}
.combo-dots .cd-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--border-2);
  transition: all .25s ease;
  cursor: pointer;
}
.combo-dots .cd-dot.on {
  width: 22px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--brand-500), var(--accent));
  box-shadow: 0 2px 6px rgba(47, 107, 255, .35);
}

.combo-slider {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.combo-slider::-webkit-scrollbar { display: none; }

.combo-panel {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 16px 18px;
  min-width: 0;
}

/* Hint affordance — subtle vertical edge gradient on the right when there's
   another panel to slide to. Disappears when on the last panel. */
.combo-slider {
  position: relative;
}
.combo-card.is-first .combo-slider::after,
.combo-card.is-last  .combo-slider::before { opacity: 0 !important; }
.combo-slider::before, .combo-slider::after {
  content: "";
  position: sticky;
  top: 0;
  height: auto; width: 16px;
  pointer-events: none;
  transition: opacity .2s ease;
  flex-shrink: 0;
}

/* ============================================================
   Driver portal — Earnings & Payslips card
   ============================================================ */
.earnings-card { padding: 16px 18px 18px; }
.earnings-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.earnings-head strong { font-size: 15px; }
.earnings-head select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); font-size: 12.5px; color: var(--ink-1);
  font-weight: 600;
}

.earnings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 500px) { .earnings-grid { grid-template-columns: 1fr; } }

.es-card {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.es-card.es-earn {
  background: linear-gradient(135deg, rgba(47, 107, 255, .08), rgba(0, 212, 184, .12));
  border-color: rgba(47, 107, 255, .35);
}
.es-card.es-paid {
  background: linear-gradient(135deg, rgba(22, 163, 74, .08), rgba(22, 163, 74, .14));
  border-color: rgba(22, 163, 74, .35);
}
.es-card.es-pending {
  background: var(--surface-2);
  border-style: dashed;
}
.es-label {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 700; color: var(--ink-3);
}
.es-value {
  font-size: 22px; font-weight: 900; color: var(--ink-1);
  margin-top: 4px; letter-spacing: -0.01em;
}
.es-card.es-earn .es-value {
  background: linear-gradient(135deg, var(--brand-700), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; color: transparent;
}
.es-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.es-actions { margin-top: 10px; }

.es-section-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin: 14px 0 6px;
}

.earn-list { display: flex; flex-direction: column; gap: 6px; }
.earn-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px; align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .12s ease, background .12s ease;
}
.earn-row:hover { border-color: var(--brand-300); background: var(--hover-tint); }
.earn-row.is-void { opacity: .65; background: var(--surface-2); }
.earn-row.is-adj { border-color: rgba(217, 119, 6, .35); }

.er-date { text-align: center; }
.er-date strong { display: block; font-size: 13px; font-weight: 800; color: var(--ink-1); line-height: 1; }
.er-date small { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.er-meta { min-width: 0; }
.er-meta strong { font-size: 13px; }
.er-amt { text-align: right; }
.er-amt strong { font-size: 14px; color: #7c2d12; font-weight: 800; }

/* Leave application calendar (driver portal) */
.leave-cal {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px 18px;
}
.leave-cal-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.leave-cal-head h3 { color: var(--ink-1); }
.leave-cal-head .icon-btn:first-of-type svg { transform: rotate(180deg); }

.leave-cal-legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px; color: var(--ink-3);
}
.lc-leg {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--surface-3);
}
.lc-leg .dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: currentColor;
}
.lc-leg-free    { color: var(--green); }
.lc-leg-locked  { color: var(--ink-4); }
.lc-leg-booked  { color: var(--red); }
.lc-leg-leave   { color: var(--purple); }
.lc-leg-selected { color: var(--brand-600); }

.leave-cal-grid-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  font-size: 11px; font-weight: 700; color: var(--ink-3);
  letter-spacing: .06em; text-transform: uppercase;
  text-align: center;
}
.leave-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.lc-day {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 6px 8px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-1);
  user-select: none;
  transition: background .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.lc-day .lc-num { z-index: 1; }
.lc-day .lc-lock,
.lc-day .lc-badge {
  position: absolute;
  bottom: 6px; right: 6px;
  font-size: 11px;
  line-height: 1;
}
.lc-day .lc-badge {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 700;
}

.lc-blank { background: transparent; border-color: transparent; }

.lc-past {
  background: var(--surface-2);
  color: var(--ink-4);
  border-style: dashed;
  opacity: .55;
}

.lc-locked {
  background: repeating-linear-gradient(
    45deg,
    var(--surface-2),
    var(--surface-2) 6px,
    var(--surface-3) 6px,
    var(--surface-3) 12px
  );
  color: var(--ink-4);
  cursor: not-allowed;
}

.lc-free {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: #a7f3d0;
  color: #065f46;
  cursor: pointer;
}
.lc-free:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, .25);
  border-color: #34d399;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
}

.lc-booked {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-color: #fca5a5;
  color: #991b1b;
  cursor: not-allowed;
}

.lc-leave {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-color: #c4b5fd;
  color: #5b21b6;
  cursor: not-allowed;
}

.lc-selected {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600)) !important;
  color: #ffffff !important;
  border-color: var(--brand-600) !important;
  box-shadow: 0 6px 14px rgba(47, 107, 255, .35);
}
.lc-selected .lc-num { color: #fff; }
.lc-range-start { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.lc-range-end   { border-top-left-radius: 0;  border-bottom-left-radius: 0; }

[data-theme="dark"] .lc-free {
  background: linear-gradient(135deg, rgba(22, 163, 74, .15), rgba(22, 163, 74, .25));
  border-color: rgba(22, 163, 74, .4);
  color: #6ee7b7;
}
[data-theme="dark"] .lc-booked {
  background: linear-gradient(135deg, rgba(220, 38, 38, .2), rgba(220, 38, 38, .3));
  border-color: rgba(220, 38, 38, .5);
  color: #fca5a5;
}
[data-theme="dark"] .lc-leave {
  background: linear-gradient(135deg, rgba(124, 58, 237, .2), rgba(124, 58, 237, .3));
  border-color: rgba(124, 58, 237, .5);
  color: #c4b5fd;
}

.leave-cal-info {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 13px;
}

.visually-hidden {
  position: absolute !important; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

@media (max-width: 600px) {
  .lc-day { font-size: 11.5px; padding: 4px 6px; border-radius: 8px; }
  .lc-day .lc-badge { font-size: 9.5px; padding: 1px 4px; }
}

/* Driver portal */
.driver-body {
  min-height: 100vh;
  background:
    radial-gradient(800px 400px at 90% -10%, rgba(0,212,184,.18), transparent 70%),
    radial-gradient(700px 350px at -10% 110%, rgba(47,107,255,.12), transparent 70%),
    linear-gradient(180deg, #f6fbff 0%, #eef1fb 100%);
  padding: 24px 16px;
}
.driver-shell {
  width: min(560px, 100%);
  margin: 0 auto;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(15, 25, 60, .18);
  overflow: hidden;
}
.cam-wrap {
  position: relative; width: 100%; aspect-ratio: 4/3;
  background: #0b1228; border-radius: 14px; overflow:hidden;
}
.cam-wrap video, .cam-wrap canvas { width:100%; height:100%; object-fit: cover; }
.cam-overlay {
  position:absolute; inset: 0;
  background: radial-gradient(closest-side, transparent 58%, rgba(0,0,0,.55) 60%);
}
.cam-ring {
  position:absolute; inset: 14%;
  border: 2px dashed rgba(255,255,255,.6); border-radius: 50%;
}

/* Status colors for boards */
.status-board {
  display:grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.driver-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; display:flex; gap:12px; align-items:center;
  transition: .15s;
}
.driver-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.driver-tile .avatar {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink:0;
  display:grid; place-items:center; color:#fff; font-weight:700;
  background: linear-gradient(135deg, #6366f1, #2563eb);
}
.driver-tile.busy .avatar    { background: linear-gradient(135deg, #f59e0b, #d97706); }
.driver-tile.off .avatar     { background: linear-gradient(135deg, #94a3b8, #64748b); }
.driver-tile.leave .avatar   { background: linear-gradient(135deg, #ec4899, #db2777); }
.driver-tile.suspended .avatar { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.driver-tile h4 { margin:0; font-size: 14px; }
.driver-tile small { color: var(--ink-3); }

/* Booking board cards */
.booking-card {
  background: var(--surface); border:1px solid var(--border); border-radius: 14px;
  padding: 14px; transition: .15s;
}
.booking-card:hover { box-shadow: var(--shadow-md); }

/* ==============================================================
   Blast Messaging Center (Driver Broadcast + Customer Promotions)
   ============================================================== */
.blast-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.4fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 1200px) { .blast-grid { grid-template-columns: 1fr; } }

.blast-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 6px;
}
.blast-row {
  display: flex; align-items: center;
  padding: 6px 8px;
  background: var(--surface);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease;
}
.blast-row:hover { background: var(--hover-tint); border-color: var(--border-2); }
.blast-row input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--brand-500);
  flex-shrink: 0;
}

/* WhatsApp-style preview bubble */
.wa-preview {
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,.02) 0 10px, transparent 10px 20px),
    linear-gradient(180deg, #e5ddd5 0%, #d9d2cb 100%);
  border-radius: 14px;
  padding: 18px;
  min-height: 120px;
}
[data-theme="dark"] .wa-preview {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 10px, transparent 10px 20px),
    linear-gradient(180deg, #1f2937 0%, #111827 100%);
}
.wa-bubble {
  background: #dcf8c6;
  border-radius: 12px;
  padding: 10px 12px;
  max-width: 90%;
  margin-left: auto;
  font-size: 13px;
  line-height: 1.55;
  color: #1a3919;
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
  position: relative;
}
.wa-bubble::after {
  content: "";
  position: absolute;
  right: -8px; bottom: 0;
  border: 8px solid transparent;
  border-top-color: #dcf8c6;
  border-right: 0;
  border-bottom: 0;
}
[data-theme="dark"] .wa-bubble { background: #056162; color: #e7f3ec; }
[data-theme="dark"] .wa-bubble::after { border-top-color: #056162; }
.wa-meta {
  font-size: 11px;
  color: rgba(0,0,0,.55);
  margin-bottom: 6px;
  font-weight: 600;
}
[data-theme="dark"] .wa-meta { color: rgba(255,255,255,.7); }
.wa-body { white-space: pre-wrap; word-break: break-word; }

/* Send queue rows */
.blast-queue {
  max-height: 60vh; overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 8px;
}
.queue-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.queue-row.no-wa { opacity: .6; background: var(--surface-2); }

/* Customer vehicle requirement banner — shines to draw attention. */
.req-banner {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7ed 0%, #fde68a 100%);
  border: 1.5px solid #f59e0b;
  color: #92400e;
  overflow: hidden;
  animation: req-pulse 2.4s ease-in-out infinite;
}
.req-banner .req-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(217, 119, 6, .35);
}
.req-banner .req-body { z-index: 1; }
.req-banner .req-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  opacity: .8;
}
.req-banner .req-value {
  font-size: 20px; font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 2px;
}
.req-banner .req-shine {
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: req-shine 3s linear infinite;
  mix-blend-mode: overlay;
  pointer-events: none;
}
@keyframes req-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .35); }
  50%      { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}
@keyframes req-shine {
  from { background-position: 220% 0; }
  to   { background-position: -50% 0; }
}
[data-theme="dark"] .req-banner {
  background: linear-gradient(135deg, rgba(217, 119, 6, .2), rgba(245, 158, 11, .35));
  color: #fcd34d;
  border-color: rgba(245, 158, 11, .5);
}

/* Driver tile: vehicle match (green glow) + mismatch (amber tint) */
.driver-tile.vehicle-match {
  background: linear-gradient(135deg, rgba(22, 163, 74, .08), rgba(34, 197, 94, .12));
  border-color: rgba(22, 163, 74, .35);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, .25) inset, 0 6px 18px rgba(22, 163, 74, .15);
  position: relative;
}
.driver-tile.vehicle-match::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.5) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: req-shine 3s linear infinite;
  mix-blend-mode: overlay;
  opacity: .6;
}
.driver-tile.vehicle-match .match-flag {
  position: absolute; top: -10px; left: 14px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  box-shadow: 0 4px 10px rgba(22, 163, 74, .4);
  z-index: 2;
}

.driver-tile.vehicle-mismatch {
  border-color: rgba(217, 119, 6, .35);
}
[data-theme="dark"] .driver-tile.vehicle-match {
  background: linear-gradient(135deg, rgba(22, 163, 74, .15), rgba(34, 197, 94, .2));
}

/* Mismatch confirmation modal */
.mismatch-box {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: stretch;
  margin-top: 4px;
}
.mismatch-side {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.mismatch-side.mismatch-actual {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #f59e0b;
  color: #92400e;
}
.mismatch-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.mismatch-side.mismatch-actual .mismatch-label { color: #92400e; opacity: .85; }
.mismatch-value {
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink-1);
}
.mismatch-side.mismatch-actual .mismatch-value { color: #7c2d12; }
.mismatch-arrow {
  display: grid; place-items: center;
  font-size: 24px; color: var(--ink-3); font-weight: 300;
}
@media (max-width: 600px) {
  .mismatch-box { grid-template-columns: 1fr; }
  .mismatch-arrow { transform: rotate(90deg); }
}

/* Booking-detail change history timeline */
.bd-tab { background: var(--surface-3); }
.bd-tab.on {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  border-color: transparent;
}
.hist-row {
  display: flex; gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}
.hist-row:last-child { border-bottom: none; }
.hist-dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent));
  margin-top: 6px;
  box-shadow: 0 0 0 4px rgba(47,107,255,.15);
  flex-shrink: 0;
}
.hist-body { flex: 1; min-width: 0; }
.hist-change {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12.5px;
}
.hist-from {
  text-decoration: line-through;
  color: var(--red);
  font-weight: 600;
}
.hist-arrow { color: var(--ink-3); font-weight: 700; }
.hist-to {
  color: var(--green);
  font-weight: 700;
}

/* ==============================================================
   Pending-booking states in the Assignment Engine
   ============================================================== */

/* PERSISTENT SELECTED state — the booking currently loaded in the
   right-hand Assign Driver panel always carries this. */
.booking-card.bk-selected {
  position: relative;
  border: 1.5px solid var(--brand-500);
  background: linear-gradient(135deg, rgba(47,107,255,.06), rgba(0,212,184,.06));
  box-shadow: 0 6px 18px rgba(47,107,255,.18);
}
.booking-card.bk-selected::before {
  content: "";
  position: absolute; left: -1px; top: 8px; bottom: 8px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--brand-500), var(--accent));
  box-shadow: 0 0 12px rgba(47,107,255,.6);
}
.selected-flag {
  display: inline-flex; align-items: center; gap: 6px;
  margin: -2px 0 10px;
  padding: 4px 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(47,107,255,.4);
}

/* ARRIVAL HIGHLIGHT — when the user navigates to the Assignment Engine
   from a specific booking, the matching card DANCES so the dispatcher
   can never mistake which booking they came from. 9 seconds of
   pulse + shine + lift + tilt, then settles into the steady selected
   state above. */
.booking-card.arrival-pulse {
  position: relative;
  border: 2px solid transparent;
  background: linear-gradient(135deg, rgba(47,107,255,.06), rgba(0,212,184,.08));
  /* Three coordinated animations, each looping ~6 times over 9s */
  animation:
    arrival-glow  1.5s ease-in-out 6,
    arrival-dance 1.5s ease-in-out 6;
  overflow: hidden;
  z-index: 1;
}
.booking-card.arrival-pulse::after {
  content: "";
  position: absolute; inset: -2px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg,
    transparent 30%,
    rgba(255, 255, 255, .65) 50%,
    transparent 70%);
  background-size: 200% 100%;
  animation: arrival-sweep 1.5s ease-in-out 6;
  mix-blend-mode: overlay;
}
@keyframes arrival-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(47, 107, 255, .55), 0 0 0 0 rgba(0, 212, 184, .45);
    border-color: var(--brand-500);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(47, 107, 255, 0), 0 0 36px 4px rgba(0, 212, 184, .55);
    border-color: var(--accent);
  }
}
/* "Dance" — subtle up/tilt motion that grabs the eye */
@keyframes arrival-dance {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  20%      { transform: translateY(-3px) rotate(-0.4deg); }
  40%      { transform: translateY(0)    rotate(0.4deg); }
  60%      { transform: translateY(-2px) rotate(-0.2deg); }
  80%      { transform: translateY(0)    rotate(0deg); }
}
@keyframes arrival-sweep {
  from { background-position: 200% 0; }
  to   { background-position: -50% 0; }
}
.arrival-flag {
  display: inline-flex; align-items: center; gap: 6px;
  margin: -2px 0 10px;
  padding: 5px 12px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .04em;
  background: linear-gradient(135deg, var(--brand-500), var(--accent));
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(47, 107, 255, .45);
  animation: flag-bounce .6s ease-out, flag-pulse 1.5s ease-in-out infinite;
  position: relative;
  z-index: 2;
}
@keyframes flag-bounce {
  0%   { opacity: 0; transform: translateY(-8px) scale(.9); }
  60%  { opacity: 1; transform: translateY(3px) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes flag-pulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(47,107,255,.45), 0 0 0 0 rgba(47,107,255,.5); }
  50%      { box-shadow: 0 6px 18px rgba(47,107,255,.45), 0 0 0 8px rgba(47,107,255,0); }
}

/* When a card is BOTH arriving AND selected, the glow takes precedence
   visually and the steady left stripe stays underneath. */
.booking-card.arrival-pulse.bk-selected::before { z-index: 3; }
.booking-card .meta { display:flex; gap:14px; flex-wrap:wrap; font-size: 12px; color: var(--ink-3); }
.booking-card .meta b { color: var(--ink-1); font-weight: 600; }
.booking-card .actions { margin-top:12px; display:flex; gap:6px; flex-wrap:wrap; }

/* Voucher card */
.voucher {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fcd34d;
  border-radius: 16px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}
.voucher .vc-no { font-family: monospace; font-weight: 700; color: #92400e; }
.voucher .stamp {
  position:absolute; top: 8px; right: 8px;
  font-size: 9.5px; font-weight: 700; padding: 3px 7px; border-radius: 6px;
  background: rgba(146, 64, 14, .12); color: #92400e; letter-spacing: .1em;
}

/* Loading */
.spinner {
  width: 18px; height: 18px; border-radius:50%;
  border: 2px solid var(--surface-3);
  border-top-color: var(--brand-500);
  animation: spin .8s linear infinite;
  display:inline-block;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* Responsive */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: var(--side-w-collapsed) 1fr; }
  .app-shell .nav-label, .app-shell .brand-name, .app-shell .nav-section-label, .app-shell .side-user-meta { display:none; }
  .main { padding: 16px; }
  .search-box { display:none; }
}

/* ============================================================
   RESPONSIVE-SWEEP-2026 — global overflow / overlap fixes across
   every page (driver portal, admin shell, portals, payslip, invoice)
   ============================================================ */

/* Global safety — never let any element push the page wider than the viewport */
html, body { overflow-x: hidden; }
.main, .driver-shell, .portal-shell { max-width: 100vw; }

/* Cards: always allow inner content to wrap */
.card, .card-pad, .card-pad-lg { min-width: 0; }
.card-header { flex-wrap: wrap; gap: 8px; }

/* Page header — let the action row wrap below the title on narrow screens
   instead of clipping or overflowing the right edge */
.page-header {
  flex-wrap: wrap;
  align-items: flex-start;
}
.page-header > div:first-child { min-width: 0; flex: 1 1 280px; }
.page-header .row { flex-wrap: wrap; }

/* All `.row` flex containers should wrap rather than push siblings off-screen,
   EXCEPT inside data-table cells — action icons stay on a single line there
   (the .table-wrap parent already provides horizontal scroll).               */
.row { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.no-wrap { flex-wrap: nowrap; }
table.t td .row,
table.t th .row { flex-wrap: nowrap; }

/* All `.t` (data) tables already live inside `.table-wrap`; make sure that
   wrapper actually scrolls and the table doesn't break the page layout */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table.t { min-width: 720px; }

/* KPI tile grid — graceful collapse on tablet and phone */
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* Pills never overflow their cell — they wrap as a unit */
.pill { white-space: nowrap; max-width: 100%; }

/* Booking cards on every page — meta line and trip text wrap cleanly */
.booking-card .meta { flex-wrap: wrap; row-gap: 4px; }
.booking-card .actions { flex-wrap: wrap; gap: 6px; }

/* Driver portal — combo carousel & roster cards stay inside the viewport */
.combo-card { max-width: 100%; overflow: hidden; }
.r-day-header { flex-wrap: wrap; gap: 4px 10px; }
.r-day-header .muted { white-space: nowrap; }
.r-job-actions .btn { flex: 1 1 130px; min-width: 0; }
.r-next-card .row { flex-wrap: wrap; }
.r-next-card .r-next-right { text-align: left; }

/* Portal forms (hotel + driver portals) — single column on phone */
.portal-body-inner .form-grid { grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .portal-body-inner .form-grid { grid-template-columns: 1fr 1fr; }
}

/* Modals — keep usable on phone (was too narrow when viewport is small) */
.modal { width: 95vw; max-width: 720px; }
.modal-lg { width: 95vw; max-width: 960px; }
.modal-body { max-height: 70vh; overflow-y: auto; }
@media (max-width: 480px) {
  .modal, .modal-lg { width: 100vw; max-width: 100vw; border-radius: 0; height: 100vh; max-height: 100vh; }
  .modal-body { max-height: calc(100vh - 130px); }
}

/* Inputs and selects never overflow their parent */
input, select, textarea {
  max-width: 100%;
  box-sizing: border-box;
}

/* Buttons — never wider than their container; long labels truncate */
.btn { max-width: 100%; }
.btn-lg { font-size: 14px; }

/* Tab bar inside payroll / blast / insights pages — wrap on narrow */
.segmented { flex-wrap: wrap; }
.segmented button { min-width: 0; }

/* Topbar search — keep responsive */
.topbar { gap: 8px; }

/* ============ Tablet (≤ 980px) — tighten admin shell ============ */
@media (max-width: 980px) {
  .page-header { gap: 10px; margin-bottom: 14px; }
  .page-title { font-size: 20px; }
  .main { padding: 14px; }
  /* Action button row stretches full width below title on tablet */
  .page-header .row { width: 100%; }
}

/* ============ Phone (≤ 640px) — compact admin shell ============ */
@media (max-width: 640px) {
  :root { --side-w: 64px; --side-w-collapsed: 0px; }
  .app-shell { grid-template-columns: 0 1fr; }
  .app-shell .sidebar { position: fixed; left: -100%; transition: left .25s ease; z-index: 200; width: 240px; box-shadow: 12px 0 40px rgba(0,0,0,.25); }
  .app-shell.side-open .sidebar { left: 0; }
  .app-shell.side-open .nav-label,
  .app-shell.side-open .brand-name,
  .app-shell.side-open .nav-section-label,
  .app-shell.side-open .side-user-meta { display:block; }
  .topbar { padding: 0 12px; }
  .main { padding: 12px; }
  .page-title { font-size: 18px; }
  .page-subtitle { font-size: 12px; }
  .card { border-radius: 12px; }
  .card-pad { padding: 14px; }
  .card-pad-lg { padding: 16px; }
  .btn { padding: 8px 12px; font-size: 12.5px; }
  .btn-sm { padding: 6px 9px; font-size: 11.5px; }
  /* On very narrow screens, the action row goes full width */
  .page-header .row > * { flex: 0 1 auto; }
}

/* ============ Very narrow phones (≤ 380px) ============ */
@media (max-width: 380px) {
  .main, .driver-shell, .portal-shell { padding: 10px; }
  .booking-card { padding: 12px; }
  .kpi { padding: 12px; }
  .kpi .value { font-size: 22px; }
  .modal { padding: 0; }
}

/* ============ Print layout (used by payslip + invoice viewers) ============ */
@media print {
  .topbar, .sidebar, .ps-actions, .inv-actions, .driver-shell .portal-hero,
  #pla-install-banner, #pla-ios-hint, #pla-job-overlay { display: none !important; }
  body { background: #fff !important; padding: 0; }
  .card, .booking-card { box-shadow: none !important; border-color: #ddd !important; }
}

/* ============================================================
   PREMIUM-POLISH-2026 — tighter row density, sleek action clusters,
   refined table typography. Inspired by Linear / Stripe / Notion.
   ============================================================ */

/* Tighter, more readable table row density */
table.t thead th {
  padding: 11px 14px;
  font-size: 10.5px;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--surface-2);
}
table.t tbody td {
  padding: 11px 14px;       /* was 14 — tighter, more rows per screen */
  font-size: 13px;
  line-height: 1.45;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
table.t tbody tr { transition: background .12s ease; }
table.t tbody tr:hover { background: var(--hover-tint); }

/* First & last cells breathe slightly more so content doesn't kiss the edge */
table.t tbody td:first-child,
table.t thead  th:first-child { padding-left: 18px; }
table.t tbody td:last-child,
table.t thead  th:last-child  { padding-right: 18px; }

/* Action icon clusters in data tables — compact, refined */
table.t td .row,
.actions-cluster {
  display: inline-flex;
  align-items: center;
  gap: 2px;                  /* tight — clusters read as one control */
  padding: 2px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  transition: background .15s ease, border-color .15s ease;
}
table.t tr:hover td .row { background: rgba(15,25,60,.03); }  /* faint container outline appears on row hover */

/* In-table icon buttons: compact, premium */
table.t .icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: var(--ink-3);
}
table.t .icon-btn:hover {
  background: var(--surface);
  color: var(--brand-700, #1d4ed8);
  border-color: var(--border-2);
}

/* In-table small buttons: slimmer */
table.t .btn-sm {
  padding: 5px 9px;
  font-size: 11.5px;
  border-radius: 7px;
}

/* Avatar in a table row — slightly smaller for density */
table.t tbody td .avatar { width: 30px; height: 30px; font-size: 11px; }

/* Monetary cells right-aligned, tabular numerals */
table.t .mono,
table.t td:has(strong:only-child) strong {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Subtle zebra is now opt-in via .t-striped for super-dense lists */
table.t.t-striped tbody tr:nth-child(2n) td { background: rgba(15,25,60,.018); }

/* Card header label sizing — slight refinement */
.card-header { padding: 12px 16px; }
.card-title { font-size: 14px; letter-spacing: -.005em; }

/* Page-header action group — visually grouped, not floating */
.page-header > .row { gap: 8px; }

/* Pills inside table cells render at fixed micro-height so rows stay aligned */
table.t .pill {
  padding: 2px 9px;
  font-size: 11px;
  height: 22px;
  line-height: 1;
}

/* ============================================================
   APPROVAL-INDICATOR-2026 — blinking badge + nav-item pulse for
   items needing admin attention (voucher amount change requests,
   etc.). High-contrast amber so they stand out but don't scream.
   ============================================================ */
@keyframes plaBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .45; }
}
@keyframes plaBadgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, .55); }
  50%      { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
}
@keyframes plaNavGlow {
  0%, 100% { background: transparent; }
  50%      { background: rgba(217, 119, 6, .07); }
}

.badge-ct.badge-blink {
  background: #d97706 !important;
  color: #fff !important;
  animation: plaBlink 1.2s ease-in-out infinite, plaBadgePulse 1.6s ease-out infinite;
}
.nav-item-pulse {
  position: relative;
  animation: plaNavGlow 1.8s ease-in-out infinite;
}
.nav-item-pulse::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #d97706;
  animation: plaBlink 1.2s ease-in-out infinite;
}

/* Hover tint variable fallback if theme didn't define it */
:root {
  --hover-tint: rgba(15, 25, 60, .035);
  --active-tint: rgba(15, 25, 60, .055);
  --border-2: var(--border);
  --hover-ink: var(--ink-1);
}
[data-theme="dark"] {
  --hover-tint: rgba(255, 255, 255, .04);
  --active-tint: rgba(255, 255, 255, .07);
}

/* ============================================================
   TEXT-OVERLAP SAFETY — never let any absolutely-positioned
   element clip its sibling content. Common pattern: a small badge
   pinned top-right of a card. This block guarantees the visible
   text has a reserved gutter so the badge floats above empty space.
   ============================================================ */

/* Booking cards have a status pill in the top-right slot —
   the header row uses flex-between so it's natively safe. But
   the customer name/route inside should never run under the pill */
.booking-card .row.between > div { min-width: 0; }
.booking-card .row.between > div > strong { display: block; line-height: 1.3; word-break: break-word; }
.booking-card .row.between > .pill { flex-shrink: 0; align-self: flex-start; }

/* Voucher stamp pinned top-right — reserve right padding on the
   content so VCH code never disappears under the stamp */
.voucher .vc-no { padding-right: 60px; word-break: break-all; }
.voucher > div:first-child { padding-right: 60px; }

/* Cards: title and any right-side action should be on a flex row
   that wraps if title is long, not clip */
.card-header { align-items: flex-start; }
.card-header > div:first-child { flex: 1 1 auto; min-width: 0; }
.card-header .card-title { word-break: break-word; line-height: 1.3; }
.card-header .card-sub   { word-break: break-word; line-height: 1.4; }

/* Tag (pill-like label) — never wider than parent */
.tag { max-width: 100%; white-space: normal; overflow: hidden; text-overflow: ellipsis; }

/* Cell-level text safety inside data tables — long names truncate
   with ellipsis instead of expanding the row to multi-line height.
   First column (driver/hotel name) keeps multi-line if absolutely
   needed via word-break, but cells with mono codes ellipsis cleanly. */
table.t tbody td { word-break: break-word; overflow-wrap: anywhere; }
table.t tbody td.mono { word-break: break-all; }

/* Avatar inside a name cell never shrinks */
.row .avatar, table.t tbody td .avatar { flex-shrink: 0; }

/* Driver portal "JOBS BY DAY" cards — reserve space between time +
   pill column and the meta column so the pill never crosses */
.r-job { column-gap: 14px; }

/* Page title block — long titles get ellipsis instead of bleeding */
.page-header > div:first-child .page-title { word-break: break-word; line-height: 1.25; }
.page-header > div:first-child .crumbs { word-break: break-all; }

/* Universal safety: any element with class .truncate gets single-line
   ellipsis — use as a quick fix in inline styles when needed */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}


