/* ==========================================================================
   Aura Distribute ERP — TailAdmin-style dashboard theme (plain CSS)
   Design tokens mirror TailAdmin: Outfit font, brand #465FFF, gray scale,
   rounded-2xl cards with 1px gray-200 borders, 290px sidebar.
   ========================================================================== */

:root {
  --brand-25: #f2f7ff; --brand-50: #ecf3ff; --brand-100: #dde9ff; --brand-200: #c2d6ff;
  --brand-300: #9cb9ff; --brand-400: #7592ff; --brand-500: #465fff; --brand-600: #3641f5;
  --brand-700: #2a31d8; --brand-800: #252dae; --brand-950: #161950;
  --gray-25: #fcfcfd; --gray-50: #f9fafb; --gray-100: #f2f4f7; --gray-200: #e4e7ec;
  --gray-300: #d0d5dd; --gray-400: #98a2b3; --gray-500: #667085; --gray-600: #475467;
  --gray-700: #344054; --gray-800: #1d2939; --gray-900: #101828; --gray-950: #0c111d;
  --success-50: #ecfdf3; --success-100: #d1fadf; --success-500: #12b76a; --success-600: #039855; --success-700: #027a48;
  --warning-50: #fffaeb; --warning-100: #fef0c7; --warning-500: #f79009; --warning-600: #dc6803; --warning-700: #b54708;
  --error-50: #fef3f2; --error-100: #fee4e2; --error-500: #f04438; --error-600: #d92d20; --error-700: #b42318;
  --info-50: #f0f9ff; --info-500: #0ba5ec; --info-600: #0086c9; --info-700: #026aa2;

  /* semantic (light) */
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-2: var(--gray-50);
  --surface-3: var(--gray-100);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  --text: var(--gray-800);
  --text-2: var(--gray-700);
  --muted: var(--gray-500);
  --subtle: var(--gray-400);
  --menu-active-bg: var(--brand-50);
  --menu-active-text: var(--brand-500);
  --menu-hover-bg: rgba(70, 95, 255, 0.12);
  --menu-hover-text: var(--brand-600);
  --focus-ring: 0 0 0 4px rgba(70, 95, 255, 0.12);
  --shadow-xs: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 20px -10px rgba(16, 24, 40, 0.10);
  --shadow-card-hover: 0 2px 4px rgba(16, 24, 40, 0.05), 0 18px 32px -14px rgba(16, 24, 40, 0.18);

  --tone-success-bg: var(--success-50); --tone-success-fg: var(--success-600);
  --tone-warning-bg: var(--warning-50); --tone-warning-fg: var(--warning-600);
  --tone-error-bg: var(--error-50);     --tone-error-fg: var(--error-600);
  --tone-info-bg: var(--info-50);       --tone-info-fg: var(--info-600);
  --tone-brand-bg: var(--brand-50);     --tone-brand-fg: var(--brand-500);
  --tone-gray-bg: var(--gray-100);      --tone-gray-fg: var(--gray-700);
  /* Specific location (teal) and signature-only orders (purple): set apart from the status tones. */
  --tone-spot-bg: #ccfbf1;              --tone-spot-fg: #0f766e;
  --tone-sign-bg: #f3e8ff;              --tone-sign-fg: #7e22ce;   --sign-border: #a855f7;

  --pastel-butter-bg: #fff9e6;     --pastel-butter-border: #f6e3a6;
  --pastel-periwinkle-bg: #eef1ff; --pastel-periwinkle-border: #c7d0ff;
  --pastel-mint-bg: #eaf7f1;       --pastel-mint-border: #bce5d1;
  --pastel-sky-bg: #ebf6fd;        --pastel-sky-border: #bae0f7;
  --pastel-peach-bg: #fff4ec;      --pastel-peach-border: #fad7bf;
  --pastel-lavender-bg: #f3f0ff;   --pastel-lavender-border: #dad1fd;
  --pastel-rose-bg: #fdf0f4;       --pastel-rose-border: #f5cad7;
  --pastel-icon-bg: rgba(255, 255, 255, 0.75);
  --table-head-bg: #f5f7ff;

  --sidebar-w: 290px;
  --sidebar-w-collapsed: 90px;
  --header-h: 76px;
  --radius-sm: 8px; --radius: 12px; --radius-lg: 16px;
  --font: 'Outfit', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}

html.dark {
  --bg: var(--gray-950);
  --surface: var(--gray-900);
  --surface-2: rgba(255, 255, 255, 0.03);
  --surface-3: var(--gray-800);
  --border: var(--gray-800);
  --border-strong: var(--gray-700);
  --text: rgba(255, 255, 255, 0.9);
  --text-2: var(--gray-300);
  --muted: var(--gray-400);
  --subtle: var(--gray-500);
  --menu-active-bg: rgba(70, 95, 255, 0.12);
  --menu-active-text: var(--brand-400);
  --menu-hover-bg: rgba(117, 146, 255, 0.18);
  --menu-hover-text: var(--brand-300);
  --tone-success-bg: rgba(18, 183, 106, 0.15); --tone-success-fg: var(--success-500);
  --tone-warning-bg: rgba(247, 144, 9, 0.15);  --tone-warning-fg: #fdb022;
  --tone-error-bg: rgba(240, 68, 56, 0.15);    --tone-error-fg: #f97066;
  --tone-info-bg: rgba(11, 165, 236, 0.15);    --tone-info-fg: #36bffa;
  --tone-brand-bg: rgba(70, 95, 255, 0.15);    --tone-brand-fg: var(--brand-400);
  --tone-gray-bg: rgba(255, 255, 255, 0.05);   --tone-gray-fg: var(--gray-300);
  --tone-spot-bg: rgba(45, 212, 191, 0.15);   --tone-spot-fg: #5eead4;
  --tone-sign-bg: rgba(168, 85, 247, 0.18);   --tone-sign-fg: #d8b4fe;   --sign-border: #a855f7;
  --pastel-butter-bg: rgba(246, 227, 166, 0.07);     --pastel-butter-border: rgba(246, 227, 166, 0.18);
  --pastel-periwinkle-bg: rgba(199, 208, 255, 0.07); --pastel-periwinkle-border: rgba(199, 208, 255, 0.18);
  --pastel-mint-bg: rgba(188, 229, 209, 0.07);       --pastel-mint-border: rgba(188, 229, 209, 0.18);
  --pastel-sky-bg: rgba(186, 224, 247, 0.07);        --pastel-sky-border: rgba(186, 224, 247, 0.18);
  --pastel-peach-bg: rgba(250, 215, 191, 0.07);      --pastel-peach-border: rgba(250, 215, 191, 0.18);
  --pastel-lavender-bg: rgba(218, 209, 253, 0.07);   --pastel-lavender-border: rgba(218, 209, 253, 0.18);
  --pastel-rose-bg: rgba(245, 202, 215, 0.07);       --pastel-rose-border: rgba(245, 202, 215, 0.18);
  --pastel-icon-bg: rgba(255, 255, 255, 0.06);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.30), 0 10px 24px -12px rgba(0, 0, 0, 0.55);
  --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 20px 36px -14px rgba(0, 0, 0, 0.65);
  --table-head-bg: rgba(199, 208, 255, 0.05);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
.icon { flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }

/* ------------------------------------------------------------------ layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--sidebar-w);
  display: flex; flex-direction: column; padding: 0 20px;
  background: var(--surface); border-right: 1px solid var(--border);
  transition: width .25s ease, transform .25s ease;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; height: var(--header-h); padding: 0 4px; flex-shrink: 0; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: var(--brand-500); color: #fff; display: grid; place-items: center;
}
.logo-text { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; white-space: nowrap; }
.logo-text span { color: var(--brand-500); }
.sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 24px; scrollbar-width: thin; }
.menu-group + .menu-group { margin-top: 20px; }
.menu-title {
  font-size: 12px; text-transform: uppercase; color: var(--subtle); letter-spacing: .02em;
  margin-bottom: 12px; padding: 0 4px; white-space: nowrap; line-height: 20px;
}
.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-2); white-space: nowrap;
  transition: background .18s, color .18s, transform .18s, box-shadow .18s;
}
.menu-item .icon { color: var(--muted); transition: color .18s; }
/* Hover: lifts off the sidebar with a see-through brand tint. */
.menu-item:hover { background: var(--menu-hover-bg); color: var(--menu-hover-text); transform: translateY(-2px);
  box-shadow: 0 6px 16px -6px rgba(70, 95, 255, 0.35); }
.menu-item:hover .icon { color: var(--menu-hover-text); }
/* Current page: solid brand colour. */
.menu-item.active, .menu-item.active:hover { background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff; box-shadow: 0 8px 18px -6px rgba(70, 95, 255, 0.55); }
.menu-item.active .icon { color: #fff; }
.menu-item:active { transform: translateY(0) scale(0.98); }
@media (prefers-reduced-motion: reduce) { .menu-item, .menu-item:hover, .menu-item:active { transform: none; } }
.sidebar-footer {
  margin: 0 -4px 20px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface-2);
  border: 1px solid var(--border); font-size: 13px; color: var(--muted);
}
.sidebar-footer strong { display: block; color: var(--text); font-size: 14px; font-weight: 600; margin-bottom: 2px; }

.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin-left .25s ease; display: flex; flex-direction: column; }

/* collapsed desktop sidebar */
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .logo-text,
body.sidebar-collapsed .sidebar .menu-label,
body.sidebar-collapsed .sidebar .sidebar-footer { display: none; }
body.sidebar-collapsed .sidebar .menu-title { text-align: center; font-size: 0; }
body.sidebar-collapsed .sidebar .menu-title::after { content: '•••'; font-size: 12px; }
body.sidebar-collapsed .sidebar .menu-item { justify-content: center; }
body.sidebar-collapsed .sidebar .sidebar-logo { justify-content: center; }

.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 18px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.square { border-radius: var(--radius-sm); width: 40px; height: 40px; }
.theme-toggle .icon-sun { display: none; }
html.dark .theme-toggle .icon-sun { display: block; }
html.dark .theme-toggle .icon-moon { display: none; }

.user-menu { position: relative; }
.user-trigger {
  display: flex; align-items: center; gap: 12px; background: none; border: 0; cursor: pointer; padding: 4px; color: var(--text-2);
}
.avatar {
  width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--brand-50); color: var(--brand-600); font-weight: 600; font-size: 15px;
}
html.dark .avatar { background: rgba(70, 95, 255, .18); color: var(--brand-300); }
.user-trigger .user-name { font-size: 14px; font-weight: 500; text-align: left; line-height: 1.25; }
.user-trigger .user-role { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 12px); width: 260px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: none; z-index: 60;
}
.dropdown.open { display: block; }
.dropdown-head { padding: 4px 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.dropdown-head strong { display: block; font-size: 14px; font-weight: 500; color: var(--text); }
.dropdown-head span { font-size: 12px; color: var(--muted); }
.dropdown-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-2); background: none; border: 0; cursor: pointer; text-align: left;
}
.dropdown-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-item .icon { color: var(--muted); }

.content { flex: 1; padding: 24px; width: 100%; max-width: 1536px; margin: 0 auto; }

.sidebar-backdrop { display: none; }

/* ------------------------------------------------------------------ page header */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.page-header h2 { font-size: 20px; font-weight: 600; color: var(--text); }
.page-header p { font-size: 14px; color: var(--muted); margin-top: 2px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.breadcrumb a:hover { color: var(--brand-500); }
.breadcrumb .current { color: var(--text); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------------------------------------------ grid helpers */
.grid { display: grid; gap: 16px; }
.grid-2, .grid-3, .grid-4, .grid-main { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px) { .grid { gap: 24px; } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .grid-main-wide { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); }
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-sm { font-size: 14px; } .text-xs { font-size: 12px; } .text-lg { font-size: 18px; }
.muted { color: var(--muted); } .subtle { color: var(--subtle); }
.strong { font-weight: 600; color: var(--text); }
.mono { font-family: var(--mono); letter-spacing: -0.01em; }
.text-right { text-align: right; } .text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.inline-form { display: inline; }
.text-success { color: var(--tone-success-fg); } .text-warning { color: var(--tone-warning-fg); }
.text-error { color: var(--tone-error-fg); } .text-brand { color: var(--tone-brand-fg); }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
.section-title { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 4px; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 0;
  box-shadow: var(--shadow-card);
}
a.card { transition: transform .18s ease, box-shadow .18s ease; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
@media (prefers-reduced-motion: reduce) { a.card, a.card:hover { transition: none; transform: none; } }
.card-pad { padding: 20px; }
@media (min-width: 768px) { .card-pad { padding: 24px; } }
.card-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) { .card-header { padding: 20px 24px; } }
.card-title { font-size: 18px; font-weight: 600; color: var(--text); }
.card-subtitle { font-size: 14px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px; }
@media (min-width: 768px) { .card-body { padding: 24px; } }
.card-footer { padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* KPI tile (TailAdmin metric card) */
.kpi { padding: 20px; }
@media (min-width: 768px) { .kpi { padding: 24px; } }
.kpi-icon {
  width: 48px; height: 48px; border-radius: var(--radius); display: grid; place-items: center;
  background: var(--surface-3); color: var(--text);
}
.kpi-icon.tone-brand { background: var(--tone-brand-bg); color: var(--tone-brand-fg); }
.kpi-icon.tone-success { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.kpi-icon.tone-warning { background: var(--tone-warning-bg); color: var(--tone-warning-fg); }
.kpi-icon.tone-error { background: var(--tone-error-bg); color: var(--tone-error-fg); }
/* Pastel card surfaces: soft tints that sit on the TailAdmin gray canvas.
   Usage: <div class="card kpi pastel-butter">. Dark mode uses faint washes of the same hue.
   Colour language (keep it consistent so colour carries meaning):
     butter = POs and budgets   peach = fees and money values   mint = delivered / done
     sky = crates and trucks    lavender = waiting / drafts      periwinkle = counts and general
     rose = problems (debt, broken bottles, discrepancies) */
.pastel-butter { --p-bg-1: #fffbeb; --p-bg-2: #fff3cc; --p-border: #f3dd97; --p-accent: #b54708; --p-glow: rgba(217, 160, 20, 0.30); --p-orb: rgba(253, 224, 130, 0.60); }
.pastel-peach { --p-bg-1: #fff8f2; --p-bg-2: #ffe9d9; --p-border: #f8d1b4; --p-accent: #c4320a; --p-glow: rgba(232, 120, 60, 0.26); --p-orb: rgba(253, 196, 160, 0.60); }
.pastel-mint { --p-bg-1: #f1fbf6; --p-bg-2: #dcf3e7; --p-border: #b7e2cc; --p-accent: #027a48; --p-glow: rgba(18, 160, 100, 0.24); --p-orb: rgba(160, 230, 195, 0.60); }
.pastel-sky { --p-bg-1: #f3f9fe; --p-bg-2: #ddeffb; --p-border: #b4dcf5; --p-accent: #026aa2; --p-glow: rgba(20, 140, 210, 0.24); --p-orb: rgba(160, 215, 245, 0.60); }
.pastel-lavender { --p-bg-1: #f8f6ff; --p-bg-2: #ebe5ff; --p-border: #d6ccfc; --p-accent: #5925dc; --p-glow: rgba(120, 90, 240, 0.24); --p-orb: rgba(205, 190, 255, 0.60); }
.pastel-periwinkle { --p-bg-1: #f5f7ff; --p-bg-2: #e4e9ff; --p-border: #c4cdff; --p-accent: #3641f5; --p-glow: rgba(70, 95, 255, 0.24); --p-orb: rgba(180, 195, 255, 0.60); }
.pastel-rose { --p-bg-1: #fff6f9; --p-bg-2: #fde5ed; --p-border: #f3c4d3; --p-accent: #c11574; --p-glow: rgba(220, 80, 140, 0.22); --p-orb: rgba(250, 190, 210, 0.60); }
html.dark .pastel-butter { --p-bg-1: rgba(246, 200, 90, 0.11); --p-bg-2: rgba(246, 200, 90, 0.04); --p-border: rgba(246, 200, 90, 0.22); --p-accent: #fdb022; --p-glow: rgba(0, 0, 0, 0.55); --p-orb: rgba(246, 200, 90, 0.14); }
html.dark .pastel-peach { --p-bg-1: rgba(250, 165, 120, 0.11); --p-bg-2: rgba(250, 165, 120, 0.04); --p-border: rgba(250, 165, 120, 0.22); --p-accent: #fd8a5b; --p-glow: rgba(0, 0, 0, 0.55); --p-orb: rgba(250, 165, 120, 0.14); }
html.dark .pastel-mint { --p-bg-1: rgba(110, 215, 160, 0.11); --p-bg-2: rgba(110, 215, 160, 0.04); --p-border: rgba(110, 215, 160, 0.22); --p-accent: #47cd89; --p-glow: rgba(0, 0, 0, 0.55); --p-orb: rgba(110, 215, 160, 0.14); }
html.dark .pastel-sky { --p-bg-1: rgba(110, 190, 240, 0.11); --p-bg-2: rgba(110, 190, 240, 0.04); --p-border: rgba(110, 190, 240, 0.22); --p-accent: #36bffa; --p-glow: rgba(0, 0, 0, 0.55); --p-orb: rgba(110, 190, 240, 0.14); }
html.dark .pastel-lavender { --p-bg-1: rgba(170, 150, 250, 0.11); --p-bg-2: rgba(170, 150, 250, 0.04); --p-border: rgba(170, 150, 250, 0.22); --p-accent: #a48afb; --p-glow: rgba(0, 0, 0, 0.55); --p-orb: rgba(170, 150, 250, 0.14); }
html.dark .pastel-periwinkle { --p-bg-1: rgba(140, 160, 255, 0.11); --p-bg-2: rgba(140, 160, 255, 0.04); --p-border: rgba(140, 160, 255, 0.22); --p-accent: #7592ff; --p-glow: rgba(0, 0, 0, 0.55); --p-orb: rgba(140, 160, 255, 0.14); }
html.dark .pastel-rose { --p-bg-1: rgba(245, 140, 180, 0.11); --p-bg-2: rgba(245, 140, 180, 0.04); --p-border: rgba(245, 140, 180, 0.22); --p-accent: #f670c7; --p-glow: rgba(0, 0, 0, 0.55); --p-orb: rgba(245, 140, 180, 0.14); }
.card[class*="pastel-"] {
  position: relative; isolation: isolate; overflow: hidden;
  background: linear-gradient(160deg, var(--p-bg-1) 0%, var(--p-bg-2) 100%);
  border-color: var(--p-border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 24px -14px var(--p-glow);
}
/* soft light in the top-right corner, behind the content */
.card[class*="pastel-"]::after {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  width: 180px; height: 180px; right: -60px; top: -70px; border-radius: 50%;
  background: radial-gradient(circle, var(--p-orb) 0%, transparent 70%);
}
a.card[class*="pastel-"]:hover { box-shadow: 0 2px 4px rgba(16, 24, 40, 0.05), 0 20px 34px -14px var(--p-glow); }
.card[class*="pastel-"] .kpi-icon {
  background: var(--pastel-icon-bg); color: var(--p-accent);
  box-shadow: inset 0 0 0 1px var(--p-border), 0 4px 10px -4px var(--p-glow);
}
.card[class*="pastel-"] .card-header, .card[class*="pastel-"] .card-footer { border-color: var(--p-border); }
.card[class*="pastel-"] .card-footer { background: transparent; }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 20px; }
.kpi-label { font-size: 14px; color: var(--muted); }
.kpi-value { font-size: 30px; line-height: 38px; font-weight: 700; color: var(--text); margin-top: 8px; letter-spacing: -0.01em; }
.kpi-value small { white-space: nowrap; font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.kpi-meta { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ------------------------------------------------------------------ badges / pills */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap;
  background: var(--tone-gray-bg); color: var(--tone-gray-fg);
}
.badge-success { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.badge-warning { background: var(--tone-warning-bg); color: var(--tone-warning-fg); }
.badge-error { background: var(--tone-error-bg); color: var(--tone-error-fg); }
.badge-info { background: var(--tone-info-bg); color: var(--tone-info-fg); }
.badge-brand { background: var(--tone-brand-bg); color: var(--tone-brand-fg); }
.badge-gray { background: var(--tone-gray-bg); color: var(--tone-gray-fg); }
.badge-spot { background: var(--tone-spot-bg); color: var(--tone-spot-fg); font-weight: 600; white-space: normal; text-align: left; }
.badge-sign { background: var(--tone-sign-bg); color: var(--tone-sign-fg); font-weight: 600; }
/* A signature-only order: crates already at the outlet, the field agent only collects signature and photo. */
.sign-only { border-left: 4px solid var(--sign-border) !important; }
tr.sign-only > td:first-child { box-shadow: inset 4px 0 0 var(--sign-border); }
.text-sign { color: var(--tone-sign-fg); }
/* Rows opened from a notification: highlighted until the page is left. */
tr.is-highlight > td { background: var(--tone-warning-bg); }
tr.is-highlight > td:first-child { box-shadow: inset 4px 0 0 var(--warning-500, #f79009); }
tr.is-highlight.sign-only > td:first-child { box-shadow: inset 4px 0 0 var(--sign-border); }
.alert-sign { background: var(--tone-sign-bg); border-color: var(--sign-border); color: var(--tone-sign-fg); }
.badge-lg { font-size: 14px; padding: 4px 12px; font-weight: 600; letter-spacing: .02em; }
.dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; display: inline-block; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 500; line-height: 20px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; user-select: none;
}
.btn:disabled, .btn.is-loading { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-500); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-success { background: var(--success-500); color: #fff; box-shadow: var(--shadow-xs); }
.btn-success:hover:not(:disabled) { background: var(--success-600); }
.btn-danger { background: var(--error-500); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--error-600); }
.btn-outline { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-outline:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-ghost-danger { background: transparent; color: var(--tone-error-fg); }
.btn-ghost-danger:hover:not(:disabled) { background: var(--tone-error-bg); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: var(--radius); }
.btn-xl { padding: 18px 20px; font-size: 17px; font-weight: 600; border-radius: var(--radius-lg); white-space: normal; text-align: center; line-height: 1.3; }
.btn-block { width: 100%; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 999px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* segmented control (TailAdmin "Overview | Sales | Revenue") */
.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-sm); background: var(--surface-3); }
.segmented a, .segmented button {
  padding: 8px 14px; border-radius: 7px; font-size: 14px; font-weight: 500; color: var(--muted);
  border: 0; background: transparent; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
html.dark .segmented .active { background: var(--gray-800); }
.segmented .count { font-size: 12px; color: var(--subtle); }

/* ------------------------------------------------------------------ forms */
.form-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 14px; font-weight: 500; color: var(--text-2); }
.label .req { color: var(--error-500); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: transparent; color: var(--text);
  font-size: 14px; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s;
}
html.dark .input, html.dark .select, html.dark .textarea { background: var(--gray-900); border-color: var(--gray-700); }
.input::placeholder, .textarea::placeholder { color: var(--subtle); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-300); box-shadow: var(--focus-ring); }
.textarea { height: auto; min-height: 96px; resize: vertical; }
.select {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-sm, .select-sm { height: 36px; padding: 6px 12px; font-size: 13px; }
.select-sm { padding-right: 34px; background-position: right 8px center; }
.input-lg { height: 56px; font-size: 18px; }
.input.has-error, .select.has-error { border-color: var(--error-500); }
.help { font-size: 12px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--tone-error-fg); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 48px; }
.input-group .suffix { position: absolute; right: 14px; font-size: 14px; color: var(--muted); pointer-events: none; }
.input-group .prefix { position: absolute; left: 14px; color: var(--subtle); pointer-events: none; }
.input-group .prefix + .input { padding-left: 42px; }
.checkbox { width: 18px; height: 18px; accent-color: var(--brand-500); cursor: pointer; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-bar .field { min-width: 150px; flex: 1 1 150px; }

/* ------------------------------------------------------------------ alerts */
.alert {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid;
  font-size: 14px; align-items: flex-start;
}
.alert .icon { margin-top: 1px; }
.alert-title { font-weight: 600; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-success { background: var(--tone-success-bg); border-color: rgba(18, 183, 106, .35); color: var(--tone-success-fg); }
.alert-warning { background: var(--tone-warning-bg); border-color: rgba(247, 144, 9, .35); color: var(--tone-warning-fg); }
.alert-error { background: var(--tone-error-bg); border-color: rgba(240, 68, 56, .35); color: var(--tone-error-fg); }
.alert-info { background: var(--tone-info-bg); border-color: rgba(11, 165, 236, .35); color: var(--tone-info-fg); }
.alert .alert-body { color: var(--text-2); }

/* ------------------------------------------------------------------ tables */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 12px 16px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--table-head-bg);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
@media (min-width: 768px) { .table th:first-child, .table td:first-child { padding-left: 24px; } .table th:last-child, .table td:last-child { padding-right: 24px; } }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .cell-main { font-weight: 500; color: var(--text); }
.table .cell-sub { font-size: 12px; color: var(--muted); }
.table tr.is-selected td { background: var(--brand-25); }
html.dark .table tr.is-selected td { background: rgba(70, 95, 255, .08); }
.table tr.is-disabled td { opacity: .45; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); font-size: 14px; }
.empty .icon { margin: 0 auto 12px; color: var(--subtle); }
.empty strong { display: block; color: var(--text); font-size: 16px; font-weight: 600; margin-bottom: 4px; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 6px; }

/* ------------------------------------------------------------------ progress */
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-lg { height: 12px; }
.progress-bar { height: 100%; border-radius: inherit; background: var(--brand-500); transition: width .4s ease; }
.progress-bar.tone-success { background: var(--success-500); }
.progress-bar.tone-warning { background: var(--warning-500); }
.progress-bar.tone-error { background: var(--error-500); }

/* ------------------------------------------------------------------ list items */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-size: 14px; font-weight: 500; color: var(--text); }
.list-item .sub { font-size: 12px; color: var(--muted); }

/* batch queue card */
.queue-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
.queue-card:hover { border-color: var(--brand-200); }
html.dark .queue-card:hover { border-color: var(--brand-800); }
.queue-card .q-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.queue-card .q-title { font-weight: 600; color: var(--text); font-size: 15px; }
.queue-card .q-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.queue-card .q-meta span { display: inline-flex; align-items: center; gap: 6px; }
.queue-card .q-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* stat strip (TailAdmin "Target / Revenue / Today") */
.stat-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.stat-strip > div { padding: 16px 12px; text-align: center; }
.stat-strip > div + div { border-left: 1px solid var(--border); }
.stat-strip .s-label { font-size: 12px; color: var(--muted); }
.stat-strip .s-value { font-size: 16px; font-weight: 600; color: var(--text); margin-top: 2px; }

/* burn-down banner */
.banner { position: relative; overflow: hidden; }
.banner-figure { font-size: 36px; line-height: 44px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.po-code { font-family: var(--mono); font-size: 14px; padding: 4px 10px; border-radius: 6px; background: var(--surface-3); color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------------ modal */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .5); backdrop-filter: blur(6px); }
.modal-dialog {
  position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border-radius: 24px; padding: 28px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
@media (min-width: 768px) { .modal-dialog { padding: 36px; } }
.modal-dialog h3 { font-size: 22px; font-weight: 600; color: var(--text); }
.modal-dialog .modal-sub { font-size: 14px; color: var(--muted); margin-top: 4px; margin-bottom: 24px; }
.modal-close { position: absolute; top: 16px; right: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ toast */
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 14px; color: var(--text);
  animation: toast-in .2s ease;
}
.toast .t-icon { width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; flex-shrink: 0; }
.toast.success .t-icon { background: var(--tone-success-bg); color: var(--tone-success-fg); }
.toast.error .t-icon { background: var(--tone-error-bg); color: var(--tone-error-fg); }
.toast.info .t-icon { background: var(--tone-info-bg); color: var(--tone-info-fg); }
.toast ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; max-height: 180px; overflow: auto; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ dropzone */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--brand-500); background: var(--brand-25); }
html.dark .dropzone:hover, html.dark .dropzone.dragover { background: rgba(70, 95, 255, .06); }
.dropzone .dz-icon { width: 68px; height: 68px; border-radius: 999px; margin: 0 auto 18px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.dropzone h4 { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.dropzone p { font-size: 14px; color: var(--muted); }
.dropzone .dz-link { color: var(--brand-500); font-weight: 500; text-decoration: underline; }
.file-chip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

/* ------------------------------------------------------------------ signature pad / mobile */
.signature-wrap { position: relative; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: #fff; touch-action: none; }
.signature-wrap canvas { width: 100%; height: 220px; display: block; border-radius: var(--radius); cursor: crosshair; }
.signature-wrap .sig-hint { position: absolute; inset: auto 0 14px 0; text-align: center; font-size: 13px; color: var(--gray-400); pointer-events: none; }
.signature-wrap .sig-hint .icon { display: inline-block; vertical-align: -2px; }
.signature-wrap .sig-line { position: absolute; left: 24px; right: 24px; bottom: 40px; border-bottom: 1px solid var(--gray-200); pointer-events: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.card-title .req { color: var(--error-500); }
.photo-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer;
}
.photo-drop:hover, #photo:focus-visible + .photo-drop { border-color: var(--brand-400); background: var(--tone-brand-bg); }
.photo-preview { width: 100%; max-height: 360px; object-fit: contain; border-radius: var(--radius); background: var(--surface-3); }
.stepper { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.stepper button { width: 56px; border: 0; background: var(--surface-3); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.stepper button:active { background: var(--border); }
.stepper input { flex: 1; min-width: 0; border: 0; text-align: center; font-size: 22px; font-weight: 600; height: 56px; background: transparent; color: var(--text); -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; }
.stepper:focus-within { border-color: var(--brand-300); box-shadow: var(--focus-ring); }
.mobile-shell { max-width: 560px; margin: 0 auto; }
.big-number { font-size: 44px; line-height: 1; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.info-tile { display: flex; align-items: center; gap: 14px; }
.info-tile .kpi-icon { width: 52px; height: 52px; }
.info-tile .t-label { font-size: 13px; color: var(--muted); }
.info-tile .t-value { font-size: 20px; font-weight: 600; color: var(--text); }
.sticky-bottom { position: sticky; bottom: 0; padding: 16px 0 calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }

/* ------------------------------------------------------------------ charts (SVG) */
.chart { width: 100%; height: 260px; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart .bar { fill: var(--brand-500); }
.chart .bar-2 { fill: var(--brand-200); }
html.dark .chart .bar-2 { fill: var(--brand-800); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 24px; }
.chart-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.chart-controls .field { min-width: 130px; flex: 1 1 130px; margin: 0; }
.chart-controls [data-split] { display: contents; }
.chart-controls [data-split][hidden] { display: none; }
.chart-controls .btn { flex: 0 0 auto; }
.chart-box { position: relative; }
.chart.chart-round { height: 280px; display: block; margin: 0 auto; max-width: 340px; }
.chart .slice { stroke: var(--surface); stroke-width: 2; cursor: pointer; transition: opacity .15s; }
.chart .slice:hover { opacity: .85; }
.chart .slice-label { fill: #fff; font-size: 12px; font-weight: 600; pointer-events: none; }
.chart .round-total { fill: var(--text); font-size: 22px; font-weight: 700; }
.chart-legend strong { color: var(--text); font-weight: 600; }
.chart-tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--text); white-space: nowrap; transform: translate(-50%, -110%); }

/* ------------------------------------------------------------------ auth page */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--surface); }
@media (min-width: 1024px) { .auth { grid-template-columns: 1fr 1fr; } }
.auth-form-side { display: flex; flex-direction: column; justify-content: center; padding: 40px 24px; }
.auth-form { width: 100%; max-width: 440px; margin: 0 auto; }
.auth-form h1 { font-size: 30px; line-height: 38px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.auth-form .lead { font-size: 14px; color: var(--muted); margin-bottom: 32px; }
.auth-brand-side {
  display: none; position: relative; overflow: hidden; background: var(--brand-950);
  align-items: center; justify-content: center; padding: 48px; color: #fff;
}
@media (min-width: 1024px) { .auth-brand-side { display: flex; } }
.auth-grid-bg { position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%); }
.auth-brand-inner { position: relative; max-width: 400px; text-align: center; }
.auth-brand-inner .logo-mark { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 20px; }
.auth-brand-inner h2 { font-size: 28px; font-weight: 600; margin-bottom: 12px; }
.auth-brand-inner p { color: var(--gray-400); font-size: 15px; }
.auth-roles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 28px; }
.auth-features { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 14px; text-align: left; }
.auth-features li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.auth-feature-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(70,95,255,.25); color: #c7d0ff; }
.auth-features strong { display: block; color: #fff; font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.auth-features div { color: var(--gray-400); font-size: 13px; line-height: 1.45; }
.powered-by { color: var(--brand-500); font-weight: 500; text-decoration: none; }
.powered-by:hover { text-decoration: underline; }
.auth-roles span { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--gray-300); }
.auth-theme { position: fixed; right: 20px; bottom: 20px; z-index: 5; }

/* ------------------------------------------------------------------ error page */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.error-code { font-size: 96px; font-weight: 700; line-height: 1; color: var(--brand-500); letter-spacing: -0.04em; }

/* ------------------------------------------------------------------ responsive shell */
@media (max-width: 1279.98px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(16, 24, 40, .45); }
  .app-main, body.sidebar-collapsed .app-main { margin-left: 0; }
  body.sidebar-collapsed .sidebar .logo-text, body.sidebar-collapsed .sidebar .menu-label,
  body.sidebar-collapsed .sidebar .sidebar-footer { display: revert; }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
}
@media (max-width: 767.98px) {
  .topbar { padding: 0 16px; gap: 10px; height: 64px; }
  .content { padding: 16px; }
  .user-trigger .user-name, .user-trigger .chev { display: none; }
  .topbar-title p { display: none; }
  .kpi-value { font-size: 24px; line-height: 32px; }
  .banner-figure { font-size: 28px; line-height: 36px; }
  .hide-sm { display: none !important; }
  .modal-dialog { border-radius: 20px; }
}
@media (min-width: 768px) { .show-sm { display: none !important; } }

/* ------------------------------------------------------------------ timeline (custody log) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding-bottom: 20px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .tl-dot { position: absolute; left: -22px; top: 4px; width: 14px; height: 14px; padding: 0; border-radius: 999px; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.timeline .tl-dot.badge-success { background: var(--success-500); }
.timeline .tl-dot.badge-brand { background: var(--brand-500); }
.timeline .tl-dot.badge-info { background: var(--info-500); }
.timeline .tl-dot.badge-gray { background: var(--gray-400); }

.sub .icon, .text-sm .icon { display: inline-block; vertical-align: -2px; }

/* ------------------------------------------------------------------ notification bell */
.bell-btn { position: relative; }
.bell-count {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--warning-500); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
  border: 2px solid var(--surface);
}
.bell-dropdown { width: 360px; max-width: calc(100vw - 24px); }
.bell-list { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.bell-item { display: flex; gap: 10px; padding: 10px 8px; border-radius: var(--radius-sm); }
.bell-item:hover { background: var(--surface-3); }
.bell-item.unread { background: var(--brand-25); }
html.dark .bell-item.unread { background: rgba(70, 95, 255, .08); }
.bell-title { display: block; font-size: 14px; font-weight: 500; color: var(--text); }
.bell-body { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.bell-time { display: block; font-size: 12px; color: var(--subtle); margin-top: 4px; }
@media (max-width: 767.98px) { .bell-dropdown { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; } }

/* ------------------------------------------------------------------ money status cards */
.money-card { border-top-width: 4px; }
.money-card.money-success { border-top-color: var(--success-500); }
.money-card.money-warning { border-top-color: var(--warning-500); }
.money-card.money-error { border-top-color: var(--error-500); }
.after-restock { border-top: 1px dashed var(--border, #e4e7ec); padding-top: 10px; }
.kpi-meta .icon, .text-xs .icon, .badge .icon { display: inline-block; vertical-align: -2px; }

/* ------------------------------------------------------------------ sidebar counters & choice grids */
.menu-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--warning-500);
  color: #fff; font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; }
body.sidebar-collapsed .sidebar .menu-item { position: relative; }
body.sidebar-collapsed .sidebar .menu-badge { position: absolute; top: 2px; right: 8px; min-width: 18px; height: 18px; line-height: 18px; font-size: 11px; padding: 0 5px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.choice-grid .choice { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.choice-grid .choice:has(input:checked) { border-color: var(--brand-300); background: var(--brand-25); }
html.dark .choice-grid .choice:has(input:checked) { background: rgba(70, 95, 255, .08); }
.choice-grid input { width: 18px; height: 18px; accent-color: var(--brand-500); }

/* ------------------------------------------------------------------ upload: match-or-add pop-up */
.resolve-list { max-height: 60vh; overflow: auto; padding-right: 4px; }
.resolve-item { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); margin-bottom: 10px; }
.resolve-item .check-row { font-size: 14px; }

/* Urgent alarm (negative stock): a slow pulse on the left edge, still calm. */
.alarm { border-left: 4px solid var(--error-500); animation: alarm-pulse 2.4s ease-in-out infinite; }
@keyframes alarm-pulse { 50% { box-shadow: 0 0 0 4px var(--tone-error-bg); } }
@media (prefers-reduced-motion: reduce) { .alarm { animation: none; } }

/* ------------------------------------------------------------------ action required + notification severity */
.action-pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--tone-warning-bg); color: var(--tone-warning-fg); font-size: 14px; font-weight: 500;
  border: 1px solid transparent; box-shadow: var(--shadow-xs); }
.action-pill.critical { background: var(--tone-error-bg); color: var(--tone-error-fg); }
.action-pill:hover { border-color: currentColor; }
.action-pill-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  background: currentColor; font-size: 12px; }
.action-pill-count { color: var(--surface); background: var(--tone-warning-fg); }
.action-pill.critical .action-pill-count { background: var(--tone-error-fg); }
@media (max-width: 640px) { .action-pill-label { display: none; } .action-pill { padding: 0 10px; } }
.sev { display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 4px; vertical-align: 1px; }
.sev-critical { background: var(--tone-error-bg); color: var(--tone-error-fg); }
.sev-action { background: var(--tone-warning-bg); color: var(--tone-warning-fg); }

/* Dispatch: each Order Manager's orders as a coloured group */
.om-group { --om: #475467; border: 1px solid var(--border, #e4e7ec); border-left: 5px solid var(--om); border-radius: 12px; background: color-mix(in srgb, var(--om) 5%, var(--surface, #fff)); overflow: hidden; }
.om-group > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; flex-wrap: wrap; }
.om-group > summary::-webkit-details-marker { display: none; }
.om-group > summary .om-chevron { margin-left: auto; transition: transform .15s; display: inline-flex; }
.om-group:not([open]) > summary .om-chevron { transform: rotate(-90deg); }
.om-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--om); flex: 0 0 auto; }
.om-group .table-wrap { border-top: 1px solid var(--border, #e4e7ec); }
.om-green { --om: #16a34a; } .om-black { --om: #1f2937; } .om-brown { --om: #92400e; } .om-purple { --om: #7c3aed; }
.om-blue { --om: #2563eb; } .om-orange { --om: #ea580c; } .om-red { --om: #dc2626; } .om-teal { --om: #0d9488; }
.om-pink { --om: #db2777; } .om-gold { --om: #ca8a04; }
html.dark .om-black { --om: #9ca3af; }

/* Live pages: shown instead of reloading while someone is in the middle of something */
.live-banner { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; border: 0; cursor: pointer;
  padding: 10px 18px; border-radius: 999px; background: var(--brand-500); color: #fff; font: inherit; font-weight: 600;
  box-shadow: 0 10px 24px -8px rgba(70, 95, 255, 0.6); }
.live-banner:hover { background: var(--brand-600); }

/* ---------- live map (Team Lead / Super Admin) */
.live-map-grid { grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 1100px) { .live-map-grid { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); } }
.live-map { height: 62vh; min-height: 380px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); z-index: 0; }
.lm-agent { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.lm-agent:hover { border-color: var(--brand-500); }
.lm-agent.is-active { border-color: var(--brand-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 18%, transparent); }
.lm-agent .grow { min-width: 0; }
.lm-agent .block { display: block; }
.lm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; flex: none; }
.lm-agent .lm-dot { width: 12px; height: 12px; margin: 0; }
.leaflet-container { font: inherit; }
.loc-map { height: 360px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); z-index: 0; }
#lm-stops .stack { max-height: 340px; overflow-y: auto; padding-right: 4px; }

/* Sign-in logo: hold 5 s to email the Super Admin a reset link. A ring fills while holding. */
.admin-reset-hold { display: block; width: max-content; margin: 0 auto; cursor: default; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; touch-action: none; }
.admin-reset-hold .logo-mark { transition: box-shadow .2s; }
.admin-reset-hold.holding .logo-mark { animation: admin-reset-ring 5s linear forwards; }
@keyframes admin-reset-ring { from { box-shadow: 0 0 0 0 rgba(255, 255, 255, .0); }
  to { box-shadow: 0 0 0 8px rgba(255, 255, 255, .55); } }

.table tr.row-total td { background: rgba(70, 95, 255, .05); }
.table .cell-check { width: 40px; }
.table td.text-error, .table td .text-error { color: var(--tone-error-fg); }

/* Field agent's status next to the bell: green Active, red Offline (clocked out or no internet). */
.agent-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; margin-right: 4px; }
.agent-status-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.agent-status.is-active { background: var(--tone-success-bg, #ecfdf3); color: var(--tone-success-fg, #027a48); }
.agent-status.is-active .agent-status-dot { background: #12b76a; box-shadow: 0 0 0 3px rgba(18, 183, 106, .2); }
.agent-status.is-offline { background: var(--tone-error-bg, #fef3f2); color: var(--tone-error-fg, #b42318); }
.agent-status.is-offline .agent-status-dot { background: #f04438; box-shadow: 0 0 0 3px rgba(240, 68, 56, .2); }
@media (max-width: 480px) {
  .agent-status-why { display: none; } .agent-status { padding: 5px 8px; }
  .topbar:has(.agent-status) .theme-toggle { display: none; }   /* room for the page title; theme stays in the user menu */
}
.card.kpi.kpi-selected { outline: 2px solid var(--brand-500, #465fff); outline-offset: -2px; }
