/* JSD Sales Hub — design tokens from jsd_saleshub_design_spec */
:root {
  color-scheme: light;
  --green: #16a34a;
  --green-light: #dcfce7;
  --green-dark: #15803d;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --red: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-700: #374151;
  --gray-900: #111827;
  --white: #ffffff;
  --sidebar-w: 272px;
  --nav-h: 56px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition: 0.18s ease;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* semantic aliases (used in JS inline styles / charts) */
  --bg: var(--gray-50);
  --surface: var(--white);
  --border: var(--gray-200);
  --border-hi: #d1d5db;
  --accent: var(--green);
  --accent-dim: var(--green-light);
  --gold: var(--amber);
  --gold-dim: var(--amber-light);
  --text: var(--gray-900);
  --text-sub: var(--gray-700);
  --text-muted: var(--gray-400);
  --danger: var(--red);
  --chart-grid: var(--gray-200);
  --chart-tick: var(--gray-400);
  --chart-legend: var(--gray-700);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --gray-50: #111827;
    --gray-100: #1f2937;
    --gray-200: #374151;
    --gray-400: #9ca3af;
    --gray-700: #d1d5db;
    --gray-900: #f9fafb;
    --white: #1a2233;
    --green-light: #14532d;
    --amber-light: #422006;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --bg: #0f1419;
    --surface: #1a2233;
    --border: #2a3448;
    --border-hi: #3a4558;
    --chart-grid: #2a3448;
  }
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; width: 100%; max-width: none; margin: 0; }

/* Hide desktop/mobile chrome by default; show per breakpoint */
.desktop-only { display: none !important; }
.mobile-only { display: none !important; }

@media (max-width: 768px) {
  .mob-logo-bar.mobile-only { display: flex !important; }
  .bottom-nav.mobile-only { display: flex !important; }
  .store-pill-row.mobile-only { display: block !important; }
}

@media (min-width: 769px) {
  .side-nav.desktop-only { display: flex !important; }
  .topbar-d.desktop-only { display: flex !important; }
}

/* ——— Shell ——— */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.side-nav {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 120;
  display: flex;
  flex-direction: column;
  padding: 0 0 calc(16px + var(--safe-b));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.8) inset;
}

.side-brand {
  padding: 28px 20px 22px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.side-logo-img {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 50%;
}

.side-logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--gray-900);
  max-width: 100%;
}

.side-section {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  padding: 20px 20px 8px;
}

.side-links {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 4px 14px;
  gap: 4px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--gray-700);
  cursor: pointer;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-family: inherit;
  transition: background var(--transition), color var(--transition), transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.side-link:active {
  transform: scale(0.98);
}

.side-link i {
  font-size: 22px;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.side-link.on {
  background: var(--green-light);
  color: var(--green-dark);
  font-weight: 600;
  box-shadow: none;
}

.side-link.on i {
  opacity: 1;
  color: var(--green);
}

.side-foot {
  padding: 16px 20px 8px;
  margin-top: auto;
}

.side-status {
  font-size: 13px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

@media (prefers-color-scheme: dark) {
  .side-nav {
    background: rgba(26, 34, 51, 0.92);
    border-right-color: rgba(255, 255, 255, 0.06);
  }
  .side-status {
    background: rgba(255, 255, 255, 0.05);
  }
}

.main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (min-width: 769px) {
  .main-pane {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
  }

  .side-brand {
    padding: 34px 14px 28px;
    gap: 14px;
  }

  .side-logo-img {
    width: 88px;
    height: 88px;
  }

  .side-logo {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.28;
  }
}

/* Mobile logo bar — iOS large title strip */
.mob-logo-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top, 0px));
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.mob-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}

.mob-brand-block { flex: 1; min-width: 0; }

.mob-brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--gray-900);
}

.mob-tb-acts {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.mob-tb-acts .icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  font-size: 18px;
}

.mob-tb-acts .icon-btn i {
  font-size: 20px;
}

@media (prefers-color-scheme: dark) {
  .mob-logo-bar {
    background: rgba(26, 34, 51, 0.88);
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }
}

/* Desktop top bar */
.topbar-d {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

@media (min-width: 769px) {
  .topbar-d {
    min-height: 64px;
    padding: 14px 28px;
    gap: 16px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  }

  .topbar-d .store-pill {
    font-size: 14px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 999px;
    gap: 8px;
    min-height: 44px;
    box-shadow: var(--shadow-sm);
  }

  .topbar-d .store-pill .dot {
    width: 9px;
    height: 9px;
  }

  .topbar-d .store-pill .pill-chev {
    font-size: 16px;
    margin-left: 4px;
  }

  .topbar-d .store-label {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-d .tb-actions {
    gap: 10px;
  }

  .topbar-d .icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    font-size: 18px;
    border-color: var(--border);
    background: var(--surface);
  }

  .topbar-d .icon-btn i {
    font-size: 20px;
  }

  .topbar-d .icon-btn:hover {
    border-color: var(--green);
    color: var(--green);
    background: color-mix(in srgb, var(--green) 8%, var(--surface));
  }
}

@media (min-width: 769px) and (prefers-color-scheme: dark) {
  .topbar-d {
    background: rgba(26, 34, 51, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  }
}

.tb-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.store-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: var(--white);
  color: var(--gray-900);
  max-width: 100%;
}

.store-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.store-pill .pill-chev {
  font-size: 12px;
  color: var(--gray-400);
  margin-left: 2px;
}

.store-pill-row {
  padding: 0 0 10px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-400);
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color var(--transition), color var(--transition);
}

.icon-btn:hover {
  border-color: var(--gray-400);
  color: var(--gray-700);
}

.icon-btn i { font-size: 16px; }

/* Content area */
.dash-content,
.main-inner {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px calc(var(--nav-h) + 12px + var(--safe-b));
  background: var(--gray-50);
}

@media (min-width: 769px) {
  .dash-content,
  .main-inner {
    padding: 20px 20px 28px;
  }
}

/* Bottom nav — mobile: swipeable track (fits Home…Delivery without squashing) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 130;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 2px 0 var(--safe-b);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.bottom-nav-track {
  display: flex;
  align-items: center;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 8px;
  gap: 2px;
}

.bottom-nav-track::-webkit-scrollbar {
  display: none;
}

.bn-item {
  flex: 0 0 auto;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  min-width: 68px;
  max-width: 88px;
  border: none;
  background: none;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px 4px 2px;
  font-family: inherit;
  border-radius: var(--radius-sm);
  transition: color var(--transition), transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.bn-item:active {
  transform: scale(0.95);
}

.bn-item i {
  font-size: 22px;
  line-height: 1;
}

.bn-item.on {
  color: var(--green);
}

.bn-item.on i {
  color: var(--green);
}

@media (prefers-color-scheme: dark) {
  .bottom-nav {
    background: rgba(26, 34, 51, 0.92);
    border-top-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
  }
}

/* Greeting */
.greeting { padding: 0 0 10px; }

.greeting h2 {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-900);
}

.greeting p {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 1px;
}

@media (max-width: 768px) {
  .greeting h2 { font-size: 15px; }
}

/* Time filter chips */
.chips {
  display: flex;
  gap: 5px;
  padding: 0 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-wrap: nowrap;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-400);
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition), color var(--transition);
}

.chip.on {
  border-color: var(--green);
  color: var(--green);
  background: transparent;
}

#chip-custom { min-width: 88px; }

#chip-custom.on {
  border-color: var(--green);
  color: var(--green);
  background: transparent;
}

.chip-custom-label {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* KPI stat cards */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 0 12px;
}

.kpi-grid--sales {
  grid-template-columns: repeat(3, 1fr);
}

@media (min-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .kpi-grid--sales { grid-template-columns: repeat(3, 1fr); }
}

.kpi.kpi-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.kpi.kpi-link:hover,
.kpi.kpi-link:active {
  border-color: var(--green-500);
  box-shadow: var(--shadow-md);
}

.kpi-link-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-600);
}

.kpi-link-val .pdf-chev {
  font-size: 12px;
  opacity: 0.85;
}

.kpi {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
}

.kpi .lbl {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 4px;
}

.kpi .val {
  font-size: 20px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.15;
}

.kpi .val.green { color: var(--green); }
.kpi .val.gold { color: var(--amber); }

.kpi .badge {
  display: inline-block;
  margin-top: 3px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.kpi .badge.up {
  background: var(--green-light);
  color: var(--green-dark);
}

.kpi .badge.gold {
  background: var(--amber-light);
  color: #92400e;
}

/* Cards */
.card {
  margin: 0 0 12px;
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-head h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-900);
}

.card-head a {
  color: var(--green);
  font-size: 10px;
  text-decoration: none;
  font-weight: 600;
}

.chart-wrap {
  height: 200px;
  position: relative;
}

.chart-wrap.chart-trend {
  height: 220px;
  min-height: 200px;
}

@media (min-width: 769px) {
  .chart-wrap { height: 150px; }
  .chart-wrap.chart-trend { height: 170px; min-height: 150px; }
}

@media (min-width: 1100px) {
  .chart-wrap { height: 190px; }
  .chart-wrap.chart-trend { height: 210px; }
}

/* Store rows */
.store-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition);
}

.store-row:last-child { margin-bottom: 0; }

.card > .store-row {
  margin-left: -2px;
  margin-right: -2px;
}

.card > .store-row:first-of-type { margin-top: 4px; }

.store-row:hover { box-shadow: var(--shadow-md); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 10px;
  flex-shrink: 0;
}

.store-info { flex: 1; min-width: 0; }

.store-info strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-info small {
  color: var(--gray-400);
  font-size: 9px;
}

.store-right { text-align: right; flex-shrink: 0; }

.store-right .rev {
  font-weight: 700;
  font-size: 13px;
  color: var(--gray-900);
}

.store-right .prof {
  color: var(--green);
  font-size: 10px;
  font-weight: 600;
}

/* Detail / lists */
.detail-header {
  padding: 4px 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-btn {
  display: inline-block;
  background: none;
  border: none;
  color: var(--green);
  font-size: 1rem;
  cursor: pointer;
  padding: 8px 0;
  font-family: inherit;
  text-decoration: none;
}

.detail-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
}

.kpi-scroll {
  display: flex;
  gap: 8px;
  padding: 0 0 12px;
  overflow-x: auto;
}

.kpi-scroll .kpi { min-width: 120px; flex-shrink: 0; }

.row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.85rem;
}

.row-item:last-child { border-bottom: none; }

.row-item .rank {
  width: 22px;
  color: var(--gray-400);
  font-weight: 600;
}

.row-item .meta { flex: 1; padding: 0 8px; min-width: 0; }

.row-item .meta strong { display: block; }

.row-item .meta small {
  color: var(--gray-400);
  font-size: 0.72rem;
}

.row-item .amt {
  font-weight: 600;
  color: var(--green);
}

.pay-bar { margin-bottom: 10px; }

.pay-bar .lbl {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.pay-bar .track {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.pay-bar .fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
}

.range-warn {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.82rem;
  line-height: 1.45;
}

.report-links-card {
  padding: 0 !important;
  overflow: hidden;
}

.report-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  text-align: left;
  transition: background var(--transition);
}

.report-link:last-child { border-bottom: none; }

.report-link:hover,
.report-link:active {
  background: var(--gray-50);
}

.report-link .report-chev {
  color: var(--gray-400);
  flex-shrink: 0;
  margin-left: 12px;
}

.report-link-feature {
  font-weight: 600;
  color: var(--green);
}

/* PDF report links (Sales page) */
.pdf-report-card {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.pdf-report-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-bottom: 1px solid var(--gray-100);
  background: var(--white);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}

.pdf-report-link:last-child {
  border-bottom: none;
}

.pdf-report-link:hover,
.pdf-report-link:active {
  background: var(--green-light);
}

.pdf-report-link .pdf-chev {
  color: var(--gray-400);
  font-weight: 600;
}

.store-logo-img {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
}

.admin-store-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-store-head .store-logo-img {
  width: 44px;
  height: 44px;
  min-width: 44px;
}

.admin-store-head .admin-store-info {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.store-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.store-detail-head h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.store-detail-head .store-logo-img {
  width: 40px;
  height: 40px;
  min-width: 40px;
}

.data-table {
  width: 100%;
  font-size: 0.8rem;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  color: var(--gray-400);
  font-weight: 600;
  font-size: 0.72rem;
  padding: 8px 6px;
  border-bottom: 1px solid var(--gray-200);
}

.data-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--gray-100);
}

.data-table td.num { white-space: nowrap; }

.data-table td.gold { color: var(--amber); }

.table-scroll { overflow-x: auto; }

/* Search / sort */
.search {
  margin: 0 0 12px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.search:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-light);
}

.sort-bar {
  display: flex;
  gap: 6px;
  padding: 0 0 10px;
  overflow-x: auto;
}

.sort-bar button {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-400);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.sort-bar button.on {
  border-color: var(--green);
  color: var(--green);
  background: transparent;
}

/* Sheets */
.sheet-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-bg[hidden] {
  display: none !important;
}

.sheet {
  width: 100%;
  max-width: min(520px, 100%);
  max-height: 70vh;
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.sheet h3 {
  margin-bottom: 12px;
  font-weight: 700;
}

.sheet .store-pick {
  padding: 14px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
}

.sheet .store-pick:hover { background: var(--gray-50); }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--gray-50);
}

.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
}

.login-logo {
  display: block;
  margin: 0 auto 16px;
  object-fit: contain;
  width: 72px;
  height: 72px;
  border-radius: 50%;
}

.login-box h1 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 4px;
  text-align: center;
  color: var(--gray-900);
}

.login-box p {
  text-align: center;
  color: var(--gray-400);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.login-box input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.login-box input:focus {
  outline: none;
  border-color: var(--green);
}

.login-box button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--green);
  color: var(--white);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}

.login-box button:hover { background: var(--green-dark); }

.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray-400);
}

.err {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 8px;
}

.card.err {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

/* Admin */
.admin-stores-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.admin-store-card {
  margin: 0;
  padding: 16px;
}

.admin-empty {
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.admin-store-info { margin-bottom: 0; }

.admin-store-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.admin-store-city {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 4px;
}

.admin-store-meta {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 6px;
}

.admin-store-card .admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-100);
}

@media (min-width: 769px) {
  .admin-store-card .admin-actions {
    grid-template-columns: repeat(4, 1fr);
    border-top: none;
    padding-top: 0;
  }
}

.admin-actions .btn-sm {
  width: 100%;
  padding: 12px 8px;
  font-size: 0.8rem;
  white-space: normal;
  line-height: 1.25;
  text-align: center;
  min-height: 44px;
  cursor: pointer;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
}

.admin-actions .btn-sm.danger {
  grid-column: 1 / -1;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, var(--white));
}

@media (prefers-color-scheme: dark) {
  .admin-store-card .admin-actions {
    border-top-color: rgba(255, 255, 255, 0.08);
  }

  .admin-actions .btn-sm {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text);
  }

  .admin-actions .btn-sm.danger {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
  }
}

.admin-sheet { max-height: 85vh; }

.admin-sheet label {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-400);
  margin: 10px 0 4px;
}

.admin-sheet input {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.admin-sheet .sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.admin-sheet .sheet-actions button {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}

.admin-sheet .btn-primary {
  background: var(--green);
  color: var(--white);
  border: none;
}

.admin-sheet .btn-ghost {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  color: var(--text-sub);
}

.admin-sheet .btn-danger {
  background: #fef2f2;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.admin-account-card,
.admin-server-card {
  margin: 0 0 12px;
  padding: 16px;
}

.admin-account-card .btn-sm {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  background: var(--green);
  color: var(--white);
  border: none;
  cursor: pointer;
}

.admin-server-card .btn-sm.danger {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, var(--white));
  color: var(--danger);
}

@media (prefers-color-scheme: dark) {
  .admin-server-card .btn-sm.danger {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
  }
}

.admin-hint {
  padding: 8px 0 24px;
  color: var(--gray-400);
  font-size: 0.75rem;
  line-height: 1.4;
}

.settings-lock .link-btn {
  margin-top: 16px;
  width: 100%;
  padding: 10px;
  border: none;
  background: none;
  color: var(--text-sub);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}

.pdf-dl-btn {
  width: 100%;
  margin: 14px 0 0;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--green);
  color: var(--white);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
}

.pdf-dl-btn:disabled { opacity: 0.6; }

.receipt { cursor: pointer; align-items: flex-start; }

.receipt-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.receipt-no { font-size: 0.9rem; }

.receipt-ts {
  font-size: 0.82rem;
  color: var(--green);
  font-weight: 600;
}

.receipt-sub {
  color: var(--gray-400);
  font-size: 0.72rem;
}

.receipt .receipt-ts-line {
  display: block;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.stock-row.low {
  background: rgba(220, 38, 38, 0.06);
  margin: 0 -14px;
  padding-left: 14px;
  padding-right: 14px;
  border-radius: 8px;
}

.stock-qty {
  font-weight: 700;
  font-size: 1rem;
  min-width: 36px;
  text-align: right;
}

.stock-qty.warn { color: var(--danger); }

.loading-inline {
  color: var(--gray-400);
  padding: 12px 0;
  font-size: 0.85rem;
}

.data-sync-bar {
  width: 100%;
  font-size: 0.68rem;
  text-align: center;
  padding: 8px 14px;
  color: var(--gray-400);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.data-sync-bar.is-hidden { display: none !important; }

.hidden { display: none !important; }

.card, .kpi, .store-row, .chart-wrap {
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}

.top-bar { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Calendar modal — keep functional; align accent to green */
body.cal-open { overflow: hidden; }

.cal-bg {
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cal-bg.cal-visible { opacity: 1; }

.cal-modal-wrap { width: 100%; max-width: 360px; }

.cal-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-md);
}

.cal-modal .modal-header {
  padding: 18px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-modal .modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.cal-modal .close-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--gray-100);
  border: none;
  cursor: pointer;
  color: var(--gray-400);
}

.cal-modal .date-box {
  flex: 1;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 9px;
  padding: 9px 12px;
}

.cal-modal .date-box.active-input {
  border-color: var(--green);
  background: var(--green-light);
}

.cal-modal .qbtn.active {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green-dark);
}

.cal-modal .day.start,
.cal-modal .day.end {
  background: var(--green) !important;
  color: var(--white) !important;
}

.cal-modal .day.in-range {
  background: var(--green-light);
  color: var(--green-dark);
}

.cal-modal .btn-apply {
  background: var(--green);
  color: var(--white);
  border: none;
}

.cal-modal .day.today::after {
  background: var(--green);
}

/* Finance */
.fin-overview-card,
.fin-config-card {
  padding-bottom: 4px;
}

.fin-context {
  background: color-mix(in srgb, var(--green) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 28%, transparent);
  border-radius: var(--radius-md, 12px);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.fin-ctx-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.fin-ctx-lbl {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.fin-ctx-row strong {
  color: var(--text);
  text-align: right;
}

.fin-ctx-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--text-sub);
  line-height: 1.4;
}

.fin-head-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.fin-cost-badges {
  margin: 4px 0 6px;
}

.fin-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.fin-badge-on {
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--green);
}

.fin-badge-off {
  background: var(--surface, rgba(128, 128, 128, 0.12));
  color: var(--text-muted);
}

.fin-exclude-note {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: var(--gold, #d4a017);
  line-height: 1.35;
}

.fin-card-list-all {
  padding-bottom: 8px;
}

.fin-toolbar-bottom {
  margin-bottom: calc(var(--nav-h, 56px) + 8px);
}

.fin-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (min-width: 900px) {
  .fin-summary-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
  }
}

.fin-stat {
  background: var(--surface-elevated, var(--gray-50));
  border: 1px solid var(--border, var(--gray-200));
  border-radius: var(--radius-md, 10px);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.fin-summary-grid .fin-stat-net {
  grid-column: 1 / -1;
}

@media (min-width: 900px) {
  .fin-summary-grid .fin-stat-net {
    grid-column: auto;
  }
}

.fin-stat span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fin-stat strong {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}

.fin-stat strong.green {
  color: var(--green);
}

.fin-stat strong.gold {
  color: var(--gold, #d4a017);
}

.fin-stat small {
  font-size: 0.72rem;
  color: var(--text-sub);
}

.fin-stat-net {
  border-color: color-mix(in srgb, var(--green) 40%, transparent);
  background: color-mix(in srgb, var(--green) 12%, transparent);
}

.fin-stat-net strong {
  color: var(--green);
}

.fin-stat-loss {
  border-color: color-mix(in srgb, var(--danger, #dc2626) 35%, transparent);
  background: color-mix(in srgb, var(--danger, #dc2626) 10%, transparent);
}

.fin-stat-loss strong {
  color: var(--danger, #f87171);
}

.fin-period-note,
.fin-hint,
.fin-empty {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin: 12px 0 0;
  line-height: 1.45;
}

.fin-viewer-note {
  padding: 0 4px 8px;
}

.fin-toolbar {
  margin: 0 0 12px;
  padding: 0 2px;
}

.fin-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-md, 12px);
  background: var(--green);
  color: var(--white, #fff);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.15));
}

.fin-add-btn:active {
  transform: scale(0.98);
  opacity: 0.95;
}

.fin-add-btn .ti {
  font-size: 1.1rem;
}

.fin-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 0 12px;
}

.fin-cost-card {
  background: var(--surface-elevated, var(--gray-50));
  border: 1px solid var(--border, var(--gray-200));
  border-radius: var(--radius-md, 12px);
  padding: 14px;
}

.fin-cost-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.fin-cost-cat {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.fin-cost-amt {
  font-weight: 800;
  font-size: 1rem;
  color: var(--green);
  text-align: right;
  white-space: nowrap;
}

.fin-cost-amt small {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.fin-cost-store {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.fin-cost-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.fin-cost-meta span {
  white-space: nowrap;
}

.fin-cost-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border, var(--gray-200));
}

.fin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm, 10px);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border, var(--gray-200));
  background: var(--surface, var(--white));
  color: var(--text);
}

.fin-btn-edit {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 35%, transparent);
  background: color-mix(in srgb, var(--green) 8%, transparent);
}

.fin-btn-del {
  color: var(--danger, #dc2626);
  border-color: color-mix(in srgb, var(--danger, #dc2626) 35%, transparent);
  background: color-mix(in srgb, var(--danger, #dc2626) 8%, transparent);
}

.fin-err {
  color: var(--danger, #dc2626);
  font-size: 0.85rem;
  min-height: 1.2em;
}
.sheet textarea {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px;
  font-family: inherit;
}

/* Finance expense form */
.fin-sheet-bg {
  z-index: 250;
  padding: 16px;
  box-sizing: border-box;
}

.fin-sheet {
  max-width: min(440px, 100%);
  width: 100%;
  margin: 0 auto;
  max-height: min(92vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.fin-sheet label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
  margin: 10px 0 4px;
}

.fin-sheet input,
.fin-sheet select,
.fin-sheet textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--white);
}

.fin-sheet .sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.fin-sheet .sheet-actions button {
  flex: 1;
  min-height: 48px;
  padding: 12px;
  border-radius: var(--radius-md, 12px);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}

.fin-sheet .btn-primary {
  background: var(--green);
  color: var(--white, #fff);
  border: none;
}

.fin-sheet .btn-ghost {
  background: var(--surface, var(--gray-50));
  border: 1px solid var(--border, var(--gray-200));
  color: var(--text-sub);
}

@media (min-width: 769px) {
  .fin-sheet-bg {
    align-items: center;
    justify-content: center;
  }

  .fin-sheet {
    border-radius: var(--radius-lg);
    max-height: min(88vh, 720px);
  }
}

.tax-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tax-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.tax-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.tax-year-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: -6px;
}

.tax-year-select {
  min-width: 160px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.tax-bs-list {
  list-style: none;
  margin: 0;
  padding: 0 16px 16px;
}

.tax-bs-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.tax-total-row td {
  background: var(--surface-elevated);
}

.icon-btn.tax-btn {
  color: var(--gold, #d4a017);
}

/* Payroll (from Finance) */
.fin-payroll-wrap {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  box-sizing: border-box;
}

.fin-payroll-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius, 12px);
  border: 1px solid var(--border, var(--gray-200));
  background: var(--surface, var(--white));
  text-decoration: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.04));
}

@media (min-width: 769px) {
  .fin-payroll-wrap {
    margin-bottom: 16px;
  }

  .fin-payroll-link {
    padding: 16px 20px;
    min-height: 56px;
  }

  .fin-payroll-title {
    font-size: 1.05rem;
  }
}

.fin-payroll-link:active {
  opacity: 0.92;
}

.fin-payroll-link .ti-users {
  font-size: 1.5rem;
  color: var(--green);
  flex-shrink: 0;
}

.fin-payroll-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.3;
}

.fin-payroll-link .ti-chevron-right {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 1.25rem;
}

.pay-header {
  margin-bottom: 8px;
}

.pay-summary-grid {
  grid-template-columns: 1fr 1fr;
}

@media (min-width: 900px) {
  .pay-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

.pay-emp-panel .fin-cost-card {
  position: relative;
}

.pay-emp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.pay-emp-identity {
  flex: 1;
  min-width: 0;
}

.pay-emp-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.pay-emp-name-row .fin-cost-cat {
  margin: 0;
}

.pay-emp-role-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 14%, var(--white));
  color: var(--green-dark, var(--green));
  border: 1px solid color-mix(in srgb, var(--green) 35%, transparent);
  white-space: nowrap;
}

.pay-emp-role-pill.pay-emp-role-empty {
  background: var(--gray-100, #f3f4f6);
  color: var(--text-muted);
  border-color: var(--border, var(--gray-200));
  font-weight: 600;
}

.pay-emp-top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.pay-emp-top-right .fin-cost-amt {
  text-align: right;
}

.pay-emp-menu-wrap {
  position: relative;
}

.pay-emp-menu-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border, var(--gray-200));
  border-radius: var(--radius-sm, 10px);
  background: var(--surface, var(--white));
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.pay-emp-menu-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.pay-emp-menu-pop {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 40;
  min-width: 140px;
  margin-top: 4px;
  padding: 4px;
  border-radius: var(--radius-md, 12px);
  border: 1px solid var(--border, var(--gray-200));
  background: var(--surface, var(--white));
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));
}

.pay-emp-menu-pop.open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pay-emp-menu-pop button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.pay-emp-menu-pop button:hover {
  background: var(--gray-50, #f9fafb);
}

.pay-emp-menu-pop .pay-menu-del {
  color: var(--danger, #dc2626);
}

.pay-emp-menu-pop .pay-menu-del:hover {
  background: color-mix(in srgb, var(--danger, #dc2626) 10%, transparent);
}

.pay-voucher-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.pay-month-sel {
  flex: 0 1 auto;
  width: auto;
  min-width: 140px;
  max-width: 200px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: var(--radius-sm, 10px);
  border: 1px solid var(--border, var(--gray-200));
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface, var(--white));
}

.pay-print-btn {
  flex: 0 0 auto;
  width: auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-sm, 10px);
  background: var(--green);
  color: #fff;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.pay-print-btn:active {
  opacity: 0.9;
}

.pay-print-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.pay-emp-inactive {
  opacity: 0.72;
}

.pay-opex-link {
  color: var(--green);
  font-weight: 600;
}

.pay-emp-role {
  color: var(--green);
  font-weight: 600;
}

.fin-badge-role {
  background: color-mix(in srgb, var(--green) 12%, var(--surface, #fff));
  color: var(--green-dark, var(--green));
  border: 1px solid color-mix(in srgb, var(--green) 35%, transparent);
}

/* —— Settings hub —— */
.settings-intro {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--gray-500);
}
.settings-menu {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.settings-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.settings-tile:hover {
  border-color: color-mix(in srgb, var(--green) 45%, var(--gray-200));
  box-shadow: var(--shadow-sm);
}
.settings-tile-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--green) 12%, var(--white));
  color: var(--green-dark, var(--green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}
.settings-tile-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-tile-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--gray-900);
}
.settings-tile-desc {
  font-size: 0.82rem;
  color: var(--gray-500);
}
.settings-tile-chev {
  color: var(--gray-400);
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* —— User settings (polished buttons & layout) —— */
.ua-settings-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 24px;
}

/* Shared button system */
.ua-settings-wrap .ua-btn,
.admin-sheet .ua-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.ua-settings-wrap .ua-btn i {
  font-size: 1.1rem;
  opacity: 0.95;
}
.ua-settings-wrap .ua-btn:active {
  transform: scale(0.98);
}
.ua-settings-wrap .ua-btn-primary {
  background: linear-gradient(180deg, #22c55e 0%, var(--green) 100%);
  color: var(--white);
  border-color: var(--green-dark);
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.25), 0 4px 12px rgba(22, 163, 74, 0.2);
}
.ua-settings-wrap .ua-btn-primary:hover {
  background: linear-gradient(180deg, #16a34a 0%, var(--green-dark) 100%);
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35);
}
.ua-settings-wrap .ua-btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.ua-settings-wrap .ua-btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}
.ua-settings-wrap .ua-btn-ghost {
  background: var(--white);
  color: var(--gray-600);
  border-color: var(--gray-200);
}
.ua-settings-wrap .ua-btn-ghost:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}
.ua-settings-wrap .ua-btn-warning {
  background: #fffbeb;
  color: #b45309;
  border-color: #fcd34d;
}
.ua-settings-wrap .ua-btn-warning:hover {
  background: #fef3c7;
  border-color: #fbbf24;
}
.ua-settings-wrap .ua-btn-success {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}
.ua-settings-wrap .ua-btn-success:hover {
  background: #d1fae5;
}
.ua-settings-wrap .ua-btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}
.ua-settings-wrap .ua-btn-danger:hover {
  background: #fee2e2;
  border-color: #f87171;
}
.ua-settings-wrap .ua-btn-block {
  width: 100%;
}

.admin-sheet .ua-sheet-actions,
.ua-settings-wrap .ua-sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.admin-sheet .ua-sheet-actions .ua-btn,
.ua-settings-wrap .ua-sheet-actions .ua-btn {
  flex: 1;
}

.ua-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--green-light), color-mix(in srgb, var(--green) 25%, var(--white)));
  color: var(--green-dark);
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--green) 25%, transparent);
}
.ua-avatar-lg {
  width: 52px;
  height: 52px;
  font-size: 1.25rem;
  border-radius: 14px;
}

.ua-account-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px !important;
  margin: 0 !important;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.ua-account-main {
  display: flex;
  align-items: center;
  gap: 14px;
}
.ua-account-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gray-900);
}
.ua-account-role {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-top: 2px;
}
.ua-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}
@media (min-width: 560px) {
  .ua-account-actions {
    width: auto;
  }
}
.side-nav .side-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.side-logout {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-700);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  transition: background var(--transition), border-color var(--transition);
}
.side-logout:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

/* —— User management panels —— */
.ua-team-card {
  padding: 18px 20px !important;
  margin: 0 !important;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.ua-panel { padding: 0; }
.ua-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-100);
}
.ua-h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-900);
}
.ua-h3 i {
  color: var(--green);
  font-size: 1.15rem;
}
.ua-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--gray-500);
  max-width: 42rem;
}
.ua-search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 280px;
}
.ua-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 1rem;
  pointer-events: none;
}
.ua-search {
  width: 100%;
  padding: 11px 12px 11px 38px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--gray-50);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.ua-search:focus {
  outline: none;
  border-color: var(--green);
  background: var(--white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}
.ua-create-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 12px;
  align-items: end;
  padding: 16px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, var(--gray-50) 0%, var(--white) 100%);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}
.ua-create-form .ua-create-submit {
  grid-column: 1 / -1;
  margin-top: 4px;
}
@media (min-width: 900px) {
  .ua-create-form {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  }
  .ua-create-form .ua-create-submit {
    grid-column: auto;
    margin-top: 0;
    min-width: 160px;
  }
}
.ua-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ua-field input,
.ua-field select,
.ua-preset-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ua-field input:focus,
.ua-field select:focus,
.ua-preset-select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 15%, transparent);
}
.ua-list { display: grid; gap: 10px; }
.ua-list-rows { gap: 8px; }
.ua-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.ua-user-row:hover {
  border-color: color-mix(in srgb, var(--green) 45%, var(--gray-200));
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.1);
  background: color-mix(in srgb, var(--green) 4%, var(--white));
}
.ua-user-row:active {
  transform: scale(0.995);
}
.ua-user-row-main {
  flex: 1;
  min-width: 0;
}
.ua-user-row-main strong {
  font-size: 1rem;
  margin-right: 6px;
}
.ua-user-row .ua-user-meta {
  margin: 6px 0 0;
}
.ua-row-chev {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--gray-50);
  color: var(--gray-500);
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.ua-user-row:hover .ua-row-chev {
  background: var(--green-light);
  color: var(--green-dark);
}
.ua-detail-page {
  display: grid;
  gap: 14px;
}
.ua-detail-head {
  padding: 20px !important;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.ua-detail-profile {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.ua-detail-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gray-900);
}
.ua-detail-head .ua-user-title {
  flex-wrap: wrap;
  margin-bottom: 0;
}
.ua-detail-head .ua-detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-100);
}
.ua-detail-head .ua-detail-actions .ua-btn {
  width: 100%;
  min-height: 46px;
}
.ua-detail-head .ua-detail-actions .ua-btn-danger {
  grid-column: 1 / -1;
}
@media (min-width: 640px) {
  .ua-detail-head .ua-detail-actions {
    grid-template-columns: repeat(3, 1fr);
  }
  .ua-detail-head .ua-detail-actions .ua-btn-danger {
    grid-column: span 1;
  }
}
.ua-detail-perms {
  padding: 20px !important;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.ua-detail-perms .ua-save-perms {
  margin-top: 20px;
}
.ua-user-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.ua-user-card:hover {
  border-color: color-mix(in srgb, var(--green) 40%, var(--gray-200));
  box-shadow: var(--shadow-sm);
}
.ua-user-off {
  opacity: 0.72;
  background: var(--gray-50);
}
.ua-user-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.ua-user-title strong { font-size: 1rem; }
.ua-user-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--gray-500);
}
.ua-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.ua-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-600);
}
.ua-badge-on { background: #dcfce7; color: #166534; }
.ua-badge-off { background: #fee2e2; color: #991b1b; }
.ua-badge-you { background: #dbeafe; color: #1e40af; }
.ua-role-admin { background: #fef3c7; color: #92400e; }
.ua-role-viewer { background: var(--gray-100); color: var(--gray-600); }
.ua-role-user { background: #e0e7ff; color: #3730a3; }
.ua-modal {
  width: min(580px, 96vw);
  max-height: 90vh;
  overflow: auto;
}
.ua-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.ua-modal-head h3 { margin: 0; }
.ua-preset-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  display: block;
  margin-bottom: 4px;
}
.ua-preset-hint {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin: 0 0 12px;
}
.ua-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 12px 0 6px;
  color: var(--gray-800);
}
.ua-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}
.ua-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-100);
  background: var(--gray-50);
  font-size: 0.88rem;
  color: var(--gray-800);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.ua-check:hover {
  background: var(--white);
  border-color: var(--gray-200);
}
.ua-check:has(input:checked) {
  background: color-mix(in srgb, var(--green) 10%, var(--white));
  border-color: color-mix(in srgb, var(--green) 35%, var(--gray-200));
  color: var(--green-dark);
  font-weight: 600;
}
.ua-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}
.ua-muted { color: var(--gray-500); }
.sheet-lead {
  font-size: 0.88rem;
  color: var(--gray-500);
  margin: 0 0 12px;
}
.hub-toast {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: min(420px, 92vw);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  background: var(--gray-900);
  color: var(--white);
  pointer-events: none;
}
.hub-toast-ok { background: #166534; }
.hub-toast-err { background: #991b1b; }
.desktop-only .hub-toast { bottom: 24px; }

@media (max-width: 900px) {
  .ua-create-form {
    grid-template-columns: 1fr;
  }
  .ua-search-wrap {
    max-width: none;
    width: 100%;
  }
  .ua-account-actions .ua-btn {
    flex: 1;
    min-width: 0;
  }
}
@media (max-width: 768px) {
  .ua-grid { grid-template-columns: 1fr; }
  .ua-detail-head .ua-detail-actions {
    grid-template-columns: 1fr;
  }
  .ua-detail-head .ua-detail-actions .ua-btn-danger {
    grid-column: 1;
  }
}

.pay-allowance-wrap.pay-allowance-hidden {
  display: none;
}

.pay-allowance-wrap {
  margin-bottom: 4px;
}

/* JSD Agro delivery orders */
.agro-list,
.agro-form {
  max-width: 980px;
  margin-inline: auto;
}
.agro-greeting h2 { margin-bottom: 4px; }
.agro-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
a.agro-row,
a.agro-order-card {
  text-decoration: none;
  color: inherit;
}
.agro-list .agro-row { cursor: pointer; display: flex; }
.agro-list .agro-row:hover { background: var(--gray-50); }
a.btn-sm.primary#agro-new { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.agro-toolbar .chip-row {
  display: inline-flex;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}
.agro-toolbar .chip-row .chip {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  padding: 8px 14px;
  line-height: 1;
}
.agro-toolbar .chip-row .chip.on {
  background: #dcfce7;
  color: #166534;
  box-shadow: inset 0 0 0 1px #86efac;
}
.agro-toolbar .btn-sm,
.agro-actions .btn-sm,
.agro-form .btn-sm {
  appearance: none;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  padding: 11px 14px;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.agro-toolbar .btn-sm:active,
.agro-actions .btn-sm:active,
.agro-form .btn-sm:active { transform: translateY(1px); }
.agro-toolbar .btn-sm,
.agro-actions .btn-sm,
.agro-form .btn-sm:not(.primary):not(.danger):not(.agro-btn-ghost) {
  background: #e2e8f0;
  color: #1f2937;
}
.agro-toolbar .btn-sm:hover,
.agro-actions .btn-sm:hover,
.agro-form .btn-sm:not(.primary):not(.danger):not(.agro-btn-ghost):hover { background: #cbd5e1; }
.agro-toolbar .btn-sm.primary,
.agro-actions .btn-sm.primary,
.agro-form .btn-sm.primary {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.3);
}
.agro-toolbar .btn-sm.primary:hover,
.agro-actions .btn-sm.primary:hover,
.agro-form .btn-sm.primary:hover { filter: brightness(0.97); }
.agro-toolbar .btn-sm.danger,
.agro-actions .btn-sm.danger,
.agro-form .btn-sm.danger {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.25);
}
.agro-toolbar .btn-sm.danger:hover,
.agro-actions .btn-sm.danger:hover,
.agro-form .btn-sm.danger:hover { filter: brightness(0.97); }
.agro-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
.agro-badge-pending { background: #fef3c7; color: #92400e; }
.agro-badge-done { background: #d1fae5; color: #065f46; }
.agro-badge-refund { background: #e0e7ff; color: #3730a3; }
.agro-badge-cancel { background: #fee2e2; color: #991b1b; }
.agro-row-due { color: #b45309; font-weight: 700; margin-left: 6px; }
.agro-order-due {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #f59e0b;
  margin-top: 2px;
}
.agro-payment-summary {
  margin-bottom: 14px;
  padding: 14px 16px !important;
}
.agro-payment-summary-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agro-balance-due span,
.agro-balance-due strong { color: #b45309 !important; font-weight: 800; }
.agro-credit-paid span,
.agro-credit-paid strong { color: #047857; }
.agro-customer-due-total {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}
.agro-credit-history {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-muted);
}
.agro-credit-panel { margin-bottom: 14px; padding: 14px 16px !important; }
.agro-credit-panel-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agro-credit-list { display: flex; flex-direction: column; gap: 8px; }
.agro-credit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.agro-credit-name { font-weight: 700; font-size: 16px; grid-column: 1; }
.agro-credit-amt { font-weight: 800; color: #b45309; font-size: 16px; grid-column: 2; grid-row: 1; }
.agro-credit-row small { grid-column: 1 / -1; color: var(--text-muted); font-size: 12px; }

/* Delivery hub — dashboard + sub-nav (separate from main hub orders list) */
.delivery-subnav {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.delivery-subnav-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.delivery-subnav-link.on {
  background: var(--accent);
  color: #052e1f;
}
.delivery-subnav-link:not(.on):hover {
  background: var(--bg);
  color: var(--text);
}
.delivery-greeting h2 { margin-bottom: 4px; }
.delivery-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.delivery-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 640px) {
  .delivery-stats { grid-template-columns: repeat(4, 1fr); }
}
.delivery-stat {
  padding: 14px 12px !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.delivery-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.delivery-stat-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}
.delivery-stat-warn { color: #b45309 !important; }
.delivery-fleet-map-card {
  margin-bottom: 16px;
  padding: 12px !important;
  overflow: hidden;
}
.delivery-fleet-map-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.delivery-fleet-map-head .delivery-section-hint {
  margin-bottom: 0;
}
.delivery-fleet-layer-toggle {
  display: inline-flex;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border, #cbd5e1);
  background: var(--surface, #fff);
  flex-shrink: 0;
}
.delivery-fleet-layer-btn {
  border: none;
  background: transparent;
  color: var(--text-muted, #64748b);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.delivery-fleet-layer-btn.active {
  background: #047857;
  color: #fff;
}
.delivery-fleet-layer-btn:hover:not(.active) {
  background: rgba(4, 120, 87, 0.08);
}
.delivery-fleet-map {
  width: 100%;
  height: min(56vh, 480px);
  min-height: 300px;
  border-radius: 12px;
  border: 2px solid #a7f3d0;
  z-index: 1;
}
.delivery-fleet-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.delivery-fleet-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ecfdf5;
  border: 1px solid #86efac;
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #0f172a);
}
.delivery-fleet-pill-time {
  font-weight: 600;
  color: var(--text-muted, #64748b);
  font-size: 12px;
}
.delivery-fleet-pill-speed {
  font-weight: 700;
  color: #047857;
  font-size: 11px;
}
.delivery-fleet-pill-car {
  width: 22px;
  height: 14px;
  border-radius: 6px 8px 4px 4px;
  background: linear-gradient(135deg, #10b981, #047857);
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}
.delivery-fleet-pill-car::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -3px;
  width: 8px;
  height: 5px;
  background: #ef4444;
  border-radius: 3px 3px 0 0;
}
.delivery-fleet-pill-car::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 3px;
  height: 5px;
  background: rgba(186, 230, 253, 0.95);
  border-radius: 2px;
}
.delivery-driver-marker-wrap {
  background: transparent !important;
  border: none !important;
}
.delivery-driver-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  pointer-events: none;
}
.delivery-driver-tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-bottom: 2px;
  max-width: 140px;
}
.delivery-driver-name {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.96);
  padding: 3px 8px;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
  border: 2px solid color-mix(in srgb, var(--fleet-color, #10b981) 55%, transparent);
}
.delivery-driver-time {
  font-size: 10px;
  font-weight: 700;
  color: #047857;
  background: rgba(255, 255, 255, 0.92);
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.delivery-driver-car {
  position: relative;
  line-height: 0;
  width: 56px;
  height: 80px;
}
.delivery-driver-car-rot {
  position: relative;
  width: 56px;
  height: 80px;
  transform-origin: 28px 68px;
}
.delivery-driver-glow {
  position: absolute;
  left: 50%;
  top: 54px;
  width: 48px;
  height: 20px;
  margin-left: -24px;
  border-radius: 50%;
  background: radial-gradient(
    ellipse,
    color-mix(in srgb, var(--fleet-color, #38bdf8) 75%, transparent) 0%,
    color-mix(in srgb, var(--fleet-color, #38bdf8) 35%, transparent) 50%,
    transparent 72%
  );
  filter: blur(2px);
  pointer-events: none;
}
.delivery-driver-emoji {
  position: relative;
  z-index: 1;
  font-size: 40px;
  line-height: 1;
  text-align: center;
  filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.45));
  user-select: none;
}
.delivery-driver-popup-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  vertical-align: middle;
  border: 2px solid rgba(148, 163, 184, 0.5);
}
.ua-map-color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}
.ua-map-color-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.ua-map-color-btn:hover {
  transform: scale(1.08);
}
.ua-map-color-btn.active {
  border-color: #0f172a;
  transform: scale(1.12);
}
@media (prefers-color-scheme: dark) {
  .ua-map-color-btn.active {
    border-color: #f8fafc;
  }
}
.delivery-driver-popup-pane .leaflet-popup-content-wrapper {
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.28);
}
.delivery-driver-popup-pane .leaflet-popup-content {
  margin: 0;
  min-width: 200px;
}
.delivery-driver-popup-pane .leaflet-popup-tip {
  background: var(--surface, #fff);
}
.delivery-driver-popup {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text, #0f172a);
  background: var(--surface, #fff);
}
.delivery-driver-popup-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text, #0f172a);
}
.delivery-driver-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}
.delivery-driver-popup-row span {
  color: var(--text-muted, #64748b);
}
.delivery-driver-popup-row strong {
  font-weight: 700;
}
.delivery-driver-popup-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-muted, #64748b);
}
@media (prefers-color-scheme: dark) {
  .delivery-fleet-map {
    border-color: #065f46;
  }
  .delivery-fleet-layer-toggle {
    border-color: #334155;
    background: #1e293b;
  }
  .delivery-fleet-layer-btn {
    color: #94a3b8;
  }
  .delivery-fleet-layer-btn.active {
    background: #10b981;
    color: #022c22;
  }
  .delivery-fleet-pill {
    background: #064e3b;
    border-color: #059669;
    color: #ecfdf5;
  }
  .delivery-fleet-pill-time {
    color: #a7f3d0;
  }
  .delivery-fleet-pill-speed {
    color: #6ee7b7;
  }
  .delivery-driver-name {
    color: #ecfdf5;
    background: rgba(15, 23, 42, 0.94);
    border-color: rgba(16, 185, 129, 0.45);
  }
  .delivery-driver-time {
    color: #6ee7b7;
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(16, 185, 129, 0.35);
  }
  .delivery-driver-glow {
    background: radial-gradient(ellipse, rgba(56, 189, 248, 0.7) 0%, rgba(29, 78, 216, 0.3) 50%, transparent 72%);
  }
  .delivery-driver-popup-pane .leaflet-popup-content-wrapper,
  .delivery-driver-popup-pane .leaflet-popup-tip {
    background: #1e293b;
    color: #f1f5f9;
  }
  .delivery-driver-popup {
    background: #1e293b;
    color: #f1f5f9;
  }
  .delivery-driver-popup-title {
    color: #f8fafc;
  }
  .delivery-driver-popup-row {
    border-bottom-color: rgba(148, 163, 184, 0.2);
  }
}
.delivery-section-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.delivery-section-hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-muted);
}
.delivery-credit-list { display: flex; flex-direction: column; gap: 10px; }
.delivery-credit-customer { padding: 0 !important; overflow: hidden; }
.delivery-credit-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: inherit;
}
.delivery-credit-name { font-weight: 700; font-size: 17px; }
.delivery-credit-amt { font-weight: 800; color: #b45309; font-size: 17px; }
.delivery-credit-chev {
  transition: transform 0.2s;
  color: var(--text-muted);
}
.delivery-credit-head.is-open .delivery-credit-chev { transform: rotate(180deg); }
.delivery-credit-orders {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}
.delivery-credit-orders.hidden { display: none; }
.delivery-credit-order-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.delivery-credit-order-row:last-child { border-bottom: none; }
.delivery-credit-order-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.delivery-credit-order-meta strong { color: #b45309; }
.delivery-credit-order-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.delivery-recent-payments h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.delivery-pay-feed {
  margin: 0;
  padding: 0;
  list-style: none;
}
.delivery-pay-feed li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.delivery-pay-feed li:last-child { border-bottom: none; }
.delivery-pay-feed small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.agro-empty { color: var(--text-muted); padding: 12px 0; }
.agro-form .agro-label { display: block; font-weight: 600; margin: 12px 0 6px; font-size: 13px; }
.agro-customer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.agro-add-customer-btn {
  white-space: nowrap;
  padding-inline: 12px !important;
}
.agro-form .agro-label + #agro-prod-search {
  margin-top: 4px;
}
.agro-form #agro-prod-search {
  margin-bottom: 14px;
}
.agro-form #agro-prod-search + .agro-prod-pick {
  margin-top: 4px;
}
.agro-product-search-wrap {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 10px;
  background: #f8fbff;
  margin-bottom: 12px;
}
.agro-selected-wrap {
  border: 2px solid #a7f3d0;
  border-radius: 14px;
  padding: 10px;
  background: #f0fdf4;
  margin-top: 8px;
  margin-bottom: 10px;
}
.agro-selected-title {
  font-size: 13px;
  font-weight: 800;
  color: #065f46;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.agro-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
}
.agro-prod-pick {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 2px;
}
/* Group boxes: no inner scroll — all categories visible */
.agro-prod-pick.agro-prod-pick--groups {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
.agro-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.agro-group-box {
  min-height: 58px;
  border: 1px solid #334155;
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  color: #f8fafc;
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  display: grid;
  align-content: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}
.agro-group-box:hover {
  border-color: #10b981;
  transform: translateY(-1px);
}
.agro-group-name {
  font-weight: 800;
  font-size: 13px;
  line-height: 1.15;
  text-transform: uppercase;
  word-break: break-word;
}
.agro-group-count {
  color: #cbd5e1;
  font-size: 10px;
}
.agro-prod-head {
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  padding: 6px 0 8px;
}
.agro-back-group {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}
.agro-prod-head-title {
  font-weight: 800;
  color: #1f2937;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.agro-prod-group {
  display: grid;
  gap: 8px;
  padding: 2px 0 6px;
}
.agro-prod-group-title {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef2ff;
  color: #1e293b;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
}
.agro-prod-group-title small {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}
.agro-prod-group-body {
  display: grid;
  gap: 8px;
}
.agro-prod-group-body.is-collapsed {
  display: none;
}
.agro-prod-btn {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 14px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.agro-prod-btn:hover {
  border-color: #10b981;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.18);
}
.agro-prod-btn:active { transform: translateY(1px); }
.agro-prod-btn.low-stock {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fffdf7 0%, #fffbeb 100%);
}
.agro-prod-btn.out-stock {
  border-color: #ef4444;
  background: linear-gradient(180deg, #fff5f5 0%, #fee2e2 100%);
}
.agro-prod-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.agro-prod-name {
  font-size: 17px;
  line-height: 1.2;
  color: #0f172a;
}
.agro-prod-code {
  color: #64748b;
  font-size: 12px;
}
.agro-prod-meta {
  display: grid;
  justify-items: end;
  gap: 5px;
}
.agro-prod-qty {
  color: #334155;
  font-weight: 600;
  font-size: 12px;
}
.agro-prod-qty.warn { color: #92400e; }
.agro-prod-qty.danger { color: #b91c1c; font-weight: 800; }
.agro-prod-price {
  font-weight: 800;
  font-size: 18px;
  color: #065f46;
}
.agro-prod-tag {
  color: #7f1d1d;
  font-weight: 700;
  font-size: 11px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 999px;
  padding: 2px 8px;
}
.agro-form {
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(20, 35, 60, 0.06);
  border: 1px solid var(--border);
  padding: 16px;
}
.agro-customer-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.agro-customer-chip {
  border: 1px solid var(--border);
  background: #f8fafc;
}
.agro-btn-ghost {
  background: #f8fafc !important;
  border: 1px dashed var(--border-hi, #cbd5e1) !important;
  color: #334155 !important;
}
.agro-btn-ghost:hover { background: #f1f5f9; }
.agro-line {
  margin-bottom: 10px;
  padding: 14px;
  border: 2px solid #86efac;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}
.agro-line-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.agro-line-head strong {
  font-size: 28px;
  line-height: 1.1;
}
.agro-line-code {
  color: var(--text-muted);
  font-size: 17px;
  font-weight: 600;
}
.agro-line-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}
.agro-line-fields input,
.agro-line-fields select { width: 96px; padding: 8px 9px; font-size: 16px; }
.agro-line-amt { font-weight: 800; min-width: 90px; font-size: 36px; line-height: 1; }
.agro-totals {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  border-radius: 10px;
}
.agro-total-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}
.agro-total-discount span,
.agro-total-discount strong {
  color: #b45309;
}
.agro-total-row.agro-grand { font-size: 1.15rem; color: var(--accent-dark, #047857); }
.agro-save-btn { margin-top: 16px; width: 100%; }
.agro-discount-input {
  margin-top: 4px;
  margin-bottom: 4px;
}
.agro-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.agro-table th, .agro-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.agro-table .num { text-align: right; }
.agro-refund-btn { margin-top: 6px; font-size: 11px !important; padding: 4px 8px !important; }
.agro-refunded-tag { color: var(--danger); display: block; font-size: 11px; }
.agro-payment-options { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.agro-payment-opt { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.agro-payment-split { display: grid; gap: 10px; margin-bottom: 12px; }
.agro-payment-split.hidden { display: none; }
.agro-payment-split label { display: grid; gap: 4px; font-size: 13px; }
.agro-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.agro-done-info { color: var(--accent-dark, #047857); font-weight: 500; }
.agro-driver-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  max-width: 100%;
}
.agro-driver-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.agro-driver-head h2 { margin: 0; font-size: 1.15rem; }
.agro-inner { padding-bottom: 80px; }
.agro-inner-detail { padding-bottom: 140px; }

/* Driver list — mobile cards */
.agro-driver-list-head { margin-bottom: 12px; }
.agro-driver-list-head h2 { font-size: 1.35rem; margin: 0 0 4px; }
.agro-driver-store { color: var(--text-muted); font-size: 14px; margin: 0; }
.agro-driver-filters { margin-bottom: 14px; }
.agro-driver-chips {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  padding: 4px;
}
.agro-driver-chips .chip {
  min-height: 48px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.agro-driver-list { display: flex; flex-direction: column; gap: 10px; }
.agro-order-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
  display: block;
  box-sizing: border-box;
}
.agro-order-card:active { transform: scale(0.99); }
.agro-order-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.agro-order-card-top strong {
  font-size: 18px;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}
.agro-order-card-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.agro-order-amt {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-dark, #047857);
}
.agro-order-date { font-size: 13px; color: var(--text-muted); }

/* Driver detail */
.agro-driver-mode .agro-detail-header .back-btn {
  min-height: 48px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.agro-driver-mode .agro-detail-header h1 {
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 8px 0 6px;
}
.agro-driver-mode .agro-meta { font-size: 15px; }
.agro-line-cards { display: none; }
.agro-table-wrap { display: block; }
.agro-driver-mode .agro-line-cards { display: block; }
.agro-driver-mode .agro-table-wrap { display: none; }
.agro-line-card {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.agro-line-card:last-child { border-bottom: none; }
.agro-line-card-name { font-size: 17px; font-weight: 700; line-height: 1.3; }
.agro-line-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-top: 10px;
}
.agro-line-card-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.agro-line-card-grid span { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.agro-line-card-grid strong { font-size: 16px; }
.agro-notes-card {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--gray-50);
  border: 1px solid var(--border);
}
.agro-notes-card strong { display: block; margin-bottom: 4px; font-size: 13px; }
.agro-notes-card p { margin: 0; font-size: 15px; line-height: 1.4; }
.agro-detail-card { padding: 12px 14px !important; }

/* Sticky bottom actions (driver phone) */
.agro-driver-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
  transform: translateZ(0);
  will-change: transform;
}
.agro-driver-sticky .btn-sm {
  min-height: 52px;
  font-size: 17px;
  font-weight: 700;
  width: 100%;
  justify-content: center;
  border-radius: 12px;
}
.agro-driver-sticky .agro-driver-primary-btn {
  min-height: 56px;
  font-size: 18px;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.35);
}
.agro-driver-sticky .agro-driver-secondary-btn {
  min-height: 46px;
  font-size: 15px;
  background: var(--surface) !important;
  border: 1px solid var(--border-hi) !important;
  color: var(--text) !important;
}

.agro-driver-mode .agro-inner {
  padding: 12px 14px 24px;
  max-width: 520px;
  margin: 0 auto;
}
.agro-driver-mode .agro-inner-detail {
  padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px));
}
.agro-driver-payment {
  margin-bottom: 12px;
  padding: 14px 16px !important;
}
.agro-driver-pay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 15px;
}
.agro-driver-pay-row + .agro-driver-pay-row {
  border-top: 1px solid var(--border);
}
.agro-driver-pay-row strong { font-size: 17px; font-weight: 800; }
.agro-driver-pay-due strong { color: #b45309; }
.agro-driver-pay-note {
  margin: 0;
  font-size: 15px;
  color: var(--text-muted);
}
.agro-meta { color: var(--text-muted); font-size: 14px; }
.agro-notes { margin-top: 12px; font-size: 14px; color: var(--text-muted); }
.agro-hint {
  margin: -4px 0 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.agro-map-section {
  margin-bottom: 14px;
  padding: 0 !important;
  overflow: hidden;
}
.agro-map-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.agro-map-toggle .ti-map-pin { color: var(--green, #16a34a); font-size: 20px; }
.agro-map-toggle span { flex: 1; }
.agro-map-chevron {
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.agro-map-toggle.is-open .agro-map-chevron { transform: rotate(180deg); }
.agro-map-panel {
  padding: 0 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.agro-map-panel.hidden { display: none; }
.agro-map-place {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub, #374151);
  line-height: 1.35;
}
.agro-map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
  padding: 20px 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--gray-50, #f9fafb);
  text-align: center;
}
.agro-map-placeholder .ti-map-pin {
  font-size: 36px;
  color: var(--green, #16a34a);
  opacity: 0.9;
}
.agro-map-placeholder p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}
.agro-map-placeholder-sub { font-size: 12px !important; }
.agro-map-embed {
  width: 100%;
  height: 220px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #e5e7eb;
}
.agro-map-open {
  width: 100%;
  min-height: 52px;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.agro-driver-mode .agro-map-embed { height: 260px; }
.agro-driver-mode .agro-map-toggle { min-height: 52px; }

.agro-backorder-modal-bg {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(2, 6, 23, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
}
.agro-sheet-bg {
  align-items: flex-end;
  padding: 0;
}
.agro-backorder-modal {
  width: min(460px, 96vw);
  background: #fff;
  border-radius: 14px;
  border: 1px solid #fecaca;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.35);
  padding: 16px 16px 14px;
}
.agro-payment-modal {
  background: #1a2233 !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45) !important;
  color: #e5e7eb;
}
.agro-payment-modal h3 {
  margin: 0 0 12px;
  color: #34d399 !important;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
}
.agro-pay-total-line {
  margin: 0 0 14px;
  color: #cbd5e1 !important;
  font-size: 16px;
  line-height: 1.4;
}
.agro-pay-total-line strong { color: #fff; font-size: 1.25rem; }
.agro-payment-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 12px;
}
.agro-pay-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #334155;
  border-radius: 12px;
  background: #1f2940;
  color: #f3f4f6 !important;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.agro-pay-choice:has(input:checked) {
  border-color: #22c55e;
  background: #14532d;
  color: #ecfdf5 !important;
}
.agro-pay-choice input {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: #22c55e;
}
.agro-pay-field {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1 !important;
}
.agro-payment-split .agro-input {
  min-height: 48px;
  font-size: 18px;
}
.agro-pay-actions {
  margin-top: 16px;
  flex-direction: column-reverse;
  gap: 10px;
}
.agro-pay-actions .btn-sm {
  min-height: 52px;
  font-size: 16px;
  font-weight: 700;
  width: 100%;
  justify-content: center;
}
.agro-backorder-modal:not(.agro-payment-modal) h3 {
  margin: 0 0 10px;
  color: #b91c1c;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agro-backorder-modal:not(.agro-payment-modal) p {
  margin: 8px 0;
  color: #334155;
  line-height: 1.4;
}
.agro-backorder-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
@media (max-width: 768px) {
  .agro-sheet-bg .agro-payment-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 900px) {
  .agro-customer-row {
    grid-template-columns: 1fr;
  }
  .agro-add-customer-btn {
    width: 100%;
  }
  .agro-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agro-group-box { min-height: 52px; }
  .agro-group-name { font-size: 12px; }
  .agro-toolbar { align-items: stretch; }
  .agro-toolbar .btn-sm { width: 100%; justify-content: center; }
  .agro-toolbar .chip-row { width: 100%; justify-content: center; }
  .agro-line-fields label {
    display: grid;
    gap: 4px;
    font-size: 12px;
  }
  .agro-prod-btn {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .agro-prod-group-title {
    font-size: 12px;
    padding: 7px 9px;
  }
  .agro-prod-meta {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .agro-prod-name { font-size: 16px; }
  .agro-line-amt {
    width: 100%;
    text-align: right;
    font-size: 15px;
  }
  .agro-backorder-actions {
    flex-direction: column-reverse;
  }
  .agro-backorder-actions .btn-sm {
    width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  .agro-form {
    background: #1a2233;
    border-color: #2a3448;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  }
  .agro-form .agro-label,
  .agro-prod-head-title,
  .agro-prod-name {
    color: #f3f4f6;
  }
  .agro-input {
    background: #1f2940;
    border-color: #2f3b56;
    color: #e5e7eb;
  }
  .agro-input::placeholder { color: #9ca3af; }
  .agro-customer-row .agro-add-customer-btn {
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.28);
  }

  .agro-group-box {
    background: linear-gradient(180deg, #232f47 0%, #1a2233 100%);
    border-color: #3a4558;
    color: #e5e7eb;
  }
  .agro-group-box:hover { border-color: #16a34a; }
  .agro-group-count { color: #aeb8c8; }

  .agro-back-group {
    background: #1f2940;
    border-color: #334155;
    color: #e5e7eb;
  }
  .agro-back-group:hover { background: #26324a; }
  .agro-prod-head {
    background: #1a2233;
    border-bottom: 1px solid #334155;
    margin-bottom: 6px;
  }

  .agro-prod-btn {
    background: linear-gradient(180deg, #1f2a40 0%, #182236 100%);
    border-color: #334155;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  }
  .agro-prod-btn:hover {
    border-color: #22c55e;
    box-shadow: 0 7px 18px rgba(34, 197, 94, 0.22);
  }
  .agro-prod-btn.low-stock {
    border-color: #b45309;
    background: linear-gradient(180deg, #3a2a12 0%, #2b210f 100%);
  }
  .agro-prod-btn.out-stock {
    border-color: #b91c1c;
    background: linear-gradient(180deg, #3f1f24 0%, #2d1619 100%);
  }
  .agro-prod-code { color: #94a3b8; }
  .agro-prod-qty { color: #cbd5e1; }
  .agro-prod-qty.warn { color: #f59e0b; }
  .agro-prod-qty.danger { color: #f87171; }
  .agro-prod-price { color: #34d399; }
  .agro-prod-tag {
    color: #fecaca;
    background: #3f1f24;
    border-color: #7f1d1d;
  }

  .agro-line {
    border-color: #334155;
    background: #1b2438;
  }
  .agro-product-search-wrap {
    background: #0f172a;
    border-color: #334155;
  }
  .agro-selected-wrap {
    background: #0f1f1a;
    border-color: #10b981;
  }
  .agro-selected-title { color: #6ee7b7; }
  .agro-line-head strong,
  .agro-line-amt {
    color: #e5e7eb;
  }
  .agro-line-code { color: #94a3b8; }
  .agro-line-fields label {
    color: #cbd5e1;
    font-weight: 600;
  }
  .agro-line-fields input,
  .agro-line-fields select,
  .agro-form textarea {
    background: #1f2940;
    color: #e5e7eb;
    border: 1px solid #334155;
    border-radius: 8px;
  }
  .agro-line-fields input:focus,
  .agro-form textarea:focus,
  .agro-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
  }
  .agro-btn-ghost {
    background: #1f2940 !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
  }
  .agro-btn-ghost:hover { background: #26324a !important; }

  .agro-totals {
    border-top-color: #334155;
    background: #182236;
    padding: 12px;
  }
  .agro-total-row span { color: #cbd5e1; }
  .agro-total-row strong { color: #f3f4f6; }
  .agro-total-discount span,
  .agro-total-discount strong { color: #f59e0b; }
  .agro-total-row.agro-grand span,
  .agro-total-row.agro-grand strong { color: #34d399; }

  .agro-toolbar .chip-row {
    background: #1f2940;
    border-color: #334155;
  }
  .agro-toolbar .chip-row .chip {
    color: #9ca3af;
  }
  .agro-toolbar .chip-row .chip.on {
    background: #14532d;
    color: #86efac;
    box-shadow: inset 0 0 0 1px #166534;
  }

  .agro-driver-shell .agro-driver-head {
    background: #1a2233;
    border-color: #2a3448;
  }
  .agro-driver-shell .agro-driver-head h2 { color: #f3f4f6; }
  .agro-order-card {
    background: #1a2233;
    border-color: #334155;
  }
  .agro-order-card-top strong { color: #f3f4f6; }
  .agro-order-amt { color: #34d399; }
  .agro-line-card { border-color: #334155; }
  .agro-line-card-name { color: #f3f4f6; }
  .agro-line-card-grid strong { color: #e5e7eb; }
  .agro-notes-card {
    background: #1f2940;
    border-color: #334155;
  }
  .agro-notes-card p { color: #cbd5e1; }
  .agro-detail-card {
    background: #1a2233 !important;
    border-color: #334155 !important;
  }
  .agro-driver-list-head h2 { color: #f3f4f6; }
  .agro-driver-payment { background: #1a2233 !important; border: 1px solid #334155; }
  .agro-driver-pay-row + .agro-driver-pay-row { border-color: #334155; }
  .agro-driver-sticky {
    background: rgba(15, 20, 25, 0.94);
    border-top-color: #334155;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.5);
  }
  .agro-driver-sticky .agro-driver-secondary-btn {
    background: #1f2940 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
  }
  .agro-map-section {
    background: #1a2233 !important;
    border-color: #334155 !important;
  }
  .agro-map-toggle { color: #f3f4f6; }
  .agro-hint { color: #94a3b8; }
  .agro-map-embed { border-color: #334155; background: #0f1419; }
  .agro-map-place { color: #cbd5e1; }
  .agro-map-placeholder {
    background: #1f2940;
    border-color: #475569;
  }
  .agro-map-placeholder p { color: #94a3b8; }
  .agro-payment-summary,
  .agro-credit-panel { background: #1a2233 !important; border-color: #334155 !important; }
  .agro-credit-row { background: #1f2940; border-color: #334155; }
  .delivery-subnav { background: #1a2233; border-color: #334155; }
  .delivery-subnav-link:not(.on) { color: #94a3b8; }
  .delivery-subnav-link:not(.on):hover { background: #243044; color: #e8edf4; }
  .delivery-credit-customer { background: #1a2233 !important; border-color: #334155 !important; }
  .delivery-credit-orders { border-color: #334155; }
  .delivery-credit-order-row { border-color: #334155; }
  .delivery-pay-feed li { border-color: #334155; }
  .agro-customer-due-total { border-color: #334155; color: #94a3b8; }
}
