/* Fonts are loaded via <link> tags in base.html's <head> — faster and
   non-render-blocking compared to an @import here, which the browser can't
   discover until this stylesheet itself has already been fetched. */

/* ── Design tokens — shared with MarketFlow Pro ──
   Redesign note: token NAMES are preserved (every page/JS consumer keeps
   working); only values are warmed up and a few new tokens are ADDED. */
:root {
  --bg:          #0A0E17;
  --bg-panel:    #0E131F;
  --bg-raise:    #161D2C;
  --line:        #212B3D;
  --line-soft:   #1A2231;
  --text:        #EEF2F9;
  --text-dim:    #9AA7C2;
  --text-faint:  #61708F;
  --accent:      #3B82F6;
  --accent-dark: #1D4ED8;
  --accent-soft: rgba(59,130,246,.14);
  --accent-glow: rgba(59,130,246,.50);
  --glass:       rgba(24,32,50,.72);
  --glass-strong:rgba(20,27,42,.86);
  --glass-border: rgba(122,168,238,.20);
  --green:       #34D399;
  --green-soft:  rgba(52,211,153,.13);
  --red:         #F87171;
  --red-soft:    rgba(248,113,113,.13);
  --gold:        #FBBF24;
  --gold-soft:   rgba(251,191,36,.13);
  --teal:        #2DD4BF;
  --teal-soft:   rgba(45,212,191,.13);
  /* new secondary accent + extra hues (additive, nothing removed) */
  --amber:       #F5A524;
  --amber-soft:  rgba(245,165,36,.13);
  --amber-glow:  rgba(245,165,36,.45);
  --violet:      #A78BFA;
  --violet-soft: rgba(167,139,250,.13);
  --sidebar-w:   270px;
  --header-h:    68px;
}

html { zoom: 85%; }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Geist', 'Segoe UI', system-ui, sans-serif;
  background:
    radial-gradient(1200px 620px at 80% -12%, rgba(59,130,246,.13), transparent 55%),
    radial-gradient(900px 520px at 6% 110%, rgba(245,165,36,.06), transparent 55%),
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  min-height: 100vh;
}

/* ── Electric ambient layers (CSS only, no DOM, behind content) ──
   Drifting energy orbs + a slow diagonal light sweep. The animated circuit
   traces are injected as an in-DOM SVG by static/shared/anim.js (so their
   "current" pulses can actually animate, which a CSS background SVG can't). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(560px 560px at 84% 2%,  rgba(59,130,246,.24), transparent 66%),
    radial-gradient(460px 460px at 10% 98%, rgba(45,212,191,.15), transparent 66%),
    radial-gradient(380px 380px at 55% 48%, rgba(245,165,36,.09), transparent 70%);
}
@media (prefers-reduced-motion: no-preference) {
  body::before { animation: ambient-drift 26s ease-in-out infinite; }
}
@keyframes ambient-drift {
  0%, 100% { transform: translate3d(0,0,0); }
  50%      { transform: translate3d(-30px, 22px, 0); }
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .6;
  background: linear-gradient(115deg, transparent 42%, rgba(96,165,250,.07) 50%, transparent 58%);
  background-size: 220% 100%;
}
@media (prefers-reduced-motion: no-preference) {
  body::after { animation: sheen-sweep 11s linear infinite; }
}
@keyframes sheen-sweep { to { background-position: -220% 0; } }

/* Circuit layer injected by anim.js (decorative, behind content) */
.fx-layer { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.fx-svg   { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-trace { fill: none; stroke: rgba(96,140,220,.10); stroke-width: 1.4; }
.fx-node  { fill: rgba(96,140,220,.22); }
.fx-current { fill: none; stroke-width: 2.2; stroke-linecap: round; filter: drop-shadow(0 0 5px var(--accent-glow)); }

/* ═══════════════ SIDEBAR — full-height left rail ═══════════════ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(14,19,31,.9) 0%, rgba(10,14,23,.88) 100%);
  backdrop-filter: blur(13px) saturate(1.15);
  -webkit-backdrop-filter: blur(13px) saturate(1.15);
  border-right: 1px solid var(--line-soft);
  box-shadow: 0 0 48px rgba(59,130,246,.06);
  z-index: 40;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 20px 22px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
/* Solo wordmark: match the logo's real (wide) aspect ratio instead of forcing
   it into a square box, which left big empty gaps above/below and made it look
   spaced-out and tiny. */
.brand-mark--solo {
  width: auto; height: auto;
  max-width: 184px;
  border-radius: 0;
  overflow: visible;
}
.brand-mark-img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.brand-mark--solo .brand-mark-img {
  width: 184px; height: auto;
  display: block;
}
@media (prefers-reduced-motion: no-preference) {
  .brand-mark--solo { animation: brand-glow 3.6s ease-in-out infinite; }
}
@keyframes brand-glow {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(59,130,246,.25)); }
  50%      { filter: drop-shadow(0 0 16px rgba(59,130,246,.55)); }
}

.sidebar-section-label {
  padding: 6px 24px 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-faint);
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.sidebar nav.secondary { padding-bottom: 8px; }
.sidebar .divider { height: 1px; background: var(--line-soft); margin: 12px 20px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: color .16s, background .16s, border-color .16s;
  color: var(--text-dim);
  position: relative;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.035); border-color: transparent; outline: none; }
.nav-item:focus, .nav-item:focus-visible, .nav-item:active { outline: none; border-color: transparent; box-shadow: none; }
.nav-item svg { width: 17px; height: 17px; }
.nav-item svg path, .nav-item svg g path { stroke: currentColor !important; transition: stroke .15s, fill .15s; }
.nav-item svg path[fill="white"], .nav-item svg g path[fill="white"] { fill: currentColor !important; stroke: none !important; }

.nav-item.active {
  color: var(--text);
  background:
    radial-gradient(120px 40px at 18% 110%, var(--accent-soft), transparent 70%),
    linear-gradient(90deg, rgba(59,130,246,.12), rgba(59,130,246,.02));
  border-color: rgba(59,130,246,.35);
  box-shadow:
    0 0 18px -6px var(--accent-glow),
    inset 0 0 22px -14px var(--accent-glow);
}
/* electric edge marker on the active item */
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.nav-item.active svg path, .nav-item.active svg g path { stroke: var(--accent) !important; }
.nav-item.active svg path[fill="white"], .nav-item.active svg g path[fill="white"] { fill: var(--accent) !important; stroke: none !important; }

.nav-icon { flex-shrink: 0; display: flex; }
.nav-label {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  flex: 1;
  line-height: 1.25;
}

/* Numeric count pill — hidden when empty, filled by JS */
.nav-count {
  min-width: 20px; height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: #7EA5FF;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-count:empty { display: none; }
.nav-count.urgent { background: var(--gold-soft); color: var(--gold); }

/* System-status footer */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: rgba(255,255,255,0.015);
}
@keyframes sys-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,.45); }
  50%      { box-shadow: 0 0 0 5px rgba(52,211,153,0); }
}
.sys-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: sys-pulse 2.4s ease-in-out infinite;
}
.sidebar-footer-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sys-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 12px; color: var(--text);
}
.sys-sub { font-size: 10px; color: var(--text-faint); letter-spacing: 0.04em; }

/* ═══════════════ TOPBAR ═══════════════ */
.site-header {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(8,12,22,0.74);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: 0 8px 32px rgba(0,0,0,.25), 0 1px 0 rgba(59,130,246,.06);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
}
/* electric underline that gently flows */
.site-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 22%, #8fb6ff 50%, var(--accent) 78%, transparent);
  background-size: 300px 100%;
  opacity: .5;
}
@media (prefers-reduced-motion: no-preference) {
  .site-header::after { animation: rail-flow 3.8s linear infinite; }
}
@keyframes rail-flow { to { background-position: 300px 0; } }

.header-title { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; min-width: 150px; }
.header-title h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px; font-weight: 700; color: var(--text);
  letter-spacing: 0.01em;
}
.header-date { font-size: 11px; color: var(--text-faint); }

.header-search { flex: 1; display: flex; justify-content: center; }
.header-search-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.035);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 14px;
  width: 100%;
  max-width: 440px;
  color: var(--text-faint);
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.header-search-inner:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.header-search-inner span { font-size: 13px; font-weight: 500; flex: 1; white-space: nowrap; overflow: hidden; }
.search-kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 600;
  color: var(--text-faint);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.header-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.status-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 13px;
  border-radius: 99px;
  background: var(--green-soft);
  border: 1px solid rgba(52,197,120,.28);
  color: var(--green);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11.5px; font-weight: 600;
}
.status-pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: sys-pulse 2.4s ease-in-out infinite;
}

.btn-new-booking {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 11px;
  background: linear-gradient(180deg, #5AA0FF, var(--accent));
  color: #fff;
  text-decoration: none;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12.5px; font-weight: 600;
  box-shadow: 0 6px 18px -6px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.btn-new-booking:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -6px var(--accent-glow); }
/* subtle sheen sweep on hover */
.btn-new-booking::after {
  content: "";
  position: absolute; top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-18deg);
}
@media (prefers-reduced-motion: no-preference) {
  .btn-new-booking:hover::after { animation: btn-sheen .8s ease; }
}
@keyframes btn-sheen { to { left: 130%; } }

.notif-wrap { position: relative; width: 22px; height: 22px; flex-shrink: 0; cursor: pointer; color: var(--text-dim); }
.notif-wrap:hover { color: var(--text); }
.notif-dot {
  position: absolute;
  top: -1px; right: -1px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px -1px var(--accent-glow);
  z-index: 1;
}

.user-wrap { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #60A5FA, #7C4DDB);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--line), 0 4px 12px -2px rgba(0,0,0,.5), 0 0 16px rgba(59,130,246,.2);
}
.user-avatar span { color: #fff; font-weight: 800; font-size: 13px; }
.user-meta { display: flex; flex-direction: column; gap: 1px; }
.user-name {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text); font-weight: 600; font-size: 13px; line-height: 1.2;
}
.user-role { font-size: 10.5px; color: var(--text-faint); }
.user-chevron { color: var(--text-faint); flex-shrink: 0; margin-left: 2px; }
.user-wrap:hover .user-chevron { color: var(--text-dim); }

/* ═══════════════ MAIN CONTENT ═══════════════ */
.main-content {
  padding-top: var(--header-h);
  padding-left: calc(var(--sidebar-w) + 20px);
  padding-right: 20px;
  padding-bottom: 28px;
  min-width: 0;
  overflow-x: hidden;
}
.page-body { padding: 20px 0; display: flex; flex-direction: column; gap: 16px; }

/* ── Stub / placeholder pages ── */
.placeholder-content { padding: 40px; text-align: center; }
.placeholder-content h1 { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.placeholder-content p  { color: var(--text-dim); font-size: 16px; }

/* ═══════════════ PAGE TRANSITIONS ═══════════════
   Navigation between pages is a real browser navigation (this is a
   multi-page app, not an SPA), so the only way to avoid a flash between
   pages is the browser's native View Transitions API — no JS delay, no
   body-level opacity fade (that was the actual source of the black
   flash: fading the whole page from opacity:0 on a dark background
   IS a flash). Where the engine supports it, this crossfades old→new
   content natively; where it doesn't, navigation is just instant with
   no animation — never worse than a flash. */
/* Smooth cross-page crossfade on navigation. The heavy per-page cost that used
   to make this feel like a "hang" (motion.js, the animated SVG background,
   render-blocking fonts) has been removed, so pages now render fast and this
   reads as a quick, smooth transition the moment you click. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vt-fade-out 180ms cubic-bezier(0.16, 1, 0.3, 1) both; }
  ::view-transition-new(root) { animation: vt-fade-in 220ms cubic-bezier(0.16, 1, 0.3, 1) both; }
}
@keyframes vt-fade-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-fade-in  { from { opacity: 0; transform: translateY(8px); } }
/* Keep the sidebar visually anchored across the transition (it doesn't fade). */
.sidebar { view-transition-name: app-sidebar; }

@keyframes widget-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Any top-level widget fades/slides in on load, staggered by position.
   Gated to `html:not(.js-anim)` — when static/shared/anim.js (Motion) loads it
   sets `.js-anim` on <html> and drives a richer entrance itself; if JS fails to
   load, this CSS fallback still animates. */
html:not(.js-anim) .panel,
html:not(.js-anim) .stat-card,
html:not(.js-anim) .eng-card,
html:not(.js-anim) .map-card,
html:not(.js-anim) .activity-card,
html:not(.js-anim) .ba-stat-card,
html:not(.js-anim) .ba-wrap {
  animation: widget-fade-in 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.stat-grid > *:nth-child(1) { animation-delay: 0.02s; }
.stat-grid > *:nth-child(2) { animation-delay: 0.06s; }
.stat-grid > *:nth-child(3) { animation-delay: 0.10s; }
.stat-grid > *:nth-child(4) { animation-delay: 0.14s; }
.charts-grid > *:nth-child(1) { animation-delay: 0.10s; }
.charts-grid > *:nth-child(2) { animation-delay: 0.16s; }
.bottom-grid > *:nth-child(1),
.eng-card                     { animation-delay: 0.18s; }
.bottom-grid > *:nth-child(2) { animation-delay: 0.24s; }
.ba-stat-strip > *:nth-child(1) { animation-delay: 0.02s; }
.ba-stat-strip > *:nth-child(2) { animation-delay: 0.05s; }
.ba-stat-strip > *:nth-child(3) { animation-delay: 0.08s; }
.ba-stat-strip > *:nth-child(4) { animation-delay: 0.11s; }
.ba-stat-strip > *:nth-child(5) { animation-delay: 0.14s; }
.ba-wrap { animation-delay: 0.16s; }

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .panel, .stat-card, .eng-card, .map-card, .activity-card,
  .ba-stat-card, .ba-wrap {
    animation: none !important;
  }
}

/* ═══════════════ GLOBAL TOAST NOTIFICATION ═══════════════ */
.global-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--glass-strong);
  border: 1px solid rgba(59,130,246,0.32);
  border-radius: 14px;
  padding: 16px 20px;
  min-width: 300px;
  max-width: 380px;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 16px 44px rgba(0,0,0,0.55), 0 0 22px -6px var(--accent-glow);
  transform: translateX(calc(100% + 40px));
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.3s ease;
  pointer-events: none;
}
.global-toast.toast-show { transform: translateX(0); opacity: 1; pointer-events: auto; }
.global-toast-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: #7EA5FF;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.global-toast-icon.toast-tone-success { background: rgba(52,211,153,0.16); color: #6FE0B4; }
.global-toast-icon.toast-tone-error   { background: rgba(248,113,113,0.16); color: #F87171; }
.global-toast-icon.toast-tone-warning { background: rgba(245,165,36,0.16); color: var(--amber); }
.global-toast .notif-title {
  color: #E8ECF4; font-size: 14px; font-weight: 700;
  font-family: 'Inter', sans-serif; margin: 0 0 4px;
}
.global-toast .notif-address {
  color: rgba(255,255,255,0.55); font-size: 11.5px;
  font-family: 'Inter', sans-serif; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Scrollbars ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.12) transparent; }

/* Kill any hover/focus outline or ring on sidebar nav items */
.sidebar .nav-item { -webkit-tap-highlight-color: transparent; }
.sidebar .nav-item:hover,
.sidebar .nav-item:focus,
.sidebar .nav-item:focus-visible,
.sidebar .nav-item:active { outline: none !important; box-shadow: none !important; }
.sidebar .nav-item:hover:not(.active) { border-color: transparent !important; }

/* ══ Pills & badges — unified animated revamp ═════════════════════════════
   Applies a periodic light-sheen sweep + hover lift to every status pill,
   tag and badge across the app. Colours stay owned by each component. */
.role-pill, .pay-pill, .rk-tag, .rk-badge, .ba-badge, .ba-tag, .status-pill,
.pay-kpi-badge, .eng-status, .pv-chip, .disp-un2-pri, .disp-tag-pill,
.nav-count, [class*="badge--"] {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform .16s ease, box-shadow .2s ease, filter .2s ease;
  will-change: transform;
}
@media (prefers-reduced-motion: no-preference) {
  .role-pill::before, .pay-pill::before, .rk-tag::before, .rk-badge::before,
  .ba-badge::before, .ba-tag::before, .status-pill::before, .pay-kpi-badge::before,
  .eng-status::before, .pv-chip::before, .disp-un2-pri::before, .disp-tag-pill::before,
  [class*="badge--"]::before {
    content: "";
    position: absolute; top: -20%; bottom: -20%; left: 0; width: 36%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
    transform: translateX(-180%) skewX(-18deg);
    animation: pill-sheen 3.8s cubic-bezier(.4,0,.2,1) infinite;
    pointer-events: none; z-index: 2;
  }
}
@keyframes pill-sheen {
  0%   { transform: translateX(-180%) skewX(-18deg); }
  55%  { transform: translateX(320%)  skewX(-18deg); }
  100% { transform: translateX(320%)  skewX(-18deg); }
}
/* Stagger the sweep a little so they don't all fire in lockstep */
.pay-pill.sent::before, .rk-tag::before, .ba-tag::before { animation-delay: 1.1s; }
.pay-pill.overdue::before, .rk-badge::before, .badge--action::before { animation-delay: .6s; }
.pay-pill.paid::before, .eng-status::before { animation-delay: 1.7s; }

.role-pill:hover, .pay-pill:hover, .rk-tag:hover, .rk-badge:hover, .ba-badge:hover,
.ba-tag:hover, .status-pill:hover, .pay-kpi-badge:hover, .eng-status:hover,
.pv-chip:hover, .disp-un2-pri:hover, .disp-tag-pill:hover, [class*="badge--"]:hover {
  transform: translateY(-1px) scale(1.04);
  filter: brightness(1.1) saturate(1.1);
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE / TABLET  (iOS + Android)
   Off-canvas sidebar, compact topbar, safe-area insets, touch targets.
   Desktop defaults: the hamburger + backdrop are hidden.
   ═══════════════════════════════════════════════════════════════════ */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }

/* Respect the notch / home-indicator on iOS + gesture bars on Android. */
.site-header { padding-top: env(safe-area-inset-top); }

@media (max-width: 900px) {
  /* Topbar hamburger */
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex-shrink: 0;
    background: rgba(255,255,255,.04); border: 1px solid var(--line);
    border-radius: 10px; color: var(--text); cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-toggle:active { transform: scale(.94); }

  /* Header spans full width; tighten it up for small screens */
  .site-header {
    left: 0;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    gap: 10px;
  }
  .header-title { min-width: 0; }
  .header-title h1 { font-size: 15px; }
  .header-search { display: none; }          /* placeholder search — hidden on mobile */
  .header-right { gap: 10px; }
  .status-pill { display: none; }
  .user-meta { display: none; }              /* keep the avatar, drop the text */
  .user-chevron { display: none; }
  .btn-new-booking { padding: 8px 12px; }

  /* Off-canvas sidebar */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    width: min(84vw, 300px);
    z-index: 120;
    padding-top: env(safe-area-inset-top);
    box-shadow: 0 0 60px rgba(0,0,0,.6);
  }
  body.nav-open .sidebar { transform: translateX(0); }

  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 110;
    background: rgba(4,7,14,.6); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .25s ease;
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }        /* lock scroll while the drawer is open */

  /* Content reclaims the full width */
  .main-content {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }

  /* Bigger touch targets in the nav */
  .sidebar .nav-item { min-height: 46px; }

  /* Toast: keep it clear of the notch, full-ish width */
  .global-toast { left: 12px; right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); width: auto; }
}

/* Phones — single-column stat/KPI rows so cards stay legible */
@media (max-width: 560px) {
  .rk-kpi-grid.c5, .rk-kpi-grid.c4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pg-head h1 { font-size: 19px; }
  .header-title h1 { font-size: 14px; }
}
