/* =========================================================
   Flecso — Logistics OS
   Design Tokens
   ========================================================= */
:root {
  /* Brand */
  --orange-50:  #FFF5EC;
  --orange-100: #FFE7D1;
  --orange-200: #FFCBA0;
  --orange-300: #FFA85F;
  --orange-400: #FF8A2B;
  --orange-500: #FF6B1A;   /* primary */
  --orange-600: #F25108;
  --orange-700: #C43E04;
  --orange-grad: linear-gradient(135deg,#FF8A2B 0%,#FF5500 100%);

  /* Neutrals */
  --black:     #0A0A0B;
  --ink-900:   #111114;
  --ink-800:   #1C1C21;
  --ink-700:   #2A2A31;
  --ink-600:   #3F3F46;
  --ink-500:   #5B5B63;
  --ink-400:   #8C8C95;
  --ink-300:   #B5B5BD;
  --ink-200:   #E2E2E6;
  --ink-100:   #EFEFF2;
  --ink-50:    #F7F7F9;
  --white:     #FFFFFF;

  /* Semantic */
  --success-50: #E8F8EE;
  --success-500:#10B981;
  --success-700:#057A55;
  --warn-50:    #FFF6E0;
  --warn-500:   #F59E0B;
  --danger-50:  #FEECEC;
  --danger-500: #EF4444;
  --danger-700: #B91C1C;
  --info-50:    #E8F0FE;
  --info-500:   #3B82F6;

  /* Surfaces */
  --bg:            #F5F5F7;
  --surface:       #FFFFFF;
  --surface-2:     #FAFAFB;
  --surface-line:  #ECECEF;

  /* Radii & Shadows */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-2xl: 28px;
  --r-full: 999px;

  --shadow-xs: 0 1px 2px rgba(10,10,11,.04);
  --shadow-sm: 0 1px 3px rgba(10,10,11,.06), 0 1px 2px rgba(10,10,11,.04);
  --shadow-md: 0 8px 24px -10px rgba(10,10,11,.10), 0 2px 6px rgba(10,10,11,.04);
  --shadow-lg: 0 24px 60px -20px rgba(10,10,11,.18), 0 8px 18px -8px rgba(10,10,11,.08);
  --shadow-orange: 0 14px 30px -12px rgba(255,107,26,.55);

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: "Space Grotesk", "Inter", sans-serif;

  /* Motion */
  --ease: cubic-bezier(.22,.8,.22,1);
  --dur-fast: 160ms;
  --dur: 240ms;
  --dur-slow: 420ms;

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h: 72px;
}

/* =========================================================
   Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
@supports (padding: max(0px)) {
  .topbar { padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); }
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink-900); }

h1,h2,h3,h4 { font-family: var(--font-display); letter-spacing: -0.02em; margin: 0; color: var(--ink-900); }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }
h4 { font-size: 14px; font-weight: 600; }
p { margin: 0; }

.muted { color: var(--ink-400); font-size: 13px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }

/* =========================================================
   App Shell
   ========================================================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--surface-line);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  gap: 14px;
  overflow-y: auto;
  z-index: 40;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 10px 10px;
  border-bottom: 1px solid var(--surface-line);
  margin-bottom: 8px;
}
.brand-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg,#1c1c21 0%,#000 100%);
  display: grid; place-items: center;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.brand-mark::after {
  content:""; position:absolute; inset:0;
  background: radial-gradient(120% 80% at 80% 0%, rgba(255,107,26,.5), transparent 50%);
}
.brand-text { display:flex; flex-direction: column; line-height:1.15; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.brand-tag  { font-size: 11px; color: var(--ink-400); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section-label {
  font-size: 10.5px; font-weight: 600; color: var(--ink-400);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 14px 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--ink-600);
  font-weight: 500;
  font-size: 13.5px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
  position: relative;
}
.nav-link:hover { background: var(--ink-50); color: var(--ink-900); }
.nav-link .nav-icon { width: 18px; height: 18px; color: var(--ink-400); transition: color var(--dur) var(--ease); }
.nav-link:hover .nav-icon { color: var(--orange-500); }
.nav-link.active {
  background: linear-gradient(180deg,#111114 0%,#1C1C21 100%);
  color: var(--white);
  box-shadow: var(--shadow-md);
}
.nav-link.active .nav-icon { color: var(--orange-400); }
.nav-link.active::before {
  content:""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 3px;
  background: var(--orange-grad); border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--ink-100); color: var(--ink-500);
  padding: 2px 8px; border-radius: 999px;
}
.nav-link.active .nav-badge { background: rgba(255,255,255,.1); color: var(--white); }
.nav-badge--danger {
  background: var(--danger-50); color: var(--danger-700);
  position: relative;
}
.nav-badge--danger::before {
  content: ""; position: absolute; top: -2px; right: -2px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--danger-500);
  animation: pulse 1.4s infinite;
  box-shadow: 0 0 0 3px rgba(239,68,68,.25);
}
.nav-link.active .nav-badge--danger { background: rgba(239,68,68,.18); color: #FDA4A4; }
.nav-dot {
  margin-left: auto; width: 8px; height: 8px; border-radius: 50%;
  background: var(--orange-500); box-shadow: 0 0 0 3px rgba(255,107,26,.2);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

.sidebar__upgrade { padding: 10px 4px 4px; }
.upgrade-card {
  background: linear-gradient(135deg,#0A0A0B 0%, #1C1C21 70%, #2A2A31 100%);
  border-radius: var(--r-lg);
  padding: 16px;
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.upgrade-card::before {
  content:""; position:absolute; inset:-40% -20% auto auto;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,107,26,.45), transparent 70%);
  filter: blur(8px);
}
.upgrade-icon {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--orange-grad);
  display: grid; place-items: center; color: #fff;
  margin-bottom: 10px; position: relative;
}
.upgrade-card h4 { color: #fff; font-size: 14px; margin-bottom: 4px; position: relative; }
.upgrade-card p { color: rgba(255,255,255,.65); font-size: 12px; margin-bottom: 12px; position: relative; }

/* Main */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0;
  display: flex; align-items: center; gap: 14px;
  height: var(--topbar-h);
  padding: 0 28px;
  background: rgba(245,245,247,.75);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--surface-line);
  z-index: 30;
}
.topbar .topbar__menu { display: none; }
.topbar__search {
  display: flex; align-items: center; gap: 10px;
  flex: 1; max-width: 540px;
  height: 42px; padding: 0 14px;
  background: var(--white);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  color: var(--ink-400);
}
.topbar__search:focus-within {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 4px rgba(255,107,26,.10);
}
.topbar__search input { flex:1; border: none; outline: none; background: transparent; color: var(--ink-900); }
.topbar__search input::placeholder { color: var(--ink-400); }
.kbd {
  font-size: 11px; font-weight: 600; padding: 2px 6px;
  background: var(--ink-50); border: 1px solid var(--surface-line);
  border-radius: 6px; color: var(--ink-500);
}

.topbar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  background: var(--success-50); color: var(--success-700);
  border-radius: 999px; font-weight: 600; font-size: 12.5px;
}
.chip-dot { width:8px; height: 8px; border-radius: 50%; background: var(--success-500); box-shadow: 0 0 0 3px rgba(16,185,129,.2); animation: pulse 2s infinite; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--white);
  border: 1px solid var(--surface-line);
  border-radius: 12px;
  color: var(--ink-600);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
  position: relative;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--ink-200); color: var(--ink-900); }
.icon-btn--notify .notify-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--orange-grad); color: #fff;
  border-radius: 999px; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(255,107,26,.4);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.icon-btn--notify .notify-badge.hidden { transform: scale(0); opacity: 0; }

.notify-wrap { position: relative; }
.notify-pop {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 380px; max-width: calc(100vw - 32px);
  background: var(--white);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(.98);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  z-index: 50;
  overflow: hidden;
}
.notify-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.notify-pop__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--surface-line);
}
.notify-pop__head h3 { font-size: 15px; }
.notify-pop__body { max-height: 420px; overflow-y: auto; padding: 6px 0; }
.notify-pop__foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--surface-line);
  background: var(--surface-2);
  font-size: 12.5px; font-weight: 600;
}
.notify-pop__foot a { color: var(--ink-600); }
.notify-pop__foot a.link-primary { color: var(--orange-600); }
.notify-pop__foot a:hover { color: var(--ink-900); }

.notify-item {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px;
  padding: 12px 16px; cursor: pointer;
  transition: background var(--dur) var(--ease);
  position: relative;
}
.notify-item:hover { background: var(--ink-50); }
.notify-item.unread::before {
  content:""; position: absolute; top: 18px; left: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--orange-500);
}
.notify-item__icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; flex: none;
}
.notify-item__icon--danger  { background: var(--danger-50); color: var(--danger-700); }
.notify-item__icon--warn    { background: var(--warn-50);   color: #8A5100; }
.notify-item__icon--success { background: var(--success-50);color: var(--success-700); }
.notify-item__icon--info    { background: var(--info-50);   color: var(--info-500); }
.notify-item__icon--orange  { background: var(--orange-50); color: var(--orange-700); }
.notify-item__title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notify-item__sub   { font-size: 12px; color: var(--ink-500); line-height: 1.4; }
.notify-item__time  { font-size: 11px; color: var(--ink-400); white-space: nowrap; padding-top: 2px; }
.notify-empty {
  text-align: center; padding: 34px 16px; color: var(--ink-400); font-size: 13px;
}

.profile-pop { width: 280px; }
.profile-link {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px; font-weight: 500; color: var(--ink-700);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.profile-link:hover { background: var(--ink-50); color: var(--ink-900); }
.profile-link svg { color: var(--ink-400); flex: none; }
.profile-link:hover svg { color: var(--orange-500); }
.profile-link--danger { color: var(--danger-700); background: var(--danger-50); }
.profile-link--danger:hover { background: #FCDADA; color: var(--danger-700); }
.profile-link--danger svg { color: var(--danger-700); }
.profile-link--danger:hover svg { color: var(--danger-700); }

/* Anchored floating menu (date range, quick add) */
.flymenu {
  position: absolute;
  min-width: 220px;
  background: var(--white);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 55;
  opacity: 0; transform: translateY(-4px) scale(.98);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.flymenu.open { opacity: 1; transform: none; pointer-events: auto; }
.flymenu__item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--ink-700);
  cursor: pointer; text-align: left;
  transition: background var(--dur) var(--ease);
}
.flymenu__item:hover { background: var(--ink-50); color: var(--ink-900); }
.flymenu__item.active { background: var(--orange-50); color: var(--orange-700); }
.flymenu__item svg { color: var(--ink-400); flex: none; }
.flymenu__item:hover svg { color: var(--orange-500); }
.flymenu__item small { margin-left: auto; color: var(--ink-400); font-size: 11px; font-weight: 500; }
.flymenu__sep { height: 1px; background: var(--surface-line); margin: 4px 0; }

.topbar__profile { cursor: pointer; }

.topbar__profile {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 4px;
  background: var(--white); border: 1px solid var(--surface-line);
  border-radius: 999px; cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}
.topbar__profile:hover { border-color: var(--ink-200); }
.topbar__profile img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.profile-meta { display: flex; flex-direction: column; line-height: 1.2; }
.profile-name { font-size: 13px; font-weight: 600; }
.profile-role { font-size: 11px; color: var(--ink-400); }

/* Page */
.page {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: pageIn var(--dur-slow) var(--ease);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* =========================================================
   Page Header
   ========================================================= */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-head h1 { font-size: 26px; }
.page-head__sub { color: var(--ink-500); font-size: 13.5px; margin-top: 4px; }
.breadcrumb {
  display: flex; gap: 6px; align-items: center;
  color: var(--ink-400); font-size: 12px; font-weight: 500;
  margin-bottom: 6px;
}
.breadcrumb span { color: var(--ink-900); }

.page-head__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--r-md);
  font-weight: 600; font-size: 13px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  white-space: nowrap;
}
.btn svg { flex: none; }
.btn--primary {
  background: var(--orange-grad); color: #fff;
  box-shadow: var(--shadow-orange);
}
.btn--primary:hover { transform: translateY(-1px); }
.btn--dark { background: var(--ink-900); color: #fff; }
.btn--dark:hover { background: var(--ink-700); }
.btn--ghost { background: var(--white); color: var(--ink-700); border: 1px solid var(--surface-line); }
.btn--ghost:hover { border-color: var(--ink-200); color: var(--ink-900); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 10px; }

/* =========================================================
   Cards
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-lg);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--surface-line);
  gap: 10px; flex-wrap: wrap;
}
.card__title { display: flex; align-items: center; gap: 10px; }
.card__title h3 { font-size: 15px; }
.card__body { padding: 18px 20px; }
.card__footer { padding: 14px 20px; border-top: 1px solid var(--surface-line); display: flex; justify-content: space-between; align-items: center; }

/* =========================================================
   Stats Grid
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat {
  position: relative;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat__icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; margin-bottom: 14px;
}
.stat__icon--orange { background: var(--orange-50); color: var(--orange-600); }
.stat__icon--dark   { background: var(--ink-900); color: #fff; }
.stat__icon--green  { background: var(--success-50); color: var(--success-700); }
.stat__icon--blue   { background: var(--info-50); color: var(--info-500); }
.stat__label { color: var(--ink-500); font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat__value { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; }
.stat__trend {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 10px; font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
}
.trend-up   { background: var(--success-50); color: var(--success-700); }
.trend-down { background: var(--danger-50);  color: var(--danger-700); }
.stat__spark {
  position: absolute; right: 12px; bottom: 12px; opacity: .85;
}

/* =========================================================
   Dashboard Grids
   ========================================================= */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-live { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }

.chart-wrap { height: 260px; position: relative; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-500); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Activity list */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; gap: 12px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--surface-line);
}
.activity-item:last-child { border-bottom: none; padding-bottom: 0; }
.activity-avatar {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; flex: none;
}
.activity-item h5 { font-size: 13.5px; font-weight: 600; margin-bottom: 2px; }
.activity-item p { font-size: 12.5px; color: var(--ink-500); }
.activity-time { font-size: 11.5px; color: var(--ink-400); margin-left: auto; white-space: nowrap; }

/* SOS Card */
.sos-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; background: var(--danger-50);
  border-radius: 12px; margin-bottom: 10px;
  border: 1px solid rgba(239,68,68,.15);
}
.sos-item:last-child { margin-bottom: 0; }
.sos-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--danger-500);
  box-shadow: 0 0 0 4px rgba(239,68,68,.18);
  animation: pulse 1.4s infinite;
}
.sos-item h5 { font-size: 13px; font-weight: 700; color: var(--danger-700); }
.sos-item p { font-size: 11.5px; color: var(--ink-600); }

/* Map */
.map-wrap {
  position: relative;
  height: 380px;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--surface-line);
}
#mapEl { height: 100%; width: 100%; }
.map-legend {
  position: absolute; bottom: 14px; left: 14px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--surface-line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex; gap: 12px; font-size: 12px; font-weight: 500;
  box-shadow: var(--shadow-sm);
  z-index: 400;
}
.map-legend span { display:inline-flex; align-items:center; gap:6px; }
.map-overlay-stat {
  position: absolute; top: 14px; left: 14px; z-index: 400;
  display: grid; grid-template-columns: repeat(3, auto); gap: 10px;
}
.map-overlay-stat .pill {
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border: 1px solid var(--surface-line);
  border-radius: 12px; padding: 8px 12px;
  font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.pill strong { display: block; font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.pill em { font-style: normal; color: var(--ink-400); font-weight: 500; font-size: 11px; }

.leaflet-pane .leaflet-tile-pane { filter: grayscale(.45) contrast(1.03); }

.truck-marker {
  width: 36px; height: 36px; position: relative;
}
.truck-marker::before {
  content:""; position: absolute; inset: 0;
  border-radius: 50%; background: var(--orange-grad);
  box-shadow: 0 8px 18px -4px rgba(255,107,26,.55);
}
.truck-marker::after {
  content:""; position: absolute; inset: -8px;
  border-radius: 50%; border: 2px solid rgba(255,107,26,.35);
  animation: ping 2s infinite;
}
.truck-marker svg { position:absolute; inset: 0; margin:auto; color:#fff; }
@keyframes ping {
  0% { transform: scale(.8); opacity: .9; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Schedule list */
.schedule-row {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 14px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--surface-line);
}
.schedule-row:last-child { border-bottom: none; }
.schedule-date {
  text-align: center;
  background: var(--ink-900); color: #fff;
  padding: 8px 6px; border-radius: 12px;
  font-family: var(--font-display);
}
.schedule-date strong { display:block; font-size: 18px; line-height: 1; }
.schedule-date small { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.6); }
.schedule-title { font-weight: 600; font-size: 13.5px; }
.schedule-sub   { font-size: 12px; color: var(--ink-500); }

/* =========================================================
   Tables
   ========================================================= */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 0;
}
.toolbar .search {
  position: relative; flex: 1; max-width: 360px;
}
.toolbar .search input {
  width: 100%; height: 40px; padding: 0 12px 0 38px;
  background: var(--white);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-md); outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.toolbar .search input:focus { border-color: var(--orange-400); box-shadow: 0 0 0 4px rgba(255,107,26,.1); }
.toolbar .search svg { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: var(--ink-400); }
.toolbar .filters { display: inline-flex; gap: 6px; padding: 4px; background: var(--white); border: 1px solid var(--surface-line); border-radius: var(--r-md); }
.toolbar .filters button {
  padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 12px; color: var(--ink-500);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.toolbar .filters button.active { background: var(--ink-900); color: #fff; }

.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 900px;
}
table.data thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  text-align: left;
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-500);
  padding: 14px 16px;
  border-bottom: 1px solid var(--surface-line);
  white-space: nowrap;
}
table.data tbody td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--surface-line);
  vertical-align: middle;
}
table.data tbody tr { transition: background var(--dur) var(--ease); }
table.data tbody tr:hover { background: var(--ink-50); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .cell-asset { display: flex; align-items: center; gap: 12px; }
table.data .asset-thumb {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover;
  background: var(--ink-100); flex: none;
}
table.data .asset-name { font-weight: 600; }
table.data .asset-sub  { font-size: 12px; color: var(--ink-400); }

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1;
}
.badge--success { background: var(--success-50); color: var(--success-700); }
.badge--warn    { background: var(--warn-50);    color: #8A5100; }
.badge--danger  { background: var(--danger-50);  color: var(--danger-700); }
.badge--info    { background: var(--info-50);    color: #1E4FC7; }
.badge--neutral { background: var(--ink-100);    color: var(--ink-600); }
.badge--orange  { background: var(--orange-50);  color: var(--orange-700); }
.badge .badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Row actions */
.row-actions { display: inline-flex; gap: 6px; }
.mini-btn {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--white); border: 1px solid var(--surface-line);
  display: grid; place-items: center; color: var(--ink-500);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.mini-btn:hover { transform: translateY(-1px); color: var(--ink-900); border-color: var(--ink-200); }
.mini-btn--qr:hover { color: var(--orange-600); border-color: var(--orange-300); }
.mini-btn--danger:hover { color: var(--danger-700); border-color: #FBB4B4; }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; gap: 12px;
}
.pagination .meta { color: var(--ink-500); font-size: 12.5px; }
.pagination .pager { display: inline-flex; gap: 4px; }
.pager button {
  min-width: 32px; height: 32px; padding: 0 10px;
  border-radius: 8px; font-size: 12.5px; font-weight: 600;
  background: var(--white); border: 1px solid var(--surface-line);
  color: var(--ink-600);
}
.pager button.active { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }

/* =========================================================
   Forms (Drawer)
   ========================================================= */
.form-section {
  padding: 18px 0;
  border-bottom: 1px dashed var(--surface-line);
}
.form-section:last-child { border-bottom: none; }
.form-section h4 {
  font-family: var(--font-display);
  font-size: 13.5px; font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}
.form-section h4 .sec-num {
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--orange-50); color: var(--orange-700);
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.form-section .muted { margin-bottom: 16px; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-700); }
.field label .req { color: var(--orange-600); margin-left: 3px; }
.input, select, textarea {
  width: 100%;
  height: 42px; padding: 0 14px;
  background: var(--white);
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
textarea { padding: 10px 14px; min-height: 88px; resize: vertical; height: auto; line-height: 1.5; }
.input:focus, select:focus, textarea:focus {
  border-color: var(--orange-400);
  box-shadow: 0 0 0 4px rgba(255,107,26,.10);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238C8C95' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.checkbox input { margin-top: 3px; accent-color: var(--orange-500); }

.upload {
  border: 1.5px dashed var(--ink-200);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  background: var(--surface-2);
  color: var(--ink-500);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  cursor: pointer;
}
.upload:hover { border-color: var(--orange-400); background: var(--orange-50); color: var(--orange-700); }
.upload svg { margin-bottom: 6px; }
.upload strong { display: block; font-size: 13px; color: var(--ink-900); }
.upload span { font-size: 11.5px; }

/* Pills filter row */
.delivery-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.delivery-opt {
  padding: 14px; border-radius: 12px;
  border: 1px solid var(--surface-line);
  background: var(--white);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.delivery-opt.active { border-color: var(--orange-400); background: var(--orange-50); box-shadow: 0 0 0 4px rgba(255,107,26,.08); }
.delivery-opt h5 { font-size: 13px; margin-bottom: 2px; }
.delivery-opt p { font-size: 11.5px; color: var(--ink-500); }

/* =========================================================
   Modal
   ========================================================= */
.modal, .drawer {
  position: fixed; inset: 0;
  display: none;
  z-index: 60;
}
.modal.open, .drawer.open { display: block; }
.modal__backdrop, .drawer__backdrop {
  position: absolute; inset: 0;
  background: rgba(10,10,11,.42);
  backdrop-filter: blur(4px);
  animation: fade var(--dur) var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal__dialog {
  position: relative;
  width: min(440px, calc(100% - 40px));
  margin: 8vh auto 0;
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popIn var(--dur-slow) var(--ease);
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal__header, .drawer__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--surface-line);
}
.modal__body { padding: 26px; }
.modal__body--center { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.qr-frame {
  padding: 18px; background: var(--white);
  border: 1px solid var(--surface-line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.qr-data {
  font-family: "SFMono-Regular", Menlo, monospace;
  font-size: 12px; color: var(--ink-500);
  padding: 6px 12px; background: var(--ink-50); border-radius: 8px;
}
.modal__footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--surface-line);
  background: var(--surface-2);
}

/* =========================================================
   Drawer
   ========================================================= */
.drawer__panel {
  position: absolute; top: 0; right: 0;
  height: 100%;
  width: min(620px, 100%);
  background: var(--white);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideIn var(--dur-slow) var(--ease);
}
@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: none; }
}
.drawer__body {
  flex: 1; overflow-y: auto; padding: 8px 22px 24px;
}
.drawer__footer {
  padding: 14px 22px; border-top: 1px solid var(--surface-line);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--surface-2);
}

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--ink-900); color: #fff;
  padding: 12px 16px; border-radius: 12px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px); opacity: 0;
  pointer-events: none;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  z-index: 70;
  display: inline-flex; align-items: center; gap: 8px;
}
.toast.show { transform: none; opacity: 1; }
.toast::before {
  content:""; width: 8px; height: 8px; border-radius:50%;
  background: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(255,107,26,.3);
}

/* =========================================================
   Settings tabs
   ========================================================= */
.tabs-vertical {
  display: grid; grid-template-columns: 240px 1fr; gap: 20px;
}
.tabs-list {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--surface-line);
  border-radius: var(--r-lg); padding: 10px;
  height: fit-content; position: sticky; top: calc(var(--topbar-h) + 12px);
}
.tab-item {
  padding: 10px 12px; border-radius: 10px;
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-600); font-weight: 500; font-size: 13px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tab-item:hover { background: var(--ink-50); color: var(--ink-900); }
.tab-item.active { background: var(--orange-50); color: var(--orange-700); }
.tab-item svg { width: 16px; height: 16px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: pageIn var(--dur) var(--ease); }

/* Role matrix */
.role-matrix { display: grid; grid-template-columns: 1.3fr repeat(5, 1fr); gap: 0; }
.role-matrix > div { padding: 12px 14px; border-bottom: 1px solid var(--surface-line); font-size: 12.5px; display: flex; align-items: center; justify-content: center; }
.role-matrix > div:first-child, .role-matrix .role-label { justify-content: flex-start; font-weight: 500; color: var(--ink-700); }
.role-matrix .role-head { font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-500); background: var(--surface-2); border-bottom: 1px solid var(--surface-line); }
.role-matrix .check {
  width: 18px; height: 18px; border-radius: 5px; background: var(--ink-100);
  display: grid; place-items: center; color: var(--ink-300);
}
.role-matrix .check.on { background: var(--orange-50); color: var(--orange-600); }

/* Plans */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plan {
  padding: 22px; background: var(--white); border: 1px solid var(--surface-line);
  border-radius: var(--r-lg); position: relative;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.plan:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.plan.featured { background: linear-gradient(180deg,#111114 0%,#1c1c21 100%); color: #fff; border-color: transparent; }
.plan.featured h3 { color: #fff; }
.plan.featured .plan-tag { background: var(--orange-grad); color: #fff; }
.plan-tag {
  display: inline-block;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 9px; border-radius: 999px;
  background: var(--ink-100); color: var(--ink-500);
  margin-bottom: 10px;
}
.plan h3 { font-size: 20px; margin-bottom: 4px; }
.plan-price { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: -0.03em; margin: 8px 0; }
.plan-price small { font-size: 13px; font-weight: 500; color: var(--ink-400); }
.plan.featured .plan-price small { color: rgba(255,255,255,.6); }
.plan ul { list-style: none; padding: 0; margin: 14px 0 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.plan ul li { display: flex; gap: 8px; align-items: flex-start; }
.plan ul li svg { flex:none; color: var(--orange-500); margin-top: 2px; }

/* =========================================================
   Trip Detail bits
   ========================================================= */
.trip-map { height: 220px; border-radius: 12px; overflow: hidden; border: 1px solid var(--surface-line); }
.timeline { display: flex; flex-direction: column; gap: 14px; }
.tl-item { display: grid; grid-template-columns: 14px 1fr; gap: 14px; position: relative; }
.tl-item::before {
  content:""; position: absolute; left: 6px; top: 16px; bottom: -14px; width: 2px; background: var(--surface-line);
}
.tl-item:last-child::before { display: none; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 2px; background: var(--ink-200); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--surface-line); }
.tl-item.done .tl-dot { background: var(--success-500); box-shadow: 0 0 0 1px var(--success-500); }
.tl-item.active .tl-dot { background: var(--orange-500); box-shadow: 0 0 0 4px rgba(255,107,26,.15); }
.tl-title { font-weight: 600; font-size: 13px; }
.tl-sub { font-size: 12px; color: var(--ink-500); }

/* =========================================================
   Small util
   ========================================================= */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }

/* =========================================================
   Sidebar backdrop (mobile)
   ========================================================= */
.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(10,10,11,.42);
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
  z-index: 45;
}
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

/* =========================================================
   Responsive
   ========================================================= */

/* === Wide laptop / 13-14" === */
@media (max-width: 1280px) {
  :root { --sidebar-w: 240px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .page { padding: 24px; }
}

/* === Small laptop / Tablet landscape === */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-live { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .plans { grid-template-columns: 1fr; gap: 14px; }
  .map-wrap { height: 340px; }
}

/* === Tablet portrait: collapse sidebar === */
@media (max-width: 980px) {
  :root { --sidebar-w: 0px; --topbar-h: 64px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 280px; max-width: 85vw;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    box-shadow: var(--shadow-lg);
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  .sidebar.open { transform: none; }
  .topbar .topbar__menu { display: grid; }
  .topbar__search { max-width: none; flex: 1; min-width: 0; }
  .topbar { padding: 0 18px; gap: 10px; }
  .topbar .chip { display: none; }
  .tabs-vertical { grid-template-columns: 1fr; gap: 14px; }
  .tabs-list { position: static; flex-direction: row; overflow-x: auto; padding: 6px; }
  .tab-item { flex: none; white-space: nowrap; padding: 8px 14px; }
  .role-matrix { grid-template-columns: 1fr 1fr; }
  .role-matrix .role-head { display: none; }
  .role-matrix > div { justify-content: flex-start; gap: 10px; }
  .stat { padding: 16px; }
  .stat__value { font-size: 26px; }
  .stat__spark { width: 70px; right: 10px; bottom: 10px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head__actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .map-wrap { height: 320px; }
  .map-overlay-stat { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .map-overlay-stat .pill { padding: 6px 8px; }
  .pill strong { font-size: 15px; }
  .delivery-options { grid-template-columns: 1fr 1fr; }
  .schedule-row { grid-template-columns: 60px 1fr auto; }
  .upgrade-card { padding: 14px; }
}

/* === Large phone / phablet === */
@media (max-width: 768px) {
  .page { padding: 18px 16px; gap: 18px; }
  .page-head h1 { font-size: 22px; }
  .page-head__sub { font-size: 13px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card__head { padding: 14px 16px; }
  .card__body { padding: 14px 16px; }
  .chart-wrap { height: 220px; }
  .profile-meta { display: none; }
  .topbar__profile { padding: 2px; }
  .topbar__profile img { width: 34px; height: 34px; }
  .kbd { display: none; }
  .modal__dialog { margin-top: 6vh; }
  .drawer__body { padding: 8px 16px 20px; }
  .drawer__header, .drawer__footer { padding: 14px 16px; }
  .delivery-options { grid-template-columns: 1fr; }
  .pagination { flex-direction: column-reverse; align-items: flex-start; gap: 10px; }
  .btn { height: 42px; font-size: 13px; }
  .btn--sm { height: 34px; }
  .icon-btn { width: 38px; height: 38px; }
  .toolbar { gap: 8px; }
  .toolbar .search { max-width: none; flex: 1 1 100%; }
  .toolbar .filters { flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .toolbar .filters::-webkit-scrollbar { display: none; }
  .role-matrix { grid-template-columns: 1fr; }
  .role-matrix > div { border-bottom: 1px solid var(--surface-line); justify-content: flex-start; }
}

/* === Phone === */
@media (max-width: 600px) {
  h1 { font-size: 22px; }
  .page-head__actions .btn:not(.btn--primary) { padding: 0 12px; }
  .stats-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .notify-pop { width: calc(100vw - 24px); right: -12px; }
  .profile-pop { width: calc(100vw - 24px); }
  .map-wrap { height: 260px; }
  .map-overlay-stat { top: 8px; left: 8px; }
  .map-legend { bottom: 8px; left: 8px; font-size: 11px; padding: 8px 10px; }
  .sos-item { grid-template-columns: auto 1fr; }
  .sos-item .btn { grid-column: 1 / -1; justify-self: stretch; justify-content: center; }
  .schedule-row { grid-template-columns: 54px 1fr; row-gap: 6px; }
  .schedule-row .badge { grid-column: 2; justify-self: flex-start; }
  .activity-item { flex-wrap: wrap; }
  .activity-time { margin-left: 0; width: 100%; padding-left: 50px; }
  .chip { height: 32px; padding: 0 10px; font-size: 11.5px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar__search { height: 40px; padding: 0 12px; }
  .topbar__search input { font-size: 16px; }
  .input, select, textarea { font-size: 16px; }
  .upgrade-card h4 { font-size: 13px; }
  .plan { padding: 18px; }
  .plan-price { font-size: 28px; }
  .stat__value { font-size: 24px; }
  .stat__spark { display: none; }
  .modal__dialog { margin: 5vh 12px 0; width: auto; }
  .modal__body { padding: 20px; }
  .qr-frame { padding: 14px; }
  .qr-frame #qrCanvas { width: 200px !important; height: 200px !important; }
  .drawer__panel { width: 100%; }
  .breadcrumb { font-size: 11.5px; }
}

/* === Small phone === */
@media (max-width: 420px) {
  .page { padding: 14px 12px; gap: 14px; }
  .topbar__actions { gap: 6px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
  .topbar__profile img { width: 30px; height: 30px; }
  .brand-text .brand-tag { display: none; }
  .page-head__actions { gap: 8px; width: 100%; }
  .page-head__actions .btn { flex: 1; justify-content: center; padding: 0 10px; font-size: 12px; }
  .card__head { flex-direction: column; align-items: flex-start; }
  .chart-legend { font-size: 11px; }
  .pager button { min-width: 30px; height: 30px; font-size: 12px; }
}

/* Prevent horizontal overflow from long words */
.notify-item__sub, .muted {
  overflow-wrap: anywhere;
}
.asset-name { white-space: nowrap; }
table.data td, table.data th { white-space: nowrap; }
table.data .cell-asset .asset-name,
table.data .cell-asset .asset-sub { white-space: nowrap; }

/* Ensure tables always scroll on narrow containers */
.table-wrap { -webkit-overflow-scrolling: touch; }

/* Bigger touch targets on coarse pointers */
@media (pointer: coarse) {
  .mini-btn { width: 36px; height: 36px; }
  .nav-link { padding: 12px; }
  .tab-item { padding: 12px; }
  .profile-link { padding: 12px; }
}
