/* ════════════════════════════════════════════════════════════════════
 * Enterprise Dashboard Theme — Exact Match v3
 * Based on Screenshot (114).png — gold accent dark theme
 * CSS-ONLY — zero .tsx changes
 * ════════════════════════════════════════════════════════════════════ */
:root {
  --d-bg: #0F0F0F;
  --d-sidebar: #141414;
  --d-card: #1A1A1A;
  --d-card-h: #1F1F1F;
  --d-border: #2A2A2A;
  --d-border-l: #252525;
  --d-header: #222222;
  --d-gold: #D4A017;
  --d-gold-tint: rgba(212,160,23,0.15);
  --d-gold-fill: rgba(212,160,23,0.08);
  --d-green: #10B981;
  --d-green-bg: #064E3B;
  --d-green-tx: #34D399;
  --d-amber: #F59E0B;
  --d-amber-bg: #451A03;
  --d-amber-tx: #FBBF24;
  --d-blue-bg: #1E3A5F;
  --d-blue-tx: #60A5FA;
  --d-gray-bg: #1F2937;
  --d-gray-tx: #9CA3AF;
  --d-text: #FFFFFF;
  --d-text-2: #E5E5E5;
  --d-text-3: #9CA3AF;
  --d-text-4: #6B7280;
  --d-text-5: #4B5563;
}

/* Background */
body, html {
  background: var(--d-bg) !important;
  font-family: 'Inter', -apple-system, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  color: var(--d-text-2) !important;
}

/* Numbers */
.nums, [class*="font-mono"] {
  font-variant-numeric: tabular-nums !important;
  letter-spacing: -0.02em !important;
}

/* Cards */
[class*="rounded-xl"], [class*="rounded-lg"], .card,
[class*="bg-white"], [class*="dark:bg-ink-900"], [class*="dark:bg-ink-800"] {
  background: var(--d-card) !important;
  border: 1px solid var(--d-border-l) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}
[class*="rounded-xl"]:hover, .card:hover {
  background: var(--d-card-h) !important;
  border-color: var(--d-border) !important;
}

/* Buttons — gold primary */
.btn-primary, button[class*="bg-cargo"], button[class*="bg-cocoa"],
button[class*="bg-success"], button[class*="bg-emerald"] {
  background: var(--d-gold) !important;
  color: #000 !important;
  border: none !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  padding: 8px 16px !important;
}
.btn-primary:hover { background: #E5B33B !important; }

/* Secondary buttons */
.btn-secondary, button[class*="bg-ink-100"], button[class*="dark:bg-ink-800"] {
  background: var(--d-gray-bg) !important;
  color: var(--d-text) !important;
  border: 1px solid var(--d-border) !important;
  border-radius: 6px !important;
  font-weight: 500 !important;
}
.btn-secondary:hover { background: #374151 !important; }

/* Inputs */
.input, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="date"],
input[type="datetime-local"], select, textarea {
  background: var(--d-card) !important;
  border: 1px solid var(--d-border) !important;
  border-radius: 8px !important;
  color: var(--d-text) !important;
  font-size: 14px !important;
  padding: 10px 14px !important;
}
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--d-gold) !important;
  box-shadow: 0 0 0 2px var(--d-gold-tint) !important;
  outline: none !important;
}
.input::placeholder { color: var(--d-text-4) !important; }

/* Tables */
.data-table thead th, table thead th {
  background: var(--d-header) !important;
  color: var(--d-text-3) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 12px 16px !important;
  border-bottom: 1px solid var(--d-border-l) !important;
}
.data-table tbody td, table tbody td {
  padding: 12px 16px !important;
  border-bottom: 1px solid var(--d-border-l) !important;
  color: var(--d-text-2) !important;
  font-size: 13.5px !important;
}
.data-table tbody tr:hover, table tbody tr:hover {
  background: var(--d-header) !important;
}

/* Status pills */
.pill, [class*="StatusPill"], span[class*="rounded-full"][class*="text-"] {
  border-radius: 9999px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  padding: 4px 12px !important;
  border: none !important;
}
[class*="bg-success"], [class*="bg-green"], [class*="tone="] {
  background: var(--d-green-bg) !important;
  color: var(--d-green-tx) !important;
}
[class*="bg-warning"], [class*="bg-amber"] {
  background: var(--d-amber-bg) !important;
  color: var(--d-amber-tx) !important;
}
[class*="bg-danger"], [class*="bg-red"] {
  background: rgba(239,68,68,0.15) !important;
  color: #F87171 !important;
}
[class*="bg-info"], [class*="bg-blue"] {
  background: var(--d-blue-bg) !important;
  color: var(--d-blue-tx) !important;
}

/* Text colors */
h1,h2,h3,h4,h5,h6 { color: var(--d-text) !important; }
[class*="text-ink-900"], [class*="dark:text-ink-50"] { color: var(--d-text) !important; }
[class*="text-ink-700"], [class*="dark:text-ink-300"] { color: var(--d-text-3) !important; }
[class*="text-ink-500"], [class*="dark:text-ink-400"] { color: var(--d-text-4) !important; }
a, [class*="text-cargo"], [class*="text-cocoa"] { color: var(--d-gold) !important; }

/* KPI cards */
.ui-metric-tile {
  background: var(--d-card) !important;
  border: 1px solid var(--d-border-l) !important;
  border-radius: 12px !important;
  padding: 20px !important;
  min-height: 100px !important;
}

/* Badges */
[class*="rounded-full"][class*="font-semibold"][class*="bg-"],
[class*="rounded-full"][class*="font-bold"][class*="bg-"] {
  background: var(--d-gray-bg) !important;
  color: var(--d-text) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  min-width: 18px !important;
  height: 18px !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Empty states */
[class*="EmptyState"] {
  border: 2px dashed var(--d-border-l) !important;
  border-radius: 12px !important;
  background: transparent !important;
  padding: 40px 20px !important;
}

/* Alerts */
[class*="Alert"] {
  border-radius: 6px !important;
  border: 1px solid var(--d-border) !important;
  background: var(--d-card) !important;
}

/* Spinner */
[class*="animate-spin"], [class*="Spinner"] {
  border-color: var(--d-border) !important;
  border-top-color: var(--d-gold) !important;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--d-border); border-radius: 3px; }

/* CopilotWidget */
[class*="fixed"][class*="bottom-"][class*="right-"][class*="z-50"] {
  border-radius: 12px !important;
  border: 1px solid var(--d-border) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
}

/* Mobile */
@media (max-width: 768px) {
  body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  button, .input, select { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ════════════════════════════════════════════════════════════════════
 * ENTERPRISE MOBILE UX — Top 0.1% Mobile Design
 * ════════════════════════════════════════════════════════════════════ */

/* ─── Mobile Bottom Navigation (enterprise-grade) ──────────────────── */
@media (max-width: 768px) {
  /* Bottom nav — dark, 5 items, 56px height + safe-area */
  .ent-bottomnav,
  nav[class*="bottomnav"],
  nav[class*="fixed"][class*="bottom-0"] {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 40 !important;
    background: #0C0C0E !important;
    border-top: 1px solid rgba(255,255,255,0.06) !important;
    display: flex !important;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom)) !important;
    height: auto !important;
    min-height: 56px !important;
    backdrop-filter: blur(12px) !important;
  }

  .ent-bottomnav-item,
  nav[class*="bottomnav"] > *,
  nav[class*="fixed"][class*="bottom-0"] > * {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    padding: 6px 4px !important;
    min-height: 48px !important;
    color: #6B6B70 !important;
    cursor: pointer !important;
    transition: color 0.15s ease !important;
    position: relative !important;
    text-decoration: none !important;
  }

  .ent-bottomnav-item.active,
  nav[class*="bottomnav"] .active {
    color: #D4A017 !important;
  }

  .ent-bottomnav-item.active::before,
  nav[class*="bottomnav"] .active::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 32px !important;
    height: 3px !important;
    border-radius: 0 0 3px 3px !important;
    background: #D4A017 !important;
  }

  /* ─── Sticky header for mobile ───────────────────────────────────── */
  [class*="sticky"], [class*="fixed"][class*="top-0"] {
    position: sticky !important;
    top: 0 !important;
    z-index: 30 !important;
    background: rgba(15,15,15,0.95) !important;
    backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
    padding-top: calc(8px + env(safe-area-inset-top)) !important;
  }

  /* ─── Cards: full width, less padding on mobile ─────────────────── */
  [class*="rounded-xl"], [class*="rounded-lg"], .card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px !important;
    border-radius: 14px !important;
    margin-bottom: 12px !important;
  }

  /* ─── KPI cards: 2-column grid on mobile ────────────────────────── */
  [class*="grid"][class*="grid-cols-"],
  [class*="grid-cols-4"], [class*="grid-cols-6"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* ─── Touch targets: minimum 44px ────────────────────────────────── */
  button, .btn-primary, .btn-secondary, a[class*="btn"],
  [class*="rounded-full"][class*="cursor-pointer"],
  [role="tab"], .segmented-tabs button {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 10px 16px !important;
  }

  /* ─── Inputs: full width, 44px height ────────────────────────────── */
  .input, input[type="text"], input[type="email"], input[type="tel"],
  input[type="password"], select, textarea {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 16px !important; /* prevents iOS zoom */
    padding: 10px 14px !important;
  }

  /* ─── Tables → Cards on mobile ───────────────────────────────────── */
  .data-table, table[class*="w-full"] {
    display: block !important;
  }
  .data-table thead, table thead {
    display: none !important;
  }
  .data-table tbody, table tbody {
    display: block !important;
  }
  .data-table tr, table tr {
    display: flex !important;
    flex-direction: column !important;
    background: #1A1A1A !important;
    border: 1px solid #252525 !important;
    border-radius: 12px !important;
    padding: 16px !important;
    margin-bottom: 12px !important;
  }
  .data-table td, table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 6px 0 !important;
    border: none !important;
    text-align: right !important;
    font-size: 13px !important;
  }
  .data-table td::before, table td::before {
    content: attr(data-label) !important;
    font-weight: 600 !important;
    text-align: left !important;
    padding-right: 12px !important;
    color: #6B7280 !important;
    text-transform: uppercase !important;
    font-size: 11px !important;
    letter-spacing: 0.05em !important;
  }

  /* ─── SegmentedTabs: horizontal scroll, no scrollbar ──────────────── */
  [class*="segmented-tabs"], [class*="overflow-x-auto"] {
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  [class*="segmented-tabs"]::-webkit-scrollbar,
  [class*="overflow-x-auto"]::-webkit-scrollbar {
    display: none !important;
  }

  /* ─── CopilotWidget: full screen on mobile ───────────────────────── */
  [class*="fixed"][class*="bottom-"][class*="right-"][class*="z-50"] {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 60 !important;
  }

  /* ─── Content area: no left margin on mobile ─────────────────────── */
  #admin-main-content,
  #farmer-main-content,
  #agent-main-content,
  #finance-main-content {
    margin-left: 0 !important;
    padding: 16px !important;
    padding-bottom: 80px !important; /* space for bottom nav */
  }

  /* ─── Text sizes: slightly smaller on mobile ─────────────────────── */
  h1 { font-size: 22px !important; }
  h2 { font-size: 18px !important; }
  h3 { font-size: 15px !important; }
  p, span, div { font-size: 14px !important; }
  [class*="text-2xs"] { font-size: 10px !important; }
  [class*="text-xs"] { font-size: 12px !important; }
  [class*="text-sm"] { font-size: 13px !important; }

  /* ─── Safe area insets ────────────────────────────────────────────── */
  body {
    padding-top: env(safe-area-inset-top) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
  }

  /* ─── Hamburger toggle button styling ────────────────────────────── */
  button[style*="position:fixed"][style*="top:12px"][style*="left:12px"] {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    background: rgba(15,15,15,0.9) !important;
    backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
    z-index: 42 !important;
  }

  /* ─── Sheet/Modal: full height on mobile ─────────────────────────── */
  .sheet, [class*="sheet"]:not([class*="backdrop"]):not([class*="profile-sheet"]) {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-height: 92vh !important;
    border-radius: 20px 20px 0 0 !important;
    background: #1A1A1A !important;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.4) !important;
  }

  /* ─── Sidebar: slide-in overlay on mobile ─────────────────────────── */
  .ed-sidebar, aside[class*="ed-sidebar"] {
    position: fixed !important;
    width: 280px !important;
    max-width: 85vw !important;
    transform: translateX(-100%) !important;
    z-index: 50 !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3) !important;
  }
  .ed-sidebar[style*="translateX(0)"],
  aside[class*="ed-sidebar"][style*="translateX(0)"] {
    transform: translateX(0) !important;
  }

  /* ─── Loading overlay: mobile-optimized ───────────────────────────── */
  #ed-loading-overlay {
    padding: 20px !important;
  }
  #ed-loading-overlay .ed-skeleton-sidebar {
    display: none !important;
  }
  #ed-loading-overlay .ed-skeleton-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ─── Tablet (768px - 1024px): 3-column KPI grid ────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  [class*="grid-cols-4"], [class*="grid-cols-6"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   v8.0 — SYSTEM-WIDE AGRIOPS MOBILE PARITY
   Applies the Admin mobile visual contract to every protected non-admin
   workspace while leaving desktop and the Admin React-native mobile shell
   untouched. This is intentionally additive and scoped to the injector's
   runtime body class to prevent leakage into login/public routes.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body.ed-mobile-portal-active {
    --edm-bg:#0a0d14;
    --edm-surface:#121726;
    --edm-surface-2:#171c30;
    --edm-line:#1f2540;
    --edm-line-2:#262d4a;
    --edm-text:#e8ecf6;
    --edm-text-2:#a3aac4;
    --edm-text-3:#6b7290;
    --edm-accent:#f59e0b;
    --edm-accent-soft:rgba(245,158,11,.14);
    background:var(--edm-bg) !important;
    color:var(--edm-text) !important;
    overflow-x:hidden !important;
  }

  /* The old three-line floating control is gone system-wide. The only
     injected mobile entry point is the labelled workspace selector. */
  body.ed-mobile-portal-active button[style*="position:fixed"][style*="top:12px"][style*="left:12px"]:not(.ed-mobile-workspace-trigger),
  body.ed-mobile-portal-active .ent-sidebar-toggle,
  body.ed-mobile-portal-active .enterprise-sidebar-toggle {
    display:none !important;
    visibility:hidden !important;
    pointer-events:none !important;
  }

  .ed-mobile-workspace-trigger {
    font-family:Inter,"Segoe UI",system-ui,sans-serif !important;
    backdrop-filter:saturate(140%) blur(16px);
    -webkit-backdrop-filter:saturate(140%) blur(16px);
  }
  .ed-mobile-workspace-trigger .ed-workspace-mark {
    width:22px;height:22px;border-radius:6px;display:grid;place-items:center;
    flex:0 0 22px;background:#0e152a;border:1px solid var(--edm-line-2);
    color:var(--edm-accent);font-size:10px;font-weight:800;text-transform:uppercase;
  }
  .ed-mobile-workspace-trigger .ed-workspace-copy {
    min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:1px;
  }
  .ed-mobile-workspace-trigger .ed-workspace-copy small {
    font:500 8.5px/1.1 "SF Mono",Consolas,monospace !important;
    letter-spacing:.11em;color:var(--edm-text-3) !important;
  }
  .ed-mobile-workspace-trigger .ed-workspace-copy strong {
    display:block;max-width:142px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
    font:600 11.5px/1.25 Inter,"Segoe UI",system-ui,sans-serif !important;color:#fff !important;
  }
  .ed-mobile-workspace-trigger .ed-workspace-chevron { color:var(--edm-text-3);flex:0 0 auto; }

  /* Reserve a real app-bar lane for the workspace selector so content never
     starts beneath it. Existing portal headers remain functional below it. */
  body.ed-mobile-portal-active .ed-mobile-main-v8 {
    width:100% !important;max-width:none !important;margin:0 !important;
    padding-left:16px !important;padding-right:16px !important;
    padding-top:calc(68px + env(safe-area-inset-top,0px)) !important;
    padding-bottom:calc(92px + env(safe-area-inset-bottom,0px)) !important;
    overflow-x:hidden !important;
  }

  /* Drawer = the same dark command-center language as Admin. */
  body.ed-mobile-portal-active .ed-sidebar {
    width:min(86vw,340px) !important;max-width:340px !important;
    background:linear-gradient(180deg,#0c1020 0%,#0a0d18 100%) !important;
    border-right:1px solid var(--edm-line) !important;
    box-shadow:16px 0 42px rgba(0,0,0,.52) !important;
    padding-top:env(safe-area-inset-top,0px) !important;
  }
  body.ed-mobile-portal-active .ed-sidebar > div:first-child {
    min-height:64px !important;padding:14px 14px !important;border-bottom:1px solid var(--edm-line) !important;
  }
  body.ed-mobile-portal-active .ed-sidebar input.ed-search-input {
    min-height:44px !important;background:#0f1428 !important;border:1px solid var(--edm-line) !important;
    border-radius:10px !important;color:var(--edm-text) !important;font-size:16px !important;
  }
  body.ed-mobile-portal-active .ed-sidebar nav { padding:6px 10px 10px !important; }
  body.ed-mobile-portal-active .ed-sidebar .ed-group-label {
    color:var(--edm-text-3) !important;font-size:10px !important;letter-spacing:.13em !important;
  }
  body.ed-mobile-portal-active .ed-sidebar .ed-nav-item {
    min-height:44px !important;border-radius:10px !important;margin-bottom:2px !important;
    font-size:13px !important;padding:9px 10px !important;
  }
  body.ed-mobile-portal-active .ed-sidebar .ed-nav-item[style*="D4A017"] {
    background:linear-gradient(90deg,rgba(245,158,11,.12),rgba(245,158,11,.02)) !important;
  }
  body.ed-mobile-portal-active .ed-sidebar-footer-v8 {
    margin-top:auto !important;padding:12px 14px calc(12px + env(safe-area-inset-bottom,0px)) !important;
    background:#0b0f1c !important;border-top:1px solid var(--edm-line) !important;
  }
  body.ed-mobile-portal-active .ed-mobile-logout {
    appearance:none;flex:0 0 auto;min-height:40px !important;padding:0 10px !important;
    display:inline-flex !important;align-items:center;justify-content:center;gap:6px;
    border-radius:10px;border:1px solid rgba(248,113,113,.28) !important;
    background:rgba(248,113,113,.08) !important;color:#fca5a5 !important;
    font:600 11px/1 Inter,"Segoe UI",system-ui,sans-serif !important;cursor:pointer;
  }
  body.ed-mobile-portal-active .ed-mobile-logout:focus-visible {
    outline:2px solid rgba(248,113,113,.72);outline-offset:2px;
  }
  body.ed-mobile-portal-active .ed-mobile-logout:disabled { opacity:.55;cursor:wait; }

  /* Hide every legacy/native tab strip once the audited drawer is active.
     The same original tab buttons remain in the DOM and are what the drawer
     invokes, so mobile and desktop can never drift to different targets. */
  body.ed-mobile-portal-active [role="tablist"],
  body.ed-mobile-portal-active .segmented-tabs,
  body.ed-mobile-portal-active [class*="overflow-x-auto"][class*="no-scrollbar"]:has(button[role="tab"]) {
    display:none !important;
  }

  /* Consistent panel hierarchy across every tab of every protected portal. */
  body.ed-mobile-portal-active .card,
  body.ed-mobile-portal-active .surface,
  body.ed-mobile-portal-active .surface-elevated,
  body.ed-mobile-portal-active [class*="rounded-xl"][class*="border"],
  body.ed-mobile-portal-active [class*="rounded-2xl"][class*="border"] {
    background:linear-gradient(180deg,#121830,#0f1428) !important;
    border-color:var(--edm-line) !important;
    box-shadow:0 1px 0 rgba(255,255,255,.025) inset,0 10px 28px rgba(0,0,0,.28) !important;
  }

  body.ed-mobile-portal-active h1 { font-size:24px !important;line-height:1.12 !important;letter-spacing:-.02em !important;color:#fff !important; }
  body.ed-mobile-portal-active h2 { font-size:18px !important;line-height:1.2 !important;color:#fff !important; }
  body.ed-mobile-portal-active h3 { font-size:14px !important;line-height:1.25 !important;color:#fff !important; }
  body.ed-mobile-portal-active p { line-height:1.5 !important; }

  /* One-column first. Small KPI blocks may remain two-up, never 3–6 cramped. */
  body.ed-mobile-portal-active .ed-mobile-main-v8 [class*="grid-cols-3"],
  body.ed-mobile-portal-active .ed-mobile-main-v8 [class*="grid-cols-4"],
  body.ed-mobile-portal-active .ed-mobile-main-v8 [class*="grid-cols-5"],
  body.ed-mobile-portal-active .ed-mobile-main-v8 [class*="grid-cols-6"] {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:10px !important;
  }
  body.ed-mobile-portal-active .ed-mobile-main-v8 [class*="md:grid-cols"],
  body.ed-mobile-portal-active .ed-mobile-main-v8 [class*="lg:grid-cols"] {
    min-width:0;
  }

  /* Form/control contract: no iOS zoom, no clipped actions, full-width filters. */
  body.ed-mobile-portal-active input,
  body.ed-mobile-portal-active select,
  body.ed-mobile-portal-active textarea {
    min-width:0 !important;max-width:100% !important;font-size:16px !important;
    border-radius:10px !important;
  }
  body.ed-mobile-portal-active button,
  body.ed-mobile-portal-active [role="button"] { min-height:44px;touch-action:manipulation; }
  body.ed-mobile-portal-active form [class*="flex"] { min-width:0; }

  /* Data views: preserve semantics and functionality, but guarantee a bounded
     viewport. We intentionally do not globally convert rows into cards/lists;
     portal-specific tables keep their own information density. */
  body.ed-mobile-portal-active .data-table,
  body.ed-mobile-portal-active table {
    width:100% !important;max-width:100% !important;font-size:12px !important;
  }
  body.ed-mobile-portal-active table th,
  body.ed-mobile-portal-active table td { padding:10px 9px !important;vertical-align:middle !important; }
  body.ed-mobile-portal-active .ed-mobile-main-v8 .overflow-x-auto:has(table),
  body.ed-mobile-portal-active .ed-mobile-main-v8 [class*="overflow-x-auto"]:has(table) {
    display:block !important;width:100% !important;max-width:100% !important;
    overflow-x:auto !important;-webkit-overflow-scrolling:touch !important;
    border-radius:12px;
  }

  /* Maps/charts cannot force the page wider than the device. */
  body.ed-mobile-portal-active .leaflet-container,
  body.ed-mobile-portal-active svg,
  body.ed-mobile-portal-active canvas,
  body.ed-mobile-portal-active [class*="recharts"] {
    max-width:100% !important;
  }
  body.ed-mobile-portal-active .leaflet-container { min-height:280px; }

  /* Dialog/sheet parity. */
  body.ed-mobile-portal-active [role="dialog"] {
    max-width:calc(100vw - 24px) !important;max-height:88dvh !important;overflow-y:auto !important;
  }

  /* Existing portal top headers can remain as status/action bars, but any
     built-in mobile hamburger/menu control is suppressed to prevent duplicates. */
  body.ed-mobile-portal-active header button[aria-label*="menu" i],
  body.ed-mobile-portal-active header button[title*="menu" i] {
    display:none !important;
  }
}

/* ════════════════════════════════════════════════════════════════════
 * ENTERPRISE DESKTOP UX v9 — unified protected-workspace shell
 * Desktop-only. Mobile rules above remain authoritative below 769px.
 * ════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  body.ed-enterprise-shell {
    --ed-desk-bg: #0a0d14;
    --ed-desk-surface: #101522;
    --ed-desk-surface-2: #141a2a;
    --ed-desk-elevated: #181f31;
    --ed-desk-border: #222b40;
    --ed-desk-border-strong: #2d3852;
    --ed-desk-text: #f4f6fb;
    --ed-desk-muted: #9ca6bf;
    --ed-desk-subtle: #69738e;
    --ed-desk-accent: #f59e0b;
    --ed-desk-accent-hover: #fbbf24;
    --ed-desk-accent-soft: rgba(245,158,11,.11);
    --ed-desk-focus: rgba(245,158,11,.22);
    --ed-desk-success: #34d399;
    --ed-desk-danger: #f87171;
    --ed-desk-info: #7dd3fc;
    --ed-desk-radius: 12px;
    --ed-desk-radius-lg: 16px;
    --ed-desk-shadow: 0 1px 0 rgba(255,255,255,.025) inset, 0 10px 28px rgba(0,0,0,.22);
    background: var(--ed-desk-bg) !important;
    color: var(--ed-desk-text) !important;
  }

  body.ed-enterprise-shell #root,
  body.ed-enterprise-shell [class*="min-h-screen"] {
    background: var(--ed-desk-bg) !important;
  }

  /* Sidebar: one visual/navigation contract for every protected workspace. */
  body.ed-enterprise-shell .ed-sidebar {
    width: 288px !important;
    background: linear-gradient(180deg,#0d111b 0%,#090c13 100%) !important;
    border-right: 1px solid var(--ed-desk-border) !important;
    box-shadow: 12px 0 36px rgba(0,0,0,.18) !important;
    scrollbar-gutter: stable;
  }
  body.ed-enterprise-shell .ed-sidebar[data-collapsed="true"] { width:72px !important; }
  body.ed-enterprise-shell .ed-sidebar > div:first-child {
    min-height: 72px !important;
    padding: 16px 14px !important;
    background: rgba(255,255,255,.012) !important;
    border-bottom: 1px solid var(--ed-desk-border) !important;
  }
  body.ed-enterprise-shell .ed-collapse-btn {
    width: 34px !important; height: 34px !important;
    border: 1px solid rgba(245,158,11,.5) !important;
    background: var(--ed-desk-accent-soft) !important;
    border-radius: 10px !important;
    transition: background .15s ease,border-color .15s ease,transform .15s ease !important;
  }
  body.ed-enterprise-shell .ed-collapse-btn:hover {
    background: rgba(245,158,11,.18) !important;
    border-color: var(--ed-desk-accent) !important;
    transform: translateY(-1px);
  }
  body.ed-enterprise-shell .ed-search-wrap { padding: 12px 14px 8px !important; }
  body.ed-enterprise-shell .ed-search-input {
    height: 38px !important;
    background: #0c111d !important;
    border: 1px solid var(--ed-desk-border) !important;
    border-radius: 9px !important;
    color: var(--ed-desk-text) !important;
    padding: 0 12px !important;
    font-size: 12.5px !important;
    box-shadow: none !important;
  }
  body.ed-enterprise-shell .ed-search-input:focus {
    border-color: rgba(245,158,11,.72) !important;
    box-shadow: 0 0 0 3px var(--ed-desk-focus) !important;
  }
  body.ed-enterprise-shell .ed-sidebar nav { padding: 4px 10px 12px !important; }
  body.ed-enterprise-shell .ed-group-label {
    padding: 16px 10px 7px !important;
    color: #77819a !important;
    font-size: 9.5px !important;
    font-weight: 700 !important;
    letter-spacing: .14em !important;
  }
  body.ed-enterprise-shell .ed-nav-item {
    min-height: 38px !important;
    margin: 2px 0 !important;
    padding: 8px 10px !important;
    border-radius: 9px !important;
    border-left-width: 0 !important;
    font-size: 13px !important;
    font-weight: 520 !important;
    color: #b9c2d5 !important;
    gap: 10px !important;
  }
  body.ed-enterprise-shell .ed-nav-item:hover {
    background: rgba(255,255,255,.045) !important;
    color: #fff !important;
  }
  body.ed-enterprise-shell .ed-nav-item[style*="D4A017"] {
    background: linear-gradient(90deg,rgba(245,158,11,.15),rgba(245,158,11,.055)) !important;
    box-shadow: inset 2px 0 0 var(--ed-desk-accent) !important;
    color: #fff !important;
  }
  body.ed-enterprise-shell .ed-nav-icon { width:19px !important;height:19px !important; }
  body.ed-enterprise-shell .ed-nav-icon svg { width:18px !important;height:18px !important; }
  body.ed-enterprise-shell .ed-nav-badge {
    background: #20293b !important;
    border: 1px solid #303b52 !important;
    color: #d9deea !important;
    min-width: 20px !important;
    height: 20px !important;
    padding: 0 6px !important;
    display:inline-flex !important;align-items:center !important;justify-content:center !important;
  }
  body.ed-enterprise-shell .ed-sidebar-footer-v8 {
    min-height: 68px !important;
    padding: 12px 14px !important;
    background: rgba(255,255,255,.015) !important;
    border-top: 1px solid var(--ed-desk-border) !important;
  }
  body.ed-enterprise-shell .ed-mobile-logout {
    min-height: 36px !important;
    display:inline-flex !important;align-items:center !important;justify-content:center !important;gap:7px !important;
    padding: 0 10px !important;
    border-radius: 9px !important;
    border: 1px solid rgba(248,113,113,.22) !important;
    background: rgba(248,113,113,.075) !important;
    color: #fca5a5 !important;
    font-size: 11.5px !important;font-weight:600 !important;
  }
  body.ed-enterprise-shell .ed-mobile-logout:hover {
    border-color: rgba(248,113,113,.45) !important;
    background: rgba(248,113,113,.13) !important;
    color:#fff !important;
  }

  /* Primary workspace content: consistent measure, gutters, rhythm. */
  body.ed-enterprise-shell main,
  body.ed-enterprise-shell #admin-main-content,
  body.ed-enterprise-shell #farmer-main-content,
  body.ed-enterprise-shell #agent-main-content,
  body.ed-enterprise-shell #finance-main-content,
  body.ed-enterprise-shell #clerk-main-content,
  body.ed-enterprise-shell #warehouse-main-content,
  body.ed-enterprise-shell #usermgmt-main-content {
    width: min(100%, 1560px) !important;
    max-width: 1560px !important;
    padding-left: 28px !important;
    padding-right: 28px !important;
    padding-top: 24px !important;
    padding-bottom: 36px !important;
    transition: margin-left .25s cubic-bezier(.4,0,.2,1) !important;
  }

  /* Header bars stay restrained and align with the shell. */
  body.ed-enterprise-shell header[class*="sticky"],
  body.ed-enterprise-shell header[class*="border-b"],
  body.ed-enterprise-shell [class*="sticky"][class*="top-0"] {
    background: rgba(10,13,20,.90) !important;
    border-bottom: 1px solid var(--ed-desk-border) !important;
    backdrop-filter: saturate(130%) blur(14px) !important;
    -webkit-backdrop-filter: saturate(130%) blur(14px) !important;
  }

  /* Typography hierarchy. */
  body.ed-enterprise-shell h1 { font-size: 24px !important; line-height:1.2 !important; letter-spacing:-.025em !important; font-weight:720 !important; }
  body.ed-enterprise-shell h2 { font-size: 18px !important; line-height:1.3 !important; letter-spacing:-.015em !important; font-weight:680 !important; }
  body.ed-enterprise-shell h3 { font-size: 14px !important; line-height:1.4 !important; font-weight:650 !important; }
  body.ed-enterprise-shell p { line-height:1.55; }
  body.ed-enterprise-shell [class*="text-ink-500"],
  body.ed-enterprise-shell [class*="text-ink-400"] { color: var(--ed-desk-subtle) !important; }
  body.ed-enterprise-shell [class*="text-ink-600"],
  body.ed-enterprise-shell [class*="text-ink-700"] { color: var(--ed-desk-muted) !important; }

  /* Panels and cards: quiet elevation, no noisy hover jumps. */
  body.ed-enterprise-shell .card,
  body.ed-enterprise-shell [class*="rounded-xl"],
  body.ed-enterprise-shell [class*="rounded-2xl"],
  body.ed-enterprise-shell [class*="rounded-lg"][class*="border"] {
    background: linear-gradient(180deg,var(--ed-desk-surface-2),var(--ed-desk-surface)) !important;
    border-color: var(--ed-desk-border) !important;
    box-shadow: var(--ed-desk-shadow) !important;
  }
  body.ed-enterprise-shell .card:hover,
  body.ed-enterprise-shell [class*="rounded-xl"]:hover {
    border-color: var(--ed-desk-border-strong) !important;
  }

  /* KPI/metric grids: stable, information-dense, same geometry across portals. */
  body.ed-enterprise-shell [class*="grid-cols-4"] > [class*="rounded"],
  body.ed-enterprise-shell [class*="grid-cols-3"] > [class*="rounded"],
  body.ed-enterprise-shell [class*="grid-cols-2"] > [class*="rounded"],
  body.ed-enterprise-shell .ui-metric-tile {
    min-height: 104px !important;
  }

  /* Forms and filters. */
  body.ed-enterprise-shell input:not([type="checkbox"]):not([type="radio"]),
  body.ed-enterprise-shell select,
  body.ed-enterprise-shell textarea {
    min-height: 40px !important;
    background: #0d1320 !important;
    border: 1px solid var(--ed-desk-border) !important;
    border-radius: 9px !important;
    color: var(--ed-desk-text) !important;
    font-size: 13px !important;
    transition: border-color .15s ease,box-shadow .15s ease,background .15s ease !important;
  }
  body.ed-enterprise-shell textarea { min-height: 92px !important; }
  body.ed-enterprise-shell input:focus,
  body.ed-enterprise-shell select:focus,
  body.ed-enterprise-shell textarea:focus {
    background:#0f1625 !important;
    border-color: rgba(245,158,11,.70) !important;
    box-shadow:0 0 0 3px var(--ed-desk-focus) !important;
  }
  body.ed-enterprise-shell input::placeholder,
  body.ed-enterprise-shell textarea::placeholder { color:#59647d !important; }

  /* Buttons: predictable hierarchy and focus behavior. */
  body.ed-enterprise-shell button {
    transition: background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease,transform .15s ease !important;
  }
  body.ed-enterprise-shell button:focus-visible,
  body.ed-enterprise-shell a:focus-visible,
  body.ed-enterprise-shell [role="button"]:focus-visible {
    outline: 2px solid var(--ed-desk-accent) !important;
    outline-offset: 2px !important;
  }
  body.ed-enterprise-shell .btn-primary,
  body.ed-enterprise-shell button[class*="bg-cargo"],
  body.ed-enterprise-shell button[class*="bg-cocoa"],
  body.ed-enterprise-shell button[class*="bg-success"],
  body.ed-enterprise-shell button[class*="bg-emerald"] {
    min-height: 38px !important;
    border-radius: 9px !important;
    background: linear-gradient(180deg,#fbbf24,#f59e0b) !important;
    color:#211504 !important;
    border:1px solid #b66d06 !important;
    box-shadow: inset 0 1px rgba(255,255,255,.24),0 5px 14px rgba(245,158,11,.12) !important;
  }
  body.ed-enterprise-shell .btn-primary:hover,
  body.ed-enterprise-shell button[class*="bg-cargo"]:hover,
  body.ed-enterprise-shell button[class*="bg-cocoa"]:hover {
    background: linear-gradient(180deg,#fcd34d,#f59e0b) !important;
    transform: translateY(-1px);
  }
  body.ed-enterprise-shell .btn-secondary,
  body.ed-enterprise-shell button[class*="bg-ink-100"],
  body.ed-enterprise-shell button[class*="dark:bg-ink-800"] {
    min-height:38px !important;
    border-radius:9px !important;
    background:#121a29 !important;
    border:1px solid var(--ed-desk-border) !important;
    color:#dce2ee !important;
  }
  body.ed-enterprise-shell .btn-secondary:hover { background:#182235 !important;border-color:#35415b !important; }

  /* Tables: fixed visual grammar for every data-heavy tab. */
  body.ed-enterprise-shell table {
    width:100% !important;
    border-collapse:separate !important;
    border-spacing:0 !important;
    font-variant-numeric: tabular-nums;
  }
  body.ed-enterprise-shell table thead th {
    position:sticky;
    top:0;
    z-index:1;
    background:#0e1421 !important;
    color:#7f8aa3 !important;
    font-size:10px !important;
    line-height:1.3 !important;
    font-weight:720 !important;
    text-transform:uppercase !important;
    letter-spacing:.11em !important;
    padding:11px 14px !important;
    border-bottom:1px solid var(--ed-desk-border-strong) !important;
    white-space:nowrap;
  }
  body.ed-enterprise-shell table tbody td {
    background:transparent !important;
    color:#c7cfde !important;
    font-size:12.5px !important;
    line-height:1.45 !important;
    padding:12px 14px !important;
    border-bottom:1px solid rgba(34,43,64,.72) !important;
    vertical-align:middle !important;
  }
  body.ed-enterprise-shell table tbody tr:last-child td { border-bottom-color:transparent !important; }
  body.ed-enterprise-shell table tbody tr:hover td { background:rgba(255,255,255,.022) !important; }

  /* Status pills never inherit primary-button geometry. */
  body.ed-enterprise-shell span[class*="rounded-full"],
  body.ed-enterprise-shell .pill {
    line-height:1.2 !important;
    box-shadow:none !important;
  }

  /* Empty/error/loading states stay compact and centred. */
  body.ed-enterprise-shell [class*="EmptyState"],
  body.ed-enterprise-shell [class*="empty-state"] {
    min-height:220px !important;
    display:flex !important;flex-direction:column !important;align-items:center !important;justify-content:center !important;
    border:1px dashed var(--ed-desk-border-strong) !important;
    background:rgba(10,15,25,.36) !important;
  }

  /* Modals/sheets use one desktop geometry. */
  body.ed-enterprise-shell [class*="fixed"][class*="inset-0"] > [class*="max-w-"],
  body.ed-enterprise-shell [role="dialog"] {
    border:1px solid var(--ed-desk-border-strong) !important;
    background:var(--ed-desk-surface) !important;
    box-shadow:0 26px 80px rgba(0,0,0,.55) !important;
  }

  /* Maps/charts should not inherit arbitrary card hover styling. */
  body.ed-enterprise-shell .leaflet-container,
  body.ed-enterprise-shell svg[class*="recharts"] {
    border-radius:10px;
  }

  /* Desktop does not show any mobile workspace controls/bottom navigation. */
  body.ed-enterprise-shell .ed-mobile-workspace-trigger,
  body.ed-enterprise-shell .admin-mobile-appbar,
  body.ed-enterprise-shell .admin-mobile-drawer,
  body.ed-enterprise-shell .admin-mobile-scrim,
  body.ed-enterprise-shell .admin-mobile-tabbar,
  body.ed-enterprise-shell .ent-bottomnav {
    display:none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   v10.1 — FARMER-FIRST MOBILE UX
   Mobile-only refinements for the Farmer workspace. The underlying React
   tabs, APIs, data and desktop implementation remain unchanged.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body[data-ed-portal="farmer"] {
    --farmer-mobile-bg:#080c13;
    --farmer-mobile-panel:#101625;
    --farmer-mobile-panel-2:#141b2d;
    --farmer-mobile-line:#202a40;
    --farmer-mobile-muted:#8e98b3;
    --farmer-mobile-accent:#f59e0b;
    background:var(--farmer-mobile-bg) !important;
  }

  body[data-ed-portal="farmer"] .farmer-dashboard-root {
    background:var(--farmer-mobile-bg) !important;
    padding-bottom:calc(88px + env(safe-area-inset-bottom,0px)) !important;
  }

  /* The injected workspace selector occupies the left side of the native top
     bar. Keep only contextual actions on the right to avoid crowding. */
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar {
    min-height:58px !important;
    height:calc(58px + env(safe-area-inset-top,0px)) !important;
    padding-top:env(safe-area-inset-top,0px) !important;
    background:rgba(8,12,19,.92) !important;
    border-bottom:1px solid var(--farmer-mobile-line) !important;
    backdrop-filter:saturate(145%) blur(16px);
    -webkit-backdrop-filter:saturate(145%) blur(16px);
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar > div {
    height:58px !important;
    padding-left:12px !important;
    padding-right:12px !important;
    justify-content:flex-end !important;
  }
  body[data-ed-portal="farmer"] .farmer-topbar-identity { display:none !important; }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar .flex.items-center.gap-1\.5 {
    gap:6px !important;
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar button {
    min-width:40px !important;
    width:40px !important;
    min-height:40px !important;
    height:40px !important;
  }

  /* The header already provides the mobile app-bar lane; do not add a second
     68px spacer before the farmer content. */
  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8 {
    padding:14px 14px calc(106px + env(safe-area-inset-bottom,0px)) !important;
    width:100% !important;
  }

  /* Compact, glanceable farmer identity. */
  body[data-ed-portal="farmer"] .farmer-identity-card {
    margin-bottom:12px !important;
    border-radius:16px !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card > div:not(.absolute) {
    gap:10px !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card h1 {
    font-size:19px !important;
    line-height:1.15 !important;
    white-space:normal !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card .section-eyebrow {
    font-size:9px !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card [class*="gap-x-4"] {
    gap:.35rem .75rem !important;
  }

  /* Four high-value KPIs remain two-up and readable at 320–499px widths. */
  body[data-ed-portal="farmer"] .farmer-kpi-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:10px !important;
    margin-bottom:14px !important;
  }
  body[data-ed-portal="farmer"] .farmer-kpi-grid > * {
    min-width:0 !important;
    min-height:106px !important;
    border-radius:14px !important;
  }
  body[data-ed-portal="farmer"] .farmer-kpi-grid [class*="text-2xl"],
  body[data-ed-portal="farmer"] .farmer-kpi-grid [class*="text-3xl"] {
    font-size:20px !important;
    line-height:1.15 !important;
    overflow-wrap:anywhere;
  }

  /* Farmer workflows are form-heavy. Stack paired controls on narrow devices
     and keep all actions thumb-friendly. */
  body[data-ed-portal="farmer"] .farmer-dashboard-root form .grid.grid-cols-2 {
    grid-template-columns:1fr !important;
    gap:12px !important;
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root input,
  body[data-ed-portal="farmer"] .farmer-dashboard-root select,
  body[data-ed-portal="farmer"] .farmer-dashboard-root textarea {
    min-height:46px !important;
    font-size:16px !important;
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root textarea { min-height:88px !important; }
  body[data-ed-portal="farmer"] .farmer-dashboard-root .btn-primary,
  body[data-ed-portal="farmer"] .farmer-dashboard-root .btn-secondary,
  body[data-ed-portal="farmer"] .farmer-dashboard-root .btn-accent {
    min-height:46px !important;
    border-radius:12px !important;
  }

  /* Data-heavy history views retain complete semantics but gain a predictable
     swipe surface and a sticky first column for orientation. */
  body[data-ed-portal="farmer"] #farmer-main-content .overflow-x-auto:has(table.data-table) {
    margin-left:-2px !important;
    margin-right:-2px !important;
    padding-bottom:4px !important;
    overscroll-behavior-inline:contain;
    scroll-snap-type:x proximity;
  }
  body[data-ed-portal="farmer"] table.data-table {
    min-width:620px !important;
    border-collapse:separate !important;
    border-spacing:0 !important;
  }
  body[data-ed-portal="farmer"] table.data-table th:first-child,
  body[data-ed-portal="farmer"] table.data-table td:first-child {
    position:sticky;
    left:0;
    z-index:2;
    background:#101625 !important;
    box-shadow:1px 0 0 var(--farmer-mobile-line);
  }
  body[data-ed-portal="farmer"] table.data-table thead th:first-child { z-index:3; }

  /* Cards and section blocks use one rhythm across all 17 farmer tabs. */
  body[data-ed-portal="farmer"] #farmer-main-content > .space-y-6,
  body[data-ed-portal="farmer"] #farmer-main-content [class*="space-y-6"] {
    gap:12px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .card,
  body[data-ed-portal="farmer"] #farmer-main-content [class*="rounded-xl"][class*="border"] {
    border-radius:14px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content [class*="p-8"] { padding:20px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content [class*="p-6"] { padding:16px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content [class*="p-5"] { padding:14px !important; }

  /* Farmer-specific bottom navigation: four highest-frequency journeys plus a
     More entry that opens the complete audited 17-tab workspace drawer. */
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-nav {
    position:fixed;
    left:0;right:0;bottom:0;
    z-index:48;
    height:calc(68px + env(safe-area-inset-bottom,0px));
    padding:6px 8px calc(6px + env(safe-area-inset-bottom,0px));
    display:grid !important;
    grid-template-columns:repeat(5,minmax(0,1fr));
    align-items:start;
    background:rgba(8,12,19,.96);
    border-top:1px solid var(--farmer-mobile-line);
    box-shadow:0 -12px 28px rgba(0,0,0,.22);
    backdrop-filter:saturate(145%) blur(18px);
    -webkit-backdrop-filter:saturate(145%) blur(18px);
  }
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-tab {
    appearance:none;
    border:0 !important;
    background:transparent !important;
    color:#727d98 !important;
    min-width:0 !important;
    min-height:54px !important;
    padding:5px 2px !important;
    border-radius:12px !important;
    display:flex !important;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    font:600 10px/1.1 Inter,"Segoe UI",system-ui,sans-serif !important;
    touch-action:manipulation;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-tab.is-active {
    color:var(--farmer-mobile-accent) !important;
    background:rgba(245,158,11,.08) !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-icon {
    width:24px;height:24px;display:grid;place-items:center;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-tab.is-active .farmer-mobile-bottom-icon {
    filter:drop-shadow(0 0 7px rgba(245,158,11,.28));
  }

  /* Keep Copilot reachable without covering farmer navigation or primary CTAs. */
  body[data-ed-portal="farmer"] .farmer-dashboard-root .copilot-fab {
    right:14px !important;
    bottom:calc(78px + env(safe-area-inset-bottom,0px)) !important;
    width:46px !important;
    height:46px !important;
    min-width:46px !important;
    min-height:46px !important;
    border-radius:14px !important;
  }

  /* Drawer refinements for low-literacy / rapid field use: larger rows,
     clearer grouping and a full-width logout footer action. */
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar {
    width:min(90vw,352px) !important;
    max-width:352px !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-search-wrap { padding:10px 12px !important; }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-group-label {
    padding-top:14px !important;
    font-size:9.5px !important;
    letter-spacing:.14em !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item {
    min-height:48px !important;
    padding:10px 11px !important;
    font-size:13.5px !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-icon {
    width:20px !important;height:20px !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 {
    display:grid !important;
    grid-template-columns:34px minmax(0,1fr) !important;
    gap:9px 10px !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-mobile-logout {
    grid-column:1 / -1 !important;
    width:100% !important;
    min-height:46px !important;
    justify-content:center !important;
    font-size:12px !important;
  }

  /* Workspace selector is intentionally concise and high contrast. */
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger {
    top:calc(8px + env(safe-area-inset-top,0px)) !important;
    left:10px !important;
    max-width:188px !important;
    min-height:42px !important;
    border-radius:11px !important;
  }
}

@media (max-width: 370px) {
  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8 { padding-left:10px !important;padding-right:10px !important; }
  body[data-ed-portal="farmer"] .farmer-kpi-grid { gap:8px !important; }
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-tab { font-size:9px !important; }
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger { max-width:168px !important; }
}

/* ═══════════════════════════════════════════════════════════════════════
   v10.2 — FARMER MOBILE VIEWPORT LOCK + FIXED NAVIGATION
   Keeps the Farmer app shell pinned to the visual viewport and prevents
   page-level horizontal drift while preserving intentional inner table
   scrollers. Mobile-only; desktop behavior is untouched.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  html,
  body,
  #root {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
    overscroll-behavior-x:none !important;
  }

  body[data-ed-portal="farmer"] {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
    overscroll-behavior-x:none !important;
  }

  body[data-ed-portal="farmer"] .farmer-dashboard-root {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
    overscroll-behavior-x:none !important;
    padding-top:calc(58px + env(safe-area-inset-top,0px)) !important;
  }

  /* True fixed app bar: only the page content scrolls. */
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar {
    position:fixed !important;
    inset-inline:0 !important;
    top:0 !important;
    width:auto !important;
    max-width:none !important;
    margin:0 !important;
    z-index:40 !important;
    transform:none !important;
    translate:none !important;
    box-sizing:border-box !important;
    overscroll-behavior:none !important;
  }

  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar > div {
    width:100% !important;
    max-width:none !important;
    min-width:0 !important;
    margin:0 !important;
    box-sizing:border-box !important;
  }

  /* Main content can never become the document-level horizontal scroller. */
  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8 {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin-inline:0 !important;
    box-sizing:border-box !important;
    overflow-x:hidden !important;
    overscroll-behavior-x:none !important;
  }

  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8 > *,
  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8 [class*="grid"],
  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8 [class*="flex"] {
    min-width:0;
    max-width:100%;
  }

  /* Preserve deliberate horizontal interaction only inside real data scrollers. */
  body[data-ed-portal="farmer"] #farmer-main-content .overflow-x-auto:has(table),
  body[data-ed-portal="farmer"] #farmer-main-content [class*="overflow-x-auto"]:has(table) {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:auto !important;
    overscroll-behavior-inline:contain !important;
    -webkit-overflow-scrolling:touch !important;
  }

  /* Bottom navigation is locked to the viewport, not to any content width. */
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-nav {
    position:fixed !important;
    left:0 !important;
    right:0 !important;
    bottom:0 !important;
    width:auto !important;
    max-width:none !important;
    min-width:0 !important;
    margin:0 !important;
    transform:none !important;
    translate:none !important;
    box-sizing:border-box !important;
    overflow-x:hidden !important;
    overscroll-behavior:none !important;
    contain:layout paint !important;
  }

  body[data-ed-portal="farmer"] .farmer-mobile-bottom-nav > * {
    min-width:0 !important;
    max-width:100% !important;
  }

  /* Workspace selector remains pinned inside the fixed app-bar lane. */
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger {
    position:fixed !important;
    transform:none !important;
    translate:none !important;
    z-index:41 !important;
  }
}


/* v10.3 — FARMER MOBILE DRAWER VISIBILITY FIX
   Keeps the document horizontally locked while allowing the off-canvas
   workspace drawer to leave/re-enter the visual viewport reliably. */
@media (max-width: 768px) {
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar {
    position:fixed !important;
    top:0 !important;
    left:0 !important;
    bottom:0 !important;
    height:100dvh !important;
    width:min(90vw,352px) !important;
    max-width:352px !important;
    z-index:70 !important;
    transform:translate3d(-105%,0,0);
    visibility:hidden;
    overflow:hidden !important;
    display:flex !important;
    flex-direction:column !important;
    will-change:transform;
    transition:transform .22s cubic-bezier(.2,.8,.2,1), visibility 0s linear .22s !important;
    contain:layout style !important;
  }

  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar.ed-mobile-drawer-open {
    transform:translate3d(0,0,0) !important;
    visibility:visible !important;
    transition:transform .22s cubic-bezier(.2,.8,.2,1), visibility 0s !important;
  }

  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar > nav {
    min-height:0 !important;
    flex:1 1 auto !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    -webkit-overflow-scrolling:touch !important;
  }

  body[data-ed-portal="farmer"].ed-mobile-drawer-is-open {
    overflow:hidden !important;
    overscroll-behavior:none !important;
  }

  body[data-ed-portal="farmer"] .ed-mobile-drawer-backdrop {
    z-index:69 !important;
    backdrop-filter:blur(2px);
    -webkit-backdrop-filter:blur(2px);
  }

  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger,
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-nav {
    z-index:61 !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   v11.0 — SYSTEM RESPONSIVE HARDENING + FIELD AGENT MOBILE-FIRST
   Final cascade layer for protected workspaces. Prevents document-level
   horizontal drift, preserves intentional inner scrollers, and gives the
   field-agent portal a one-handed, field-operations-first mobile shell.
   Desktop remains governed by the existing enterprise desktop layer.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* ── System viewport integrity ───────────────────────────────────── */
  html,
  body,
  #root,
  body.ed-mobile-portal-active,
  body.ed-mobile-portal-active #root {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
    overscroll-behavior-x:none !important;
  }

  body.ed-mobile-portal-active main,
  body.ed-mobile-portal-active [id$="-main-content"] {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin-inline:0 !important;
    box-sizing:border-box !important;
    overflow-x:hidden !important;
    overscroll-behavior-x:none !important;
  }

  body.ed-mobile-portal-active main > *,
  body.ed-mobile-portal-active [id$="-main-content"] > *,
  body.ed-mobile-portal-active [class*="grid"],
  body.ed-mobile-portal-active [class*="flex"] {
    min-width:0;
    max-width:100%;
  }

  /* Only explicit scroll regions may move horizontally. */
  body.ed-mobile-portal-active .overflow-x-auto,
  body.ed-mobile-portal-active [class*="overflow-x-auto"] {
    max-width:100% !important;
    min-width:0 !important;
    overscroll-behavior-inline:contain !important;
    -webkit-overflow-scrolling:touch !important;
  }

  /* Undo the old global table-to-card transformation for protected portal
     tables. Native semantic tables remain inside controlled horizontal
     scrollers unless a portal supplies a purpose-built mobile list. */
  body.ed-mobile-portal-active table.data-table,
  body.ed-mobile-portal-active table[class*="w-full"] {
    display:table !important;
    width:100% !important;
    min-width:680px;
    border-collapse:separate !important;
    border-spacing:0 !important;
  }
  body.ed-mobile-portal-active table.data-table thead,
  body.ed-mobile-portal-active table thead { display:table-header-group !important; }
  body.ed-mobile-portal-active table.data-table tbody,
  body.ed-mobile-portal-active table tbody { display:table-row-group !important; }
  body.ed-mobile-portal-active table.data-table tr,
  body.ed-mobile-portal-active table tr {
    display:table-row !important;
    background:transparent !important;
    border:0 !important;
    border-radius:0 !important;
    padding:0 !important;
    margin:0 !important;
  }
  body.ed-mobile-portal-active table.data-table td,
  body.ed-mobile-portal-active table td {
    display:table-cell !important;
    padding:11px 12px !important;
    border-bottom:1px solid var(--edm-line,#1f2540) !important;
    text-align:left !important;
    vertical-align:middle !important;
    white-space:nowrap;
  }
  body.ed-mobile-portal-active table.data-table td::before,
  body.ed-mobile-portal-active table td::before { content:none !important; }

  /* Controls and forms remain finger-safe and never force page width. */
  body.ed-mobile-portal-active button,
  body.ed-mobile-portal-active [role="button"],
  body.ed-mobile-portal-active input,
  body.ed-mobile-portal-active select,
  body.ed-mobile-portal-active textarea {
    max-width:100%;
    box-sizing:border-box;
  }
  body.ed-mobile-portal-active input:not([type="checkbox"]):not([type="radio"]),
  body.ed-mobile-portal-active select,
  body.ed-mobile-portal-active textarea {
    font-size:16px !important;
  }
  body.ed-mobile-portal-active form .grid.grid-cols-2,
  body.ed-mobile-portal-active form .grid.grid-cols-3,
  body.ed-mobile-portal-active form [class*="md:grid-cols-2"],
  body.ed-mobile-portal-active form [class*="md:grid-cols-3"] {
    grid-template-columns:minmax(0,1fr) !important;
  }

  /* Maps/charts must fit the device viewport while remaining usable. */
  body.ed-mobile-portal-active canvas,
  body.ed-mobile-portal-active svg,
  body.ed-mobile-portal-active iframe {
    max-width:100%;
  }
  body.ed-mobile-portal-active [class*="map"] {
    max-width:100%;
  }

  /* General mobile drawer contract for every injected protected workspace. */
  body.ed-mobile-portal-active .ed-sidebar {
    position:fixed !important;
    top:0 !important;
    left:0 !important;
    bottom:0 !important;
    height:100dvh !important;
    width:min(90vw,352px) !important;
    max-width:352px !important;
    z-index:70 !important;
    transform:translate3d(-105%,0,0) !important;
    visibility:hidden !important;
    display:flex !important;
    flex-direction:column !important;
    overflow:hidden !important;
    will-change:transform;
    transition:transform .22s cubic-bezier(.2,.8,.2,1), visibility 0s linear .22s !important;
  }
  body.ed-mobile-portal-active .ed-sidebar.ed-mobile-drawer-open {
    transform:translate3d(0,0,0) !important;
    visibility:visible !important;
    transition:transform .22s cubic-bezier(.2,.8,.2,1), visibility 0s !important;
  }
  body.ed-mobile-portal-active .ed-sidebar > nav {
    min-height:0 !important;
    flex:1 1 auto !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    -webkit-overflow-scrolling:touch !important;
  }
  body.ed-mobile-portal-active .ed-mobile-drawer-backdrop {
    z-index:69 !important;
    backdrop-filter:blur(2px);
    -webkit-backdrop-filter:blur(2px);
  }
  body.ed-mobile-portal-active.ed-mobile-drawer-is-open {
    overflow:hidden !important;
    overscroll-behavior:none !important;
  }

  /* ── Field Agent mobile-first shell ─────────────────────────────── */
  body[data-ed-portal="agent"] {
    --agent-mobile-bg:#080c13;
    --agent-mobile-panel:#101625;
    --agent-mobile-panel-2:#141b2d;
    --agent-mobile-line:#202a40;
    --agent-mobile-muted:#8e98b3;
    --agent-mobile-accent:#f59e0b;
    --agent-mobile-good:#34d399;
    background:var(--agent-mobile-bg) !important;
  }

  body[data-ed-portal="agent"] .agent-dashboard-root {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
    background:var(--agent-mobile-bg) !important;
    padding-top:calc(58px + env(safe-area-inset-top,0px)) !important;
    padding-bottom:calc(78px + env(safe-area-inset-bottom,0px)) !important;
  }

  /* Stable app bar: workspace navigation on left, quick controls on right. */
  body[data-ed-portal="agent"] .agent-dashboard-root > header.topbar {
    position:fixed !important;
    top:0 !important;
    left:0 !important;
    right:0 !important;
    z-index:40 !important;
    width:auto !important;
    height:calc(58px + env(safe-area-inset-top,0px)) !important;
    margin:0 !important;
    border-bottom:1px solid var(--agent-mobile-line) !important;
    background:rgba(8,12,19,.94) !important;
    backdrop-filter:saturate(145%) blur(16px) !important;
    -webkit-backdrop-filter:saturate(145%) blur(16px) !important;
  }
  body[data-ed-portal="agent"] .agent-dashboard-root > header.topbar > div {
    width:100% !important;
    max-width:none !important;
    min-width:0 !important;
    height:100% !important;
    margin:0 !important;
    padding:env(safe-area-inset-top,0px) 10px 0 200px !important;
    box-sizing:border-box !important;
  }
  body[data-ed-portal="agent"] .agent-topbar-identity { display:none !important; }
  body[data-ed-portal="agent"] .agent-dashboard-root > header.topbar .flex.items-center.gap-1\.5 {
    margin-left:auto !important;
    gap:6px !important;
  }
  body[data-ed-portal="agent"] .agent-dashboard-root > header.topbar button {
    min-width:40px !important;
    width:40px !important;
    height:40px !important;
    min-height:40px !important;
    padding:0 !important;
    border-radius:11px !important;
  }

  body[data-ed-portal="agent"] .ed-mobile-workspace-trigger {
    position:fixed !important;
    top:calc(8px + env(safe-area-inset-top,0px)) !important;
    left:10px !important;
    z-index:61 !important;
    width:auto !important;
    max-width:184px !important;
    min-height:42px !important;
    border-radius:11px !important;
    transform:none !important;
    translate:none !important;
  }

  body[data-ed-portal="agent"] #agent-main-content.ed-mobile-main-v8 {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin:0 !important;
    padding:12px 12px calc(94px + env(safe-area-inset-bottom,0px)) !important;
    overflow-x:hidden !important;
  }

  /* Old eight-tab strip is intentionally retired on mobile. */
  body[data-ed-portal="agent"] .agent-legacy-mobile-tabs { display:none !important; }

  /* Fast-glance field metrics: 2x2 + one full-width status tile. */
  body[data-ed-portal="agent"] .agent-kpi-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:9px !important;
    margin-bottom:14px !important;
  }
  body[data-ed-portal="agent"] .agent-kpi-grid > * {
    min-width:0 !important;
    min-height:92px !important;
    border-radius:13px !important;
  }
  body[data-ed-portal="agent"] .agent-kpi-grid > *:last-child { grid-column:1 / -1; min-height:78px !important; }

  /* Search and primary tab surfaces use a single compact rhythm. */
  body[data-ed-portal="agent"] #agent-main-content > .mb-5 { margin-bottom:12px !important; }
  body[data-ed-portal="agent"] #agent-main-content .card,
  body[data-ed-portal="agent"] #agent-main-content [class*="rounded-xl"][class*="border"] {
    border-color:var(--agent-mobile-line) !important;
    border-radius:14px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content [class*="p-8"] { padding:18px !important; }
  body[data-ed-portal="agent"] #agent-main-content [class*="p-6"] { padding:16px !important; }
  body[data-ed-portal="agent"] #agent-main-content [class*="p-5"] { padding:14px !important; }

  /* Farmer directory for agents is a true field list, not a miniature table. */
  body[data-ed-portal="agent"] .agent-farmer-list {
    display:block !important;
    background:var(--agent-mobile-panel) !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-row { background:transparent !important; }
  body[data-ed-portal="agent"] .agent-farmer-row:active { background:rgba(245,158,11,.045) !important; }
  body[data-ed-portal="agent"] .agent-farmer-stats > div {
    min-width:0;
    padding:8px;
    border-radius:9px;
    background:#0c1220;
    border:1px solid var(--agent-mobile-line);
  }
  body[data-ed-portal="agent"] .agent-farmer-stats span {
    display:block;
    font:600 9px/1.15 "SF Mono",Consolas,monospace !important;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:var(--agent-mobile-muted) !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats strong {
    display:block;
    margin-top:4px;
    color:#f3f6fb !important;
    font-size:12px !important;
    line-height:1.2 !important;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  body[data-ed-portal="agent"] .agent-farmer-actions button {
    width:100% !important;
    min-width:0 !important;
    min-height:44px !important;
    padding:8px 9px !important;
    white-space:nowrap;
  }

  /* Registration and capture forms prioritize one-handed completion. */
  body[data-ed-portal="agent"] #agent-main-content form {
    max-width:100% !important;
  }
  body[data-ed-portal="agent"] #agent-main-content form [class*="pl-8"] { padding-left:0 !important; }
  body[data-ed-portal="agent"] #agent-main-content form .grid.grid-cols-2,
  body[data-ed-portal="agent"] #agent-main-content form [class*="md:grid-cols-2"] {
    grid-template-columns:minmax(0,1fr) !important;
  }
  body[data-ed-portal="agent"] #agent-main-content form button[type="submit"] {
    min-height:50px !important;
    font-size:14px !important;
    border-radius:12px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content [style*="height: 500px"],
  body[data-ed-portal="agent"] #agent-main-content [style*="height:500px"],
  body[data-ed-portal="agent"] #agent-main-content [style*="height: 400px"],
  body[data-ed-portal="agent"] #agent-main-content [style*="height:400px"] {
    max-height:56dvh !important;
  }

  /* Five-destination one-handed bottom navigation. */
  body[data-ed-portal="agent"] .agent-mobile-bottom-nav {
    position:fixed !important;
    left:0 !important;
    right:0 !important;
    bottom:0 !important;
    z-index:61 !important;
    display:grid !important;
    grid-template-columns:repeat(5,minmax(0,1fr)) !important;
    gap:2px !important;
    width:auto !important;
    max-width:none !important;
    min-width:0 !important;
    margin:0 !important;
    padding:7px 7px calc(7px + env(safe-area-inset-bottom,0px)) !important;
    background:rgba(8,12,19,.97) !important;
    border-top:1px solid var(--agent-mobile-line) !important;
    backdrop-filter:saturate(150%) blur(18px) !important;
    -webkit-backdrop-filter:saturate(150%) blur(18px) !important;
    box-sizing:border-box !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-bottom-tab {
    appearance:none;
    min-width:0 !important;
    min-height:54px !important;
    width:100% !important;
    padding:5px 2px !important;
    border:0 !important;
    border-radius:12px !important;
    background:transparent !important;
    color:#727d98 !important;
    display:flex !important;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    font:600 9.5px/1.1 Inter,"Segoe UI",system-ui,sans-serif !important;
    touch-action:manipulation;
  }
  body[data-ed-portal="agent"] .agent-mobile-bottom-tab.is-active {
    color:var(--agent-mobile-accent) !important;
    background:rgba(245,158,11,.075) !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-bottom-icon {
    width:23px;height:23px;display:grid;place-items:center;
  }
  body[data-ed-portal="agent"] .agent-mobile-bottom-primary {
    margin-top:-17px !important;
    min-height:58px !important;
    width:58px !important;
    max-width:58px !important;
    justify-self:center !important;
    border-radius:18px !important;
    color:#171008 !important;
    background:linear-gradient(180deg,#fbbf24,#d97706) !important;
    border:1px solid #92400e !important;
    box-shadow:0 0 0 6px rgba(8,12,19,.97),0 10px 24px rgba(245,158,11,.28) !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-bottom-primary.is-active { color:#171008 !important; }

  body[data-ed-portal="agent"] .agent-dashboard-root .copilot-fab {
    right:12px !important;
    bottom:calc(82px + env(safe-area-inset-bottom,0px)) !important;
    width:46px !important;
    height:46px !important;
    min-width:46px !important;
    min-height:46px !important;
    border-radius:14px !important;
  }

  /* Field drawer: clearer hierarchy and persistent full-width logout. */
  body[data-ed-portal="agent"] .ed-sidebar .ed-nav-item {
    min-height:48px !important;
    padding:10px 11px !important;
    font-size:13.5px !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar .ed-group-label {
    padding-top:14px !important;
    font-size:9.5px !important;
    letter-spacing:.14em !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-footer-v8 {
    display:grid !important;
    grid-template-columns:34px minmax(0,1fr) !important;
    gap:9px 10px !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-footer-v8 .ed-mobile-logout {
    grid-column:1 / -1 !important;
    width:100% !important;
    min-height:46px !important;
    justify-content:center !important;
    font-size:12px !important;
  }
}

@media (max-width: 370px) {
  body[data-ed-portal="agent"] .agent-dashboard-root > header.topbar > div {
    padding-left:180px !important;
  }
  body[data-ed-portal="agent"] .ed-mobile-workspace-trigger { max-width:166px !important; }
  body[data-ed-portal="agent"] #agent-main-content.ed-mobile-main-v8 { padding-left:10px !important;padding-right:10px !important; }
  body[data-ed-portal="agent"] .agent-mobile-bottom-tab { font-size:8.5px !important; }
}

/* ═══════════════════════════════════════════════════════════════════════
   v11.1 — FARMER + FIELD AGENT MOBILE CARD DENSITY & SCROLL CONTRACT
   Mobile-only refinement: compact readable cards, seamless wrapping, and a
   vertically scrollable content plane between fixed app and bottom bars.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* The document is the vertical scroll surface. Horizontal page drift stays
     disabled while deliberate inner data scrollers remain available. */
  html,
  body,
  #root,
  body[data-ed-portal="farmer"],
  body[data-ed-portal="agent"] {
    min-height:100% !important;
    height:auto !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior-y:auto !important;
    touch-action:pan-y !important;
  }

  body[data-ed-portal="farmer"].ed-mobile-drawer-is-open,
  body[data-ed-portal="agent"].ed-mobile-drawer-is-open {
    overflow:hidden !important;
    touch-action:none !important;
  }

  body[data-ed-portal="farmer"] .farmer-dashboard-root,
  body[data-ed-portal="agent"] .agent-dashboard-root {
    min-height:100dvh !important;
    height:auto !important;
    overflow:visible !important;
  }

  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8,
  body[data-ed-portal="agent"] #agent-main-content.ed-mobile-main-v8 {
    min-height:calc(100dvh - 58px) !important;
    height:auto !important;
    overflow-y:visible !important;
    overflow-x:hidden !important;
    -webkit-overflow-scrolling:touch !important;
    touch-action:pan-y !important;
  }

  /* Keep navigation chrome pinned while content moves beneath it. */
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar,
  body[data-ed-portal="agent"] .agent-dashboard-root > header.topbar,
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-nav,
  body[data-ed-portal="agent"] .agent-mobile-bottom-nav {
    position:fixed !important;
    transform:none !important;
    translate:none !important;
  }

  /* Farmer no longer needs the old horizontal mobile tab ribbon. */
  body[data-ed-portal="farmer"] #farmer-main-content [role="tablist"][aria-label="Farmer navigation"] {
    display:none !important;
  }

  /* ── Shared compact card contract ───────────────────────────────── */
  body[data-ed-portal="farmer"] #farmer-main-content .card,
  body[data-ed-portal="agent"] #agent-main-content .card {
    min-width:0 !important;
    max-width:100% !important;
    border-radius:12px !important;
    overflow-wrap:anywhere;
    word-break:normal;
  }

  body[data-ed-portal="farmer"] #farmer-main-content .card > *,
  body[data-ed-portal="agent"] #agent-main-content .card > * {
    min-width:0;
    max-width:100%;
  }

  body[data-ed-portal="farmer"] #farmer-main-content [class*="p-8"],
  body[data-ed-portal="agent"] #agent-main-content [class*="p-8"] { padding:16px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content [class*="p-6"],
  body[data-ed-portal="agent"] #agent-main-content [class*="p-6"] { padding:14px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content [class*="p-5"],
  body[data-ed-portal="agent"] #agent-main-content [class*="p-5"] { padding:12px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content [class*="p-4"],
  body[data-ed-portal="agent"] #agent-main-content [class*="p-4"] { padding:11px !important; }

  /* Text must fit naturally rather than clip or force a wider viewport. */
  body[data-ed-portal="farmer"] #farmer-main-content h1,
  body[data-ed-portal="farmer"] #farmer-main-content h2,
  body[data-ed-portal="farmer"] #farmer-main-content h3,
  body[data-ed-portal="farmer"] #farmer-main-content p,
  body[data-ed-portal="farmer"] #farmer-main-content span,
  body[data-ed-portal="farmer"] #farmer-main-content label,
  body[data-ed-portal="agent"] #agent-main-content h1,
  body[data-ed-portal="agent"] #agent-main-content h2,
  body[data-ed-portal="agent"] #agent-main-content h3,
  body[data-ed-portal="agent"] #agent-main-content p,
  body[data-ed-portal="agent"] #agent-main-content span,
  body[data-ed-portal="agent"] #agent-main-content label {
    max-width:100%;
    overflow-wrap:anywhere;
  }

  body[data-ed-portal="farmer"] #farmer-main-content [class*="text-2xl"],
  body[data-ed-portal="agent"] #agent-main-content [class*="text-2xl"] {
    font-size:19px !important;
    line-height:1.15 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content [class*="text-xl"],
  body[data-ed-portal="agent"] #agent-main-content [class*="text-xl"] {
    font-size:17px !important;
    line-height:1.2 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content [class*="text-lg"],
  body[data-ed-portal="agent"] #agent-main-content [class*="text-lg"] {
    font-size:15.5px !important;
    line-height:1.25 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content [class*="text-sm"],
  body[data-ed-portal="agent"] #agent-main-content [class*="text-sm"] {
    font-size:12.5px !important;
    line-height:1.4 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content [class*="text-xs"],
  body[data-ed-portal="agent"] #agent-main-content [class*="text-xs"] {
    font-size:11.5px !important;
    line-height:1.35 !important;
  }

  /* ── Farmer cards ───────────────────────────────────────────────── */
  body[data-ed-portal="farmer"] .farmer-identity-card {
    padding:12px !important;
    margin-bottom:10px !important;
    border-radius:12px !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card .flex.items-start.gap-4 {
    gap:10px !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card h1 {
    font-size:18px !important;
    line-height:1.18 !important;
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card .flex.flex-wrap {
    gap:4px 9px !important;
    margin-top:5px !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card .flex.flex-wrap > span {
    font-size:11px !important;
    line-height:1.3 !important;
  }

  body[data-ed-portal="farmer"] .farmer-kpi-grid {
    gap:8px !important;
    margin-bottom:11px !important;
  }
  body[data-ed-portal="farmer"] .farmer-kpi-grid > * {
    min-height:88px !important;
    height:auto !important;
    padding:11px !important;
    border-radius:12px !important;
  }
  body[data-ed-portal="farmer"] .farmer-kpi-grid [class*="text-2xl"],
  body[data-ed-portal="farmer"] .farmer-kpi-grid [class*="text-3xl"] {
    font-size:18px !important;
    line-height:1.1 !important;
    letter-spacing:-.01em !important;
    white-space:normal !important;
    overflow:visible !important;
  }
  body[data-ed-portal="farmer"] .farmer-kpi-grid [class*="text-xs"],
  body[data-ed-portal="farmer"] .farmer-kpi-grid [class*="text-sm"] {
    font-size:10.5px !important;
    line-height:1.25 !important;
    white-space:normal !important;
  }

  /* ── Field Agent cards ──────────────────────────────────────────── */
  body[data-ed-portal="agent"] .agent-kpi-grid {
    gap:8px !important;
    margin-bottom:11px !important;
  }
  body[data-ed-portal="agent"] .agent-kpi-grid > * {
    min-height:82px !important;
    height:auto !important;
    padding:10px !important;
    border-radius:12px !important;
  }
  body[data-ed-portal="agent"] .agent-kpi-grid > *:last-child {
    min-height:70px !important;
  }
  body[data-ed-portal="agent"] .agent-kpi-grid [class*="text-2xl"],
  body[data-ed-portal="agent"] .agent-kpi-grid [class*="text-3xl"] {
    font-size:18px !important;
    line-height:1.1 !important;
    white-space:normal !important;
    overflow:visible !important;
  }
  body[data-ed-portal="agent"] .agent-kpi-grid [class*="text-xs"],
  body[data-ed-portal="agent"] .agent-kpi-grid [class*="text-sm"] {
    font-size:10.5px !important;
    line-height:1.25 !important;
    white-space:normal !important;
  }

  body[data-ed-portal="agent"] .agent-farmer-row {
    padding:11px 12px !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-row .flex.items-start.gap-3 {
    gap:9px !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-row h3 {
    font-size:13px !important;
    line-height:1.25 !important;
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-row p {
    font-size:10.5px !important;
    line-height:1.3 !important;
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats {
    gap:6px !important;
    margin-top:8px !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats > div {
    padding:6px 7px !important;
    border-radius:8px !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats span {
    font-size:8px !important;
    line-height:1.15 !important;
    letter-spacing:.06em !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats strong {
    margin-top:3px !important;
    font-size:11px !important;
    line-height:1.2 !important;
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
    overflow-wrap:anywhere !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-actions {
    gap:6px !important;
    margin-top:8px !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-actions button {
    min-height:40px !important;
    padding:7px 7px !important;
    font-size:10.5px !important;
    line-height:1.15 !important;
    white-space:normal !important;
  }

  /* Compact section headers and utility rows without sacrificing touch size. */
  body[data-ed-portal="farmer"] #farmer-main-content .card > [class*="border-b"],
  body[data-ed-portal="agent"] #agent-main-content .card > [class*="border-b"] {
    padding:10px 12px !important;
    gap:8px !important;
    flex-wrap:wrap !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content button,
  body[data-ed-portal="agent"] #agent-main-content button {
    max-width:100%;
  }
}

@media (max-width: 360px) {
  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8,
  body[data-ed-portal="agent"] #agent-main-content.ed-mobile-main-v8 {
    padding-left:9px !important;
    padding-right:9px !important;
  }
  body[data-ed-portal="farmer"] .farmer-kpi-grid,
  body[data-ed-portal="agent"] .agent-kpi-grid { gap:7px !important; }
  body[data-ed-portal="farmer"] .farmer-kpi-grid > *,
  body[data-ed-portal="agent"] .agent-kpi-grid > * { padding:9px !important; }
  body[data-ed-portal="agent"] .agent-farmer-row { padding:10px !important; }
}

/* ════════════════════════════════════════════════════════════════════
 * ENTERPRISE DESKTOP RESPONSIVE GEOMETRY v10
 * Prevents workspace content from ever sitting beneath the persistent
 * navigation rail at intermediate desktop/tablet widths.
 * ════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  body.ed-enterprise-shell {
    --ed-sidebar-offset: 304px;
    overflow-x: hidden !important;
  }
  body.ed-enterprise-shell.ed-sidebar-collapsed {
    --ed-sidebar-offset: 88px;
  }

  /* The content owns only the viewport space that remains after the rail.
     This is the critical invariant that prevents rail/content overlap. */
  body.ed-enterprise-shell main,
  body.ed-enterprise-shell #admin-main-content,
  body.ed-enterprise-shell #farmer-main-content,
  body.ed-enterprise-shell #agent-main-content,
  body.ed-enterprise-shell #finance-main-content,
  body.ed-enterprise-shell #clerk-main-content,
  body.ed-enterprise-shell #warehouse-main-content,
  body.ed-enterprise-shell #usermgmt-main-content,
  body.ed-enterprise-shell [id$="-main-content"] {
    width: min(1560px, calc(100vw - var(--ed-sidebar-offset))) !important;
    max-width: calc(100vw - var(--ed-sidebar-offset)) !important;
    min-width: 0 !important;
    margin-right: 0 !important;
    overflow-x: clip;
  }

  body.ed-enterprise-shell [id$="-main-content"] > *,
  body.ed-enterprise-shell [id$="-main-content"] [class*="grid"],
  body.ed-enterprise-shell [id$="-main-content"] [class*="flex"] {
    min-width: 0;
    max-width: 100%;
  }

  /* Wide data structures scroll inside their own region, never underneath
     the sidebar and never by moving the entire application canvas. */
  body.ed-enterprise-shell [id$="-main-content"] .overflow-x-auto,
  body.ed-enterprise-shell [id$="-main-content"] [class*="overflow-x-auto"],
  body.ed-enterprise-shell [id$="-main-content"] .data-table-wrapper {
    max-width: 100% !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain;
  }
  body.ed-enterprise-shell [id$="-main-content"] img,
  body.ed-enterprise-shell [id$="-main-content"] svg,
  body.ed-enterprise-shell [id$="-main-content"] canvas,
  body.ed-enterprise-shell [id$="-main-content"] .leaflet-container {
    max-width: 100% !important;
  }
}

/* Compact desktop / landscape-tablet band. The sidebar remains fully usable,
   while dashboard density steps down before the mobile breakpoint. */
@media (min-width: 769px) and (max-width: 1180px) {
  body.ed-enterprise-shell main,
  body.ed-enterprise-shell [id$="-main-content"] {
    padding-left: 18px !important;
    padding-right: 18px !important;
    padding-top: 18px !important;
  }

  body.ed-enterprise-shell [class*="grid-cols-6"],
  body.ed-enterprise-shell [class*="grid-cols-5"],
  body.ed-enterprise-shell [class*="grid-cols-4"],
  body.ed-enterprise-shell [class*="xl:grid-cols-4"],
  body.ed-enterprise-shell [class*="lg:grid-cols-4"] {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  }
  body.ed-enterprise-shell [class*="grid-cols-3"],
  body.ed-enterprise-shell [class*="lg:grid-cols-3"] {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  }
  body.ed-enterprise-shell [class*="gap-6"] { gap: 14px !important; }
  body.ed-enterprise-shell [class*="gap-5"] { gap: 12px !important; }

  body.ed-enterprise-shell h1 { font-size: 21px !important; }
  body.ed-enterprise-shell h2 { font-size: 17px !important; }

  /* Toolbars must wrap rather than disappear beneath navigation or overflow. */
  body.ed-enterprise-shell [id$="-main-content"] [class*="justify-between"] {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  body.ed-enterprise-shell [id$="-main-content"] input,
  body.ed-enterprise-shell [id$="-main-content"] select,
  body.ed-enterprise-shell [id$="-main-content"] textarea {
    max-width: 100%;
  }
}

/* Very narrow desktop window: preserve desktop shell but prioritize usable
   content. The user can still collapse the rail manually for more space. */
@media (min-width: 769px) and (max-width: 900px) {
  body.ed-enterprise-shell [class*="grid-cols-6"],
  body.ed-enterprise-shell [class*="grid-cols-5"],
  body.ed-enterprise-shell [class*="grid-cols-4"],
  body.ed-enterprise-shell [class*="grid-cols-3"] {
    grid-template-columns: 1fr !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   v12 — FARMER + FIELD AGENT MOBILE INFORMATION ARCHITECTURE
   Decision-first mobile layout: compact glance metrics, operational rows,
   flatter hierarchy, and detail-on-demand. Desktop is intentionally untouched.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Keep the scroll plane simple: document scrolls vertically while app chrome
     remains fixed. No card is allowed to widen the viewport. */
  body[data-ed-portal="farmer"] #farmer-main-content,
  body[data-ed-portal="agent"] #agent-main-content {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
  }

  body[data-ed-portal="farmer"] #farmer-main-content > *,
  body[data-ed-portal="agent"] #agent-main-content > * {
    min-width:0 !important;
    max-width:100% !important;
  }

  /* ── Farmer: profile becomes an identity strip, not a hero card ───── */
  body[data-ed-portal="farmer"] .farmer-identity-card {
    min-height:68px !important;
    padding:10px 11px !important;
    margin-bottom:9px !important;
    border-radius:11px !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card .section-eyebrow {
    display:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card h1 {
    margin:0 !important;
    font-size:15px !important;
    line-height:1.2 !important;
    font-weight:650 !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card .flex.flex-wrap {
    margin-top:3px !important;
    gap:2px 10px !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card .flex.flex-wrap > span {
    font-size:10.5px !important;
    line-height:1.25 !important;
  }

  /* Glance metrics are compact instruments, not content cards. */
  body[data-ed-portal="farmer"] .farmer-kpi-grid,
  body[data-ed-portal="agent"] .agent-kpi-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:7px !important;
    margin-bottom:10px !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-metric,
  body[data-ed-portal="agent"] .agent-mobile-metric {
    min-height:68px !important;
    height:auto !important;
    padding:8px 9px !important;
    border-radius:10px !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-metric > div,
  body[data-ed-portal="agent"] .agent-mobile-metric > div {
    align-items:center !important;
    gap:6px !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-metric > div > div:first-child,
  body[data-ed-portal="agent"] .agent-mobile-metric > div > div:first-child {
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-metric p:first-child,
  body[data-ed-portal="agent"] .agent-mobile-metric p:first-child {
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
    font-size:9px !important;
    line-height:1.15 !important;
    letter-spacing:.055em !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-metric p:nth-child(2),
  body[data-ed-portal="agent"] .agent-mobile-metric p:nth-child(2) {
    margin-top:4px !important;
    font-size:clamp(14px,4.4vw,18px) !important;
    line-height:1.05 !important;
    white-space:normal !important;
    overflow-wrap:anywhere !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-metric p:nth-child(3),
  body[data-ed-portal="agent"] .agent-mobile-metric p:nth-child(3) {
    margin-top:2px !important;
    font-size:9.5px !important;
    line-height:1.15 !important;
    white-space:normal !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-metric > div > div:last-child,
  body[data-ed-portal="agent"] .agent-mobile-metric > div > div:last-child {
    width:28px !important;
    height:28px !important;
    min-width:28px !important;
    margin-left:3px !important;
    border-radius:8px !important;
  }

  /* Farmer wallet is a single decision row. */
  body[data-ed-portal="farmer"] .farmer-wallet-card {
    padding:10px 11px !important;
    margin-bottom:9px !important;
    border-radius:11px !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-wallet-card > .flex {
    flex-direction:row !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:9px !important;
  }
  body[data-ed-portal="farmer"] .farmer-wallet-card .section-eyebrow {
    margin-bottom:1px !important;
    font-size:8.5px !important;
  }
  body[data-ed-portal="farmer"] .farmer-wallet-card .text-3xl {
    font-size:20px !important;
    line-height:1.05 !important;
  }
  body[data-ed-portal="farmer"] .farmer-wallet-card .text-base {
    font-size:10px !important;
  }
  body[data-ed-portal="farmer"] .farmer-wallet-card p.mt-1\.5 {
    margin-top:3px !important;
    gap:3px 8px !important;
    font-size:9.5px !important;
    line-height:1.2 !important;
  }
  body[data-ed-portal="farmer"] .farmer-wallet-card .btn-accent {
    min-width:108px !important;
    min-height:44px !important;
    height:44px !important;
    padding:0 10px !important;
    border-radius:10px !important;
    font-size:11px !important;
    line-height:1.15 !important;
    white-space:normal !important;
  }

  /* Quality: one compact snapshot with four inline facts; nested cards removed. */
  body[data-ed-portal="farmer"] .farmer-quality-card {
    padding:11px !important;
    margin-bottom:9px !important;
    border-radius:11px !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-card .section-title {
    font-size:13.5px !important;
    line-height:1.2 !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-card .section-title + p {
    display:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-card .w-9.h-9 {
    width:28px !important;
    height:28px !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-metrics {
    grid-template-columns:repeat(4,minmax(0,1fr)) !important;
    gap:0 !important;
    margin-top:9px !important;
    border:1px solid var(--farmer-mobile-line) !important;
    border-radius:9px !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-stat {
    min-width:0 !important;
    min-height:58px !important;
    padding:7px 3px !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-stat + .farmer-quality-stat {
    border-left:1px solid var(--farmer-mobile-line) !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-stat > div {
    font-size:16px !important;
    line-height:1.05 !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-stat:first-child > div {
    font-size:22px !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-stat p {
    margin-top:3px !important;
    font-size:8px !important;
    line-height:1.1 !important;
    text-align:center !important;
    white-space:normal !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-card .mt-4 {
    margin-top:9px !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-card .h-3 {
    height:6px !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-card button.mt-4 {
    margin-top:8px !important;
    width:100% !important;
    min-height:40px !important;
  }

  /* Delivery is a status row, not another large panel. */
  body[data-ed-portal="farmer"] .farmer-last-delivery {
    padding:9px 11px !important;
    margin-bottom:9px !important;
    min-height:54px !important;
    border-radius:10px !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-last-delivery .w-9.h-9 {
    width:28px !important;
    height:28px !important;
  }
  body[data-ed-portal="farmer"] .farmer-last-delivery .text-sm {
    font-size:11.5px !important;
  }

  /* Activity is a list: one visual container, rows separated by rules. */
  body[data-ed-portal="farmer"] .farmer-activity-card {
    padding:11px !important;
    border-radius:11px !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-activity-card .section-title {
    font-size:13.5px !important;
  }
  body[data-ed-portal="farmer"] .farmer-activity-card .section-title + p {
    display:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-activity-list {
    display:block !important;
    margin-top:8px !important;
    border:1px solid var(--farmer-mobile-line) !important;
    border-radius:9px !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-row {
    min-height:54px !important;
    padding:7px 9px !important;
    gap:8px !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-row + .farmer-summary-row {
    border-top:1px solid var(--farmer-mobile-line) !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-row > span:first-child {
    width:28px !important;
    height:28px !important;
    border-radius:8px !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-row p:first-child {
    font-size:8.5px !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-row p:nth-child(2) {
    font-size:14px !important;
    line-height:1.05 !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-row p:nth-child(3) {
    display:none !important;
  }

  /* ── Agent: KPI cards become compact glance instruments ─────────── */
  body[data-ed-portal="agent"] .agent-kpi-grid > *:last-child {
    grid-column:1 / -1 !important;
    min-height:56px !important;
  }
  body[data-ed-portal="agent"] .agent-kpi-grid > *:last-child > div {
    align-items:center !important;
  }

  /* Farmer directory is a list, not a stack of cards inside a card. */
  body[data-ed-portal="agent"] .agent-directory-card {
    border-radius:11px !important;
    box-shadow:none !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] .agent-directory-header {
    min-height:50px !important;
    padding:8px 10px !important;
    flex-wrap:nowrap !important;
  }
  body[data-ed-portal="agent"] .agent-directory-header > span {
    min-width:0 !important;
    font-size:10.5px !important;
    line-height:1.2 !important;
  }
  body[data-ed-portal="agent"] .agent-directory-header .btn-primary {
    min-height:40px !important;
    height:40px !important;
    padding:0 10px !important;
    font-size:10.5px !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-row {
    padding:9px 10px !important;
    background:transparent !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-row + .agent-farmer-row {
    border-top-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-row h3 {
    font-size:12.5px !important;
    line-height:1.2 !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-row p {
    margin-top:1px !important;
    font-size:9.5px !important;
    line-height:1.2 !important;
  }

  /* Operational facts become one inline metadata rail with separators. */
  body[data-ed-portal="agent"] .agent-farmer-stats {
    display:grid !important;
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:0 !important;
    margin-top:7px !important;
    border-top:1px solid var(--agent-mobile-line) !important;
    border-bottom:1px solid var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats > div {
    min-width:0 !important;
    min-height:42px !important;
    padding:6px 7px !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats > div + div {
    border-left:1px solid var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats span {
    font-size:7.5px !important;
    line-height:1.1 !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats strong {
    margin-top:2px !important;
    font-size:10.5px !important;
    line-height:1.15 !important;
    overflow-wrap:anywhere !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-actions {
    margin-top:7px !important;
    gap:6px !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-actions button {
    min-height:44px !important;
    height:44px !important;
    padding:0 7px !important;
    border-radius:9px !important;
    font-size:10.5px !important;
    line-height:1.1 !important;
  }

  /* General mobile panels in both farmer-facing workflows: one top-level
     surface per section; nested decorative padding is deliberately reduced. */
  body[data-ed-portal="farmer"] #farmer-main-content .surface-card,
  body[data-ed-portal="agent"] #agent-main-content .surface-card {
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .surface-card .surface-inset,
  body[data-ed-portal="agent"] #agent-main-content .surface-card .surface-inset {
    box-shadow:none !important;
  }
}

@media (max-width: 350px) {
  body[data-ed-portal="farmer"] .farmer-quality-metrics {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-stat:nth-child(3) {
    border-left:0 !important;
    border-top:1px solid var(--farmer-mobile-line) !important;
  }
  body[data-ed-portal="farmer"] .farmer-quality-stat:nth-child(4) {
    border-top:1px solid var(--farmer-mobile-line) !important;
  }
  body[data-ed-portal="farmer"] .farmer-wallet-card > .flex {
    align-items:flex-start !important;
  }
  body[data-ed-portal="farmer"] .farmer-wallet-card .btn-accent {
    min-width:96px !important;
    width:96px !important;
  }
}

/* ════════════════════════════════════════════════════════════════════
 * MOBILE INFORMATION ARCHITECTURE v13 — Farmer + Field Agent + Driver
 * Audited tab-by-tab. Mobile shows decisions first, details second.
 * Desktop remains untouched (max-width:768px only).
 * ════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Shared mobile-tab rhythm ------------------------------------------------ */
  body[data-ed-portal="farmer"] #farmer-main-content,
  body[data-ed-portal="agent"] #agent-main-content,
  body[data-ed-portal="truck"] #truck-main-content {
    --mobile-section-gap: 12px;
    --mobile-item-gap: 8px;
    --mobile-card-pad: 11px;
  }
  body[data-ed-portal="farmer"] #farmer-main-content > [class*="space-y-6"],
  body[data-ed-portal="agent"] #agent-main-content > [class*="space-y-6"],
  body[data-ed-portal="truck"] #truck-main-content > [class*="space-y-6"],
  body[data-ed-portal="farmer"] #farmer-main-content [class*="space-y-6"],
  body[data-ed-portal="agent"] #agent-main-content [class*="space-y-6"],
  body[data-ed-portal="truck"] #truck-main-content [class*="space-y-6"] {
    gap: var(--mobile-section-gap) !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .section-eyebrow,
  body[data-ed-portal="agent"] #agent-main-content .section-eyebrow,
  body[data-ed-portal="truck"] #truck-main-content .section-eyebrow {
    font-size: 9px !important;
    line-height: 1.2 !important;
    letter-spacing: .11em !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .card,
  body[data-ed-portal="agent"] #agent-main-content .card,
  body[data-ed-portal="truck"] #truck-main-content .card {
    border-radius: 12px !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .card [class*="text-4xl"],
  body[data-ed-portal="agent"] #agent-main-content .card [class*="text-4xl"],
  body[data-ed-portal="truck"] #truck-main-content .card [class*="text-4xl"] {
    font-size: 24px !important;
    line-height: 1.05 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .card [class*="mt-6"],
  body[data-ed-portal="agent"] #agent-main-content .card [class*="mt-6"],
  body[data-ed-portal="truck"] #truck-main-content .card [class*="mt-6"] { margin-top: 12px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .card [class*="mt-4"],
  body[data-ed-portal="agent"] #agent-main-content .card [class*="mt-4"],
  body[data-ed-portal="truck"] #truck-main-content .card [class*="mt-4"] { margin-top: 9px !important; }

  /* Forms: one task per row, labels never collide with fields. */
  body[data-ed-portal="farmer"] #farmer-main-content form [class*="grid-cols"],
  body[data-ed-portal="agent"] #agent-main-content form [class*="grid-cols"],
  body[data-ed-portal="truck"] #truck-main-content form [class*="grid-cols"] {
    grid-template-columns: minmax(0,1fr) !important;
    gap: 10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content form label,
  body[data-ed-portal="agent"] #agent-main-content form label,
  body[data-ed-portal="truck"] #truck-main-content form label {
    display:block !important;
    margin-bottom:5px !important;
    font-size:10.5px !important;
    line-height:1.3 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content input,
  body[data-ed-portal="farmer"] #farmer-main-content select,
  body[data-ed-portal="farmer"] #farmer-main-content textarea,
  body[data-ed-portal="agent"] #agent-main-content input,
  body[data-ed-portal="agent"] #agent-main-content select,
  body[data-ed-portal="agent"] #agent-main-content textarea,
  body[data-ed-portal="truck"] #truck-main-content input,
  body[data-ed-portal="truck"] #truck-main-content select,
  body[data-ed-portal="truck"] #truck-main-content textarea {
    width:100% !important;
    max-width:100% !important;
    min-height:44px !important;
    font-size:16px !important; /* prevents iOS zoom */
  }

  /* Mobile record-list transformation -------------------------------------
     These tables retain semantic table markup on desktop. On mobile each row
     becomes a compact labeled operational record, eliminating sideways reading. */
  body[data-ed-portal="farmer"] table.mobile-record-table,
  body[data-ed-portal="agent"] table.mobile-record-table {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    border-collapse:separate !important;
  }
  body[data-ed-portal="farmer"] table.mobile-record-table thead,
  body[data-ed-portal="agent"] table.mobile-record-table thead { display:none !important; }
  body[data-ed-portal="farmer"] table.mobile-record-table tbody,
  body[data-ed-portal="agent"] table.mobile-record-table tbody {
    display:grid !important;
    gap:8px !important;
    padding:8px !important;
  }
  body[data-ed-portal="farmer"] table.mobile-record-table tr,
  body[data-ed-portal="agent"] table.mobile-record-table tr {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
    gap:0 12px !important;
    padding:10px 11px !important;
    border:1px solid #202a40 !important;
    border-radius:11px !important;
    background:#0f1523 !important;
    box-shadow:none !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] table.mobile-record-table td,
  body[data-ed-portal="agent"] table.mobile-record-table td {
    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:7px !important;
    min-width:0 !important;
    min-height:31px !important;
    padding:5px 0 !important;
    border:0 !important;
    border-bottom:1px solid rgba(255,255,255,.045) !important;
    font-size:11.5px !important;
    line-height:1.25 !important;
    text-align:right !important;
    overflow-wrap:anywhere !important;
    white-space:normal !important;
  }
  body[data-ed-portal="farmer"] table.mobile-record-table td::before,
  body[data-ed-portal="agent"] table.mobile-record-table td::before {
    content:"";
    flex:0 0 auto;
    color:#7f8aa6;
    font-size:8.5px;
    line-height:1.1;
    font-weight:700;
    letter-spacing:.07em;
    text-transform:uppercase;
    text-align:left;
  }
  body[data-ed-portal="farmer"] table.mobile-record-table td:first-child,
  body[data-ed-portal="agent"] table.mobile-record-table td:first-child {
    grid-column:1 / -1 !important;
    min-height:34px !important;
    padding-top:1px !important;
    font-weight:650 !important;
    text-align:left !important;
  }
  body[data-ed-portal="farmer"] table.mobile-record-table td:first-child::before,
  body[data-ed-portal="agent"] table.mobile-record-table td:first-child::before { margin-right:auto; }
  body[data-ed-portal="farmer"] table.mobile-record-table td:nth-last-child(-n+2),
  body[data-ed-portal="agent"] table.mobile-record-table td:nth-last-child(-n+2) { border-bottom:0 !important; }
  body[data-ed-portal="farmer"] .overflow-x-auto:has(table.mobile-record-table),
  body[data-ed-portal="agent"] .overflow-x-auto:has(table.mobile-record-table) {
    overflow:visible !important;
    max-width:100% !important;
    border:0 !important;
  }

  /* Precise table labels — Farmer */
  .farmer-batches-records td:nth-child(1)::before{content:"Batch"!important}.farmer-batches-records td:nth-child(2)::before{content:"Weight"!important}.farmer-batches-records td:nth-child(3)::before{content:"Grade"!important}.farmer-batches-records td:nth-child(4)::before{content:"Score"!important}.farmer-batches-records td:nth-child(5)::before{content:"Verified"!important}.farmer-batches-records td:nth-child(6)::before{content:"Amount"!important}.farmer-batches-records td:nth-child(7)::before{content:"Status"!important}
  .farmer-payments-pending-records td:nth-child(1)::before{content:"Batch"!important}.farmer-payments-pending-records td:nth-child(2)::before{content:"Weight"!important}.farmer-payments-pending-records td:nth-child(3)::before{content:"Quality"!important}.farmer-payments-pending-records td:nth-child(4)::before{content:"Amount"!important}
  .farmer-payments-history-records td:nth-child(1)::before{content:"Batch"!important}.farmer-payments-history-records td:nth-child(2)::before{content:"Date"!important}.farmer-payments-history-records td:nth-child(3)::before{content:"Weight"!important}.farmer-payments-history-records td:nth-child(4)::before{content:"Quality"!important}.farmer-payments-history-records td:nth-child(5)::before{content:"Amount"!important}.farmer-payments-history-records td:nth-child(6)::before{content:"Status"!important}
  .farmer-withdrawal-records td:nth-child(1)::before{content:"Reference"!important}.farmer-withdrawal-records td:nth-child(2)::before{content:"Amount"!important}.farmer-withdrawal-records td:nth-child(3)::before{content:"Method"!important}.farmer-withdrawal-records td:nth-child(4)::before{content:"Status"!important}
  .farmer-harvest-records td:nth-child(1)::before{content:"Notification"!important}.farmer-harvest-records td:nth-child(2)::before{content:"Bags"!important}.farmer-harvest-records td:nth-child(3)::before{content:"Weight"!important}.farmer-harvest-records td:nth-child(4)::before{content:"Status"!important}.farmer-harvest-records td:nth-child(5)::before{content:"Submitted"!important}
  .farmer-grade-records td:nth-child(1)::before{content:"Date"!important}.farmer-grade-records td:nth-child(2)::before{content:"Grade"!important}.farmer-grade-records td:nth-child(3)::before{content:"Score"!important}.farmer-grade-records td:nth-child(4)::before{content:"AI confidence"!important}.farmer-grade-records td:nth-child(5)::before{content:"Method"!important}.farmer-grade-records td:nth-child(6)::before{content:"Weight"!important}.farmer-grade-records td:nth-child(7)::before{content:"Amount"!important}.farmer-grade-records td:nth-child(8)::before{content:"Payment"!important}
  .farmer-carbon-records td:nth-child(1)::before{content:"Type"!important}.farmer-carbon-records td:nth-child(2)::before{content:"Points"!important}.farmer-carbon-records td:nth-child(3)::before{content:"Value"!important}.farmer-carbon-records td:nth-child(4)::before{content:"Date"!important}
  .farmer-pest-records td:nth-child(1)::before{content:"Diagnosis"!important}.farmer-pest-records td:nth-child(2)::before{content:"Severity"!important}.farmer-pest-records td:nth-child(3)::before{content:"Status"!important}.farmer-pest-records td:nth-child(4)::before{content:"Date"!important}
  .farmer-input-credit-records td:nth-child(1)::before{content:"Date"!important}.farmer-input-credit-records td:nth-child(2)::before{content:"Input"!important}.farmer-input-credit-records td:nth-child(3)::before{content:"Category"!important}.farmer-input-credit-records td:nth-child(4)::before{content:"Quantity"!important}.farmer-input-credit-records td:nth-child(5)::before{content:"Total"!important}.farmer-input-credit-records td:nth-child(6)::before{content:"Repaid"!important}.farmer-input-credit-records td:nth-child(7)::before{content:"Balance"!important}.farmer-input-credit-records td:nth-child(8)::before{content:"Status"!important}
  .farmer-quality-lab-records td:nth-child(1)::before{content:"Test"!important}.farmer-quality-lab-records td:nth-child(2)::before{content:"Lab"!important}.farmer-quality-lab-records td:nth-child(3)::before{content:"Date"!important}.farmer-quality-lab-records td:nth-child(4)::before{content:"Cadmium"!important}.farmer-quality-lab-records td:nth-child(5)::before{content:"Result"!important}
  .farmer-quality-sensory-records td:nth-child(1)::before{content:"Date"!important}.farmer-quality-sensory-records td:nth-child(2)::before{content:"Score"!important}.farmer-quality-sensory-records td:nth-child(3)::before{content:"Smoke odor"!important}.farmer-quality-sensory-records td:nth-child(4)::before{content:"Smoke taste"!important}.farmer-quality-sensory-records td:nth-child(5)::before{content:"Disposition"!important}
  .farmer-market-records td:nth-child(1)::before{content:"Date"!important}.farmer-market-records td:nth-child(2)::before{content:"Price"!important}.farmer-market-records td:nth-child(3)::before{content:"Source"!important}.farmer-market-records td:nth-child(4)::before{content:"Region"!important}

  /* Precise table labels — Field Agent */
  .agent-batches-records td:nth-child(1)::before{content:"Batch"!important}.agent-batches-records td:nth-child(2)::before{content:"Farmer"!important}.agent-batches-records td:nth-child(3)::before{content:"Weight"!important}.agent-batches-records td:nth-child(4)::before{content:"Grade"!important}.agent-batches-records td:nth-child(5)::before{content:"Score"!important}.agent-batches-records td:nth-child(6)::before{content:"Verified"!important}.agent-batches-records td:nth-child(7)::before{content:"Status"!important}
  .agent-harvest-alert-records td:nth-child(1)::before{content:"Notification"!important}.agent-harvest-alert-records td:nth-child(2)::before{content:"Farmer"!important}.agent-harvest-alert-records td:nth-child(3)::before{content:"Village"!important}.agent-harvest-alert-records td:nth-child(4)::before{content:"Bags"!important}.agent-harvest-alert-records td:nth-child(5)::before{content:"Weight"!important}.agent-harvest-alert-records td:nth-child(6)::before{content:"Status"!important}.agent-harvest-alert-records td:nth-child(7)::before{content:"Action"!important}
  .agent-float-records td:nth-child(1)::before{content:"Float"!important}.agent-float-records td:nth-child(2)::before{content:"Advance"!important}.agent-float-records td:nth-child(3)::before{content:"Spent"!important}.agent-float-records td:nth-child(4)::before{content:"Balance"!important}.agent-float-records td:nth-child(5)::before{content:"Used"!important}.agent-float-records td:nth-child(6)::before{content:"Status"!important}.agent-float-records td:nth-child(7)::before{content:"Date"!important}
  .agent-input-records td:nth-child(1)::before{content:"Distribution"!important}.agent-input-records td:nth-child(2)::before{content:"Farmer"!important}.agent-input-records td:nth-child(3)::before{content:"Input"!important}.agent-input-records td:nth-child(4)::before{content:"Quantity"!important}.agent-input-records td:nth-child(5)::before{content:"Total"!important}.agent-input-records td:nth-child(6)::before{content:"Balance"!important}.agent-input-records td:nth-child(7)::before{content:"Status"!important}.agent-input-records td:nth-child(8)::before{content:"Date"!important}

  /* FARMER — exact 17-tab mobile behavior -------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-wallet-card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-quality-card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-activity-card { margin-bottom:10px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-wallet-card { padding:12px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-wallet-card [class*="text-3xl"] { font-size:22px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-quality-metrics { grid-template-columns:repeat(4,minmax(0,1fr)) !important; gap:0 !important; border:1px solid #202a40; border-radius:10px; overflow:hidden; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-quality-stat { padding:8px 4px !important; min-height:64px !important; border-radius:0 !important; border-right:1px solid #202a40; background:transparent !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-quality-stat:last-child { border-right:0; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-quality-stat [class*="text-4xl"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-quality-stat [class*="text-3xl"] { font-size:18px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-activity-list { display:block !important; border:1px solid #202a40; border-radius:10px; overflow:hidden; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-activity-list > * { border:0 !important; border-radius:0 !important; border-bottom:1px solid #202a40 !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-activity-list > *:last-child { border-bottom:0 !important; }

  /* Batches/payments/history: list records, not compressed desktop tables. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="batches"] .card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="payments"] .card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="grade-history"] .card { overflow:visible !important; }

  /* My Farms: one farm per compact block; mapping gets the width it needs. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] [class*="grid-cols-2"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] [class*="grid-cols-3"] { grid-template-columns:minmax(0,1fr) !important; }

  /* Smart advisory/advisory: content is reading-first, no oversized tiles. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] [class*="grid-cols-2"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] [class*="grid-cols-3"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] [class*="grid-cols-2"] { grid-template-columns:minmax(0,1fr) !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .card { padding:11px !important; }

  /* Scanners: scanner/camera occupies visual priority; history becomes records. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] [class*="grid-cols-2"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] [class*="grid-cols-2"] { grid-template-columns:minmax(0,1fr) !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] img,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] video,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] canvas { max-height:46dvh !important; object-fit:contain !important; }

  /* Sustainability / quality / input credit: summary first, record list second. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] [class*="grid-cols-3"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] [class*="grid-cols-4"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="quality"] [class*="grid-cols-3"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] [class*="grid-cols-3"] { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:8px !important; }

  /* Notify Harvest + Farm Activities: task forms stay short and sequential. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] form,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] form { display:grid !important; gap:10px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] form button[type="submit"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] form button[type="submit"] { width:100% !important; }

  /* Yield + Market: chart first, compact metrics, no clipped axis/labels. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] [class*="grid-cols-3"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] [class*="grid-cols-3"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] [class*="grid-cols-4"] { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:8px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] svg,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] svg { max-width:100% !important; overflow:visible !important; }

  /* AI Assistant: task launchers can be 2-up; responses are always full width. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] [class*="grid-cols-3"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] [class*="grid-cols-4"] { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:8px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] textarea { min-height:88px !important; }

  /* AGENT — exact 8-tab mobile behavior ----------------------------------- */
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmer-list { border-radius:11px !important; overflow:hidden !important; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmer-row { border-radius:0 !important; border-left:0 !important; border-right:0 !important; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmer-stats { display:flex !important; align-items:center !important; gap:0 !important; border-top:1px solid #202a40; border-bottom:1px solid #202a40; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmer-stats > div { flex:1 1 0 !important; border:0 !important; border-radius:0 !important; padding:6px 5px !important; text-align:center; border-right:1px solid #202a40 !important; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmer-stats > div:last-child { border-right:0 !important; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmer-actions { grid-template-columns:1fr 1fr !important; }

  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="batches"] .card,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .card,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="float"] .card,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="inputs"] .card { overflow:visible !important; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-harvest-alert-records td:last-child { grid-column:1 / -1 !important; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-harvest-alert-records td:last-child button { width:100% !important; }

  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="register"] { padding-bottom:100px !important; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="register"] > .card { padding:12px !important; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="register"] button { width:100% !important; }

  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="advisory"] .card { padding:11px !important; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] [class*="grid-cols-3"],
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] [class*="grid-cols-4"] { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:8px !important; }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] textarea { min-height:88px !important; }

  /* DRIVER / TRUCK — exact 6-tab mobile-first shell ----------------------- */
  body[data-ed-portal="truck"] {
    --truck-mobile-bg:#080c13;
    --truck-mobile-panel:#101625;
    --truck-mobile-line:#202a40;
    --truck-mobile-muted:#8e98b3;
    --truck-mobile-accent:#f59e0b;
    background:var(--truck-mobile-bg) !important;
  }
  body[data-ed-portal="truck"] .truck-dashboard-root {
    background:var(--truck-mobile-bg) !important;
    min-height:100dvh !important;
    overflow-x:hidden !important;
    padding-bottom:calc(76px + env(safe-area-inset-bottom)) !important;
  }
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar {
    position:fixed !important;
    top:0 !important; left:0 !important; right:0 !important;
    z-index:45 !important;
    background:rgba(8,12,19,.96) !important;
    backdrop-filter:blur(16px) saturate(140%);
    border-bottom:1px solid var(--truck-mobile-line) !important;
  }
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar > div:first-child { height:56px !important; padding-left:14px !important; padding-right:12px !important; }
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar > div:first-child > .flex:first-child { display:none !important; }
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar > div:first-child > .flex:last-child { margin-left:auto !important; }
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar > div:first-child > .flex:last-child > *:last-child { display:none !important; } /* mobile logout is in drawer */
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar > div:nth-child(2) {
    display:grid !important;
    grid-auto-flow:column !important;
    grid-auto-columns:minmax(112px,42vw) !important;
    grid-template-columns:none !important;
    gap:7px !important;
    overflow-x:auto !important;
    scrollbar-width:none !important;
    padding:0 12px 8px !important;
  }
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar > div:nth-child(2)::-webkit-scrollbar { display:none; }
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar > div:nth-child(2) > * { min-height:48px !important; padding:7px 9px !important; }
  body[data-ed-portal="truck"] .truck-mobile-gps { padding:122px 10px 0 !important; }
  body[data-ed-portal="truck"] .truck-mobile-gps > button { min-height:48px !important; padding:9px 11px !important; border-radius:11px !important; font-size:12px !important; }
  body[data-ed-portal="truck"] #truck-main-content.ed-mobile-main-v8,
  body[data-ed-portal="truck"] #truck-main-content {
    width:100% !important;
    max-width:100% !important;
    margin:0 !important;
    padding:10px 10px calc(88px + env(safe-area-inset-bottom)) !important;
    overflow-x:hidden !important;
    touch-action:pan-y !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .card { background:#101625 !important; border-color:var(--truck-mobile-line) !important; }
  body[data-ed-portal="truck"] #truck-main-content [class*="p-6"] { padding:14px !important; }
  body[data-ed-portal="truck"] #truck-main-content [class*="p-5"] { padding:12px !important; }
  body[data-ed-portal="truck"] #truck-main-content [class*="p-4"] { padding:11px !important; }

  body[data-ed-portal="truck"] .truck-mobile-bottom-nav {
    position:fixed !important;
    left:0 !important; right:0 !important; bottom:0 !important;
    z-index:50 !important;
    display:grid !important;
    grid-template-columns:repeat(5,minmax(0,1fr)) !important;
    padding:6px 6px calc(6px + env(safe-area-inset-bottom)) !important;
    background:rgba(8,12,19,.96) !important;
    border-top:1px solid var(--truck-mobile-line) !important;
    backdrop-filter:blur(16px) saturate(140%);
  }
  body[data-ed-portal="truck"] .truck-mobile-bottom-tab {
    appearance:none !important;
    border:0 !important;
    background:transparent !important;
    min-width:0 !important;
    min-height:50px !important;
    padding:3px 2px !important;
    border-radius:10px !important;
    color:#7f8aa6 !important;
    display:flex !important;
    flex-direction:column !important;
    align-items:center !important;
    justify-content:center !important;
    gap:2px !important;
    font-size:9px !important;
    font-weight:650 !important;
    line-height:1.1 !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-bottom-tab.is-active { color:var(--truck-mobile-accent) !important; background:rgba(245,158,11,.07) !important; }
  body[data-ed-portal="truck"] .truck-mobile-bottom-icon { height:21px; display:grid; place-items:center; }
  body[data-ed-portal="truck"] .truck-dashboard-root .copilot-fab { bottom:calc(74px + env(safe-area-inset-bottom)) !important; right:12px !important; width:44px !important; height:44px !important; }

  /* Driver tabs */
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="dispatches"] .space-y-3 { gap:8px !important; }
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="dispatches"] .card { padding:11px !important; }
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="bags"] [class*="grid-cols"] { grid-template-columns:minmax(0,1fr) !important; }
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="bags"] button { min-height:44px !important; }
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="map"] .leaflet-container { min-height:calc(100dvh - 270px) !important; height:calc(100dvh - 270px) !important; }
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="map"] [class*="h-[60vh]"] { height:calc(100dvh - 270px) !important; min-height:330px !important; }
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="stats"] [class*="grid-cols-2"] { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:8px !important; }
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="stats"] [class*="text-4xl"] { font-size:24px !important; }
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="maintenance"] [class*="grid-cols-2"],
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="maintenance"] [class*="grid-cols-3"] { grid-template-columns:minmax(0,1fr) !important; }
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="route-ai"] [class*="grid-cols-2"],
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="route-ai"] [class*="grid-cols-3"] { grid-template-columns:minmax(0,1fr) !important; }
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="route-ai"] pre,
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="route-ai"] code { white-space:pre-wrap !important; overflow-wrap:anywhere !important; }

  /* Shared drawer positioning for the three mobile-first workspaces. */
  body[data-ed-portal="truck"].ed-mobile-drawer-is-open { overflow:hidden !important; touch-action:none !important; }
  body[data-ed-portal="truck"] .ed-mobile-workspace-trigger { z-index:48 !important; max-width:175px !important; }
  body[data-ed-portal="truck"] .ed-sidebar-footer-v8 .ed-mobile-logout { width:100% !important; min-height:46px !important; }
}

@media (max-width: 360px) {
  body[data-ed-portal="farmer"] table.mobile-record-table tr,
  body[data-ed-portal="agent"] table.mobile-record-table tr { grid-template-columns:minmax(0,1fr) !important; }
  body[data-ed-portal="farmer"] table.mobile-record-table td,
  body[data-ed-portal="agent"] table.mobile-record-table td { grid-column:1 / -1 !important; }
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar > div:nth-child(2) { grid-auto-columns:minmax(108px,48vw) !important; }
}

/* v10.8 — MOBILE DRAWER PROPORTION REFINEMENT
   Keep touch targets and typography intact; reduce only drawer footprint so
   more of the underlying workspace remains visually anchored on phones. */
@media (max-width: 768px) {
  body.ed-mobile-portal-active .ed-sidebar,
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar,
  body[data-ed-portal="agent"].ed-mobile-portal-active .ed-sidebar,
  body[data-ed-portal="truck"].ed-mobile-portal-active .ed-sidebar {
    width:min(82vw, 312px) !important;
    max-width:312px !important;
  }
}

/* v10.9 — FARMER SMART ADVISORY MOBILE INFORMATION ARCHITECTURE
   Mobile overview keeps Smart Advisory as a dedicated destination, not a duplicate teaser.
   Smart Advisory itself is reading-first: compact hero, single-column task flow, bounded
   controls and dense context cards. Desktop remains unchanged. */
@media (max-width: 768px) {
  /* Overview: remove the Smart Advisory teaser only on phones. The dedicated tab remains. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-overview-smart-advisory {
    display:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-overview-weather-card {
    width:100% !important;
    min-width:0 !important;
  }

  /* Dedicated Smart Advisory: compact, sequential, reading-first. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-page {
    width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-page > * + * {
    margin-top:10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero {
    padding:12px !important;
    border-width:1px !important;
    border-radius:12px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero > div {
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero .min-w-\[260px\] {
    min-width:0 !important;
    width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero h2 {
    font-size:17px !important;
    line-height:1.22 !important;
    letter-spacing:-.015em !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero p {
    font-size:12px !important;
    line-height:1.45 !important;
    overflow-wrap:anywhere !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero > div > div:last-child {
    align-items:flex-start !important;
    width:100% !important;
  }

  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-layout {
    display:flex !important;
    flex-direction:column !important;
    gap:10px !important;
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-primary,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-context {
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-primary > * + *,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-context > * + * {
    margin-top:10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-timeline,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-agronomist,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-weather,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-risk {
    padding:11px !important;
    border-radius:12px !important;
    min-width:0 !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-timeline,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-agronomist {
    border-left-width:3px !important;
  }

  /* Timeline component: remove desktop-scale padding and keep controls usable. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card {
    width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card > * + * {
    margin-top:10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card > div:first-child {
    align-items:stretch !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card > div:first-child > div {
    width:100% !important;
    min-width:0 !important;
    justify-content:space-between !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card select {
    min-height:40px !important;
    max-width:180px !important;
    font-size:14px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card button {
    min-height:40px !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card .p-5 {
    padding:11px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card .p-4 {
    padding:10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card .p-3 {
    padding:9px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card h3,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card h4,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card h5,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card p,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card li,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card span {
    max-width:100% !important;
    overflow-wrap:anywhere !important;
    word-break:normal !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card [class*="gap-4"] {
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card [class*="space-y-4"] > * + * {
    margin-top:10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card [class*="space-y-3"] > * + * {
    margin-top:8px !important;
  }

  /* Context stays concise below the action plan; widgets never force viewport overflow. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-weather *,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-risk * {
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-weather canvas,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-weather svg,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-risk canvas,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-risk svg {
    width:100% !important;
    height:auto !important;
  }
}

/* v10.10 — FARMER PORTAL MICRO-AUDIT: 17-TAB MOBILE DENSITY + ALIGNMENT
   Audited against the actual FarmerDashboard tab registry and each tab render target.
   Goal: remove desktop-card scale, prevent vertical label stacking where horizontal scanning
   is clearer, preserve 44px controls, and keep detail expansion available without bloating
   the default mobile state. Desktop is intentionally untouched. */
@media (max-width: 768px) {
  /* Global Farmer mobile rhythm — applies to all 17 real tab states. */
  body[data-ed-portal="farmer"] #farmer-main-content {
    padding-left:12px !important;
    padding-right:12px !important;
    padding-top:12px !important;
    padding-bottom:calc(92px + env(safe-area-inset-bottom)) !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content > [class*="space-y-6"] > * + * { margin-top:10px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content > [class*="space-y-4"] > * + * { margin-top:9px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .section-title {
    font-size:15px !important;
    line-height:1.25 !important;
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .section-eyebrow {
    font-size:9px !important;
    line-height:1.25 !important;
    letter-spacing:.08em !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .card {
    border-radius:11px !important;
    max-width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .card > .p-5,
  body[data-ed-portal="farmer"] #farmer-main-content .card > [class~="p-5"] { padding:11px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .card > .p-8,
  body[data-ed-portal="farmer"] #farmer-main-content .card > [class~="p-8"] { padding:14px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content p,
  body[data-ed-portal="farmer"] #farmer-main-content span,
  body[data-ed-portal="farmer"] #farmer-main-content label,
  body[data-ed-portal="farmer"] #farmer-main-content li {
    overflow-wrap:break-word !important;
    word-break:normal !important;
  }

  /* SMART ADVISORY — today priorities is a compact horizontal-scanning workflow. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-timeline {
    padding:10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-timeline-heading {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:4px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-timeline-heading > div:first-child {
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-timeline-heading > div:first-child > div:first-child {
    width:30px !important; height:30px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-timeline-heading p:last-child {
    font-size:11.5px !important; line-height:1.35 !important; margin-top:2px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-controls {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:center !important;
    gap:7px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-controls > div {
    width:auto !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-controls > div:first-child {
    display:grid !important;
    grid-template-columns:auto minmax(0,1fr) !important;
    align-items:center !important;
    gap:6px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-controls label { white-space:nowrap !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-controls select {
    width:100% !important; max-width:128px !important; min-height:36px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-controls button {
    min-height:36px !important; padding:6px 9px !important; white-space:nowrap !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-summary-banner,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-collaboration {
    padding:9px !important; border-radius:10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-summary-banner p.text-base {
    font-size:12.5px !important; line-height:1.4 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-collaboration > div:first-child {
    display:flex !important; flex-direction:row !important; align-items:center !important; gap:6px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-collaboration > div:first-child h3 {
    flex:1 1 auto !important; min-width:0 !important; margin:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-urgent-alert {
    padding:9px !important; border-left-width:3px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-urgent-alert > div:first-child {
    display:flex !important; flex-direction:row !important; align-items:center !important; gap:6px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-day-group {
    border-left:0 !important; padding-left:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-day-group > p:first-child {
    margin:0 0 5px !important; padding:0 2px !important; font-size:9.5px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-item {
    border-radius:9px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-head {
    padding:8px 9px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-head > div:first-child {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:start !important;
    gap:7px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-meta {
    display:flex !important; flex-direction:row !important; flex-wrap:wrap !important;
    align-items:center !important; gap:4px 6px !important; margin-bottom:3px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-meta > span {
    display:inline-flex !important; width:auto !important; max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-head p.text-sm {
    font-size:12.5px !important; line-height:1.35 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-head p.text-xs {
    font-size:10.5px !important; line-height:1.3 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-badges {
    display:flex !important; flex-direction:row !important; flex-wrap:wrap !important; gap:4px !important; margin-top:5px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-badges > span {
    width:auto !important; flex:0 0 auto !important; padding:2px 6px !important; font-size:9.5px !important;
  }

  /* BATCHES / PAYMENTS / GRADE / QUALITY — dense record lists, compact headers. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="batches"] .card > .border-b,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="payments"] .card > .border-b,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="grade-history"] .card > .border-b,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="quality"] .card > .border-b,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .card > .border-b {
    padding:10px 11px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .mobile-record-table tbody tr {
    padding:9px 10px !important; gap:5px 10px !important; border-radius:9px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .mobile-record-table td {
    min-height:22px !important; padding:1px 0 !important; font-size:11.5px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .mobile-record-table td::before {
    font-size:9px !important; letter-spacing:.07em !important;
  }

  /* FARMS — keep map prominent, compress surrounding farm metadata. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .card { padding:10px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] [class*="text-2xl"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] [class*="text-3xl"] { font-size:18px !important; }

  /* ADVISORY — each agronomy item reads as one compact row, title/category horizontal. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .farmer-advisory-item { padding:9px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .farmer-advisory-item > div:first-child {
    display:grid !important; grid-template-columns:minmax(0,1fr) auto !important; align-items:center !important; gap:6px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .farmer-advisory-item h4 {
    white-space:normal !important; overflow:visible !important; text-overflow:clip !important; font-size:12.5px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .farmer-advisory-item > p { font-size:11.5px !important; line-height:1.4 !important; }

  /* SUSTAINABILITY — turn decorative 4-card block into a dense 2x2 metric matrix. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary { padding:10px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary > .grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:6px !important; margin-top:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary > .grid > div {
    padding:7px !important; min-height:62px !important; display:grid !important; place-content:center !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary .text-3xl,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary .text-4xl { font-size:18px !important; margin-bottom:2px !important; }

  /* HARVEST / ACTIVITIES — form fields stay compact but readable; related values align horizontally. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] form [class*="grid-cols-2"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] form [class*="grid-cols-2"] {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:7px !important;
  }
  @media (max-width: 350px) {
    body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] form [class*="grid-cols-2"],
    body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] form [class*="grid-cols-2"] { grid-template-columns:1fr !important; }
  }

  /* YIELD — one compact farm result; metrics scan in 2 columns, detail rail stays paired. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card { padding:10px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card > .grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:7px !important; margin-top:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card .text-lg { font-size:15px !important; }

  /* SCANNERS — utility controls first, media second, no decorative oversized zones. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] .card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .card { padding:10px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] [class*="text-3xl"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] [class*="text-3xl"] { font-size:20px !important; }

  /* AI ASSISTANT — launchers compact; narrative responses remain full-width. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] .card { padding:10px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] .surface-inset { padding:9px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] [class*="grid-cols-4"] > *,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] [class*="grid-cols-3"] > * { min-height:0 !important; }

  /* MARKET — prices are glanceable 2-up; analysis remains reading-first. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .card { padding:10px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] [class*="text-2xl"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] [class*="text-3xl"] { font-size:18px !important; }
}

/* ═══════════════════════════════════════════════════════════════════════
   v10.11 — FARMER MOBILE SCREENSHOT-VALIDATED GEOMETRY FIX
   Corrects the concrete failures observed at 521×872: collapsed text columns,
   half-width overview modules, oversized/fragmented summaries, cramped farm
   maps, and narrow weather/disease panels. Mobile-only. Desktop untouched.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* 1. Mobile content geometry: no section may collapse below the content lane. */
  body[data-ed-portal="farmer"] #farmer-main-content,
  body[data-ed-portal="farmer"] #farmer-main-content > *,
  body[data-ed-portal="farmer"] #farmer-main-content .surface-card,
  body[data-ed-portal="farmer"] #farmer-main-content .surface-inset,
  body[data-ed-portal="farmer"] #farmer-main-content .card {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }

  /* Normal prose must wrap by words, never one character at a time. */
  body[data-ed-portal="farmer"] #farmer-main-content h1,
  body[data-ed-portal="farmer"] #farmer-main-content h2,
  body[data-ed-portal="farmer"] #farmer-main-content h3,
  body[data-ed-portal="farmer"] #farmer-main-content h4,
  body[data-ed-portal="farmer"] #farmer-main-content h5,
  body[data-ed-portal="farmer"] #farmer-main-content p,
  body[data-ed-portal="farmer"] #farmer-main-content label,
  body[data-ed-portal="farmer"] #farmer-main-content span:not(.nums) {
    overflow-wrap:break-word !important;
    word-break:normal !important;
    writing-mode:horizontal-tb !important;
  }

  /* SectionHeader: force a real horizontal header row with a flexible text lane. */
  body[data-ed-portal="farmer"] #farmer-main-content .card > div[class*="justify-between"]:has(.section-title),
  body[data-ed-portal="farmer"] #farmer-main-content .surface-card > div[class*="justify-between"]:has(.section-title) {
    display:flex !important;
    flex-direction:row !important;
    align-items:flex-start !important;
    justify-content:space-between !important;
    width:100% !important;
    min-width:0 !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .section-title {
    width:auto !important;
    min-width:0 !important;
    max-width:100% !important;
    white-space:normal !important;
  }

  /* 2. Primary KPI lane: explicitly retain a stable 2×2 mobile matrix. */
  body[data-ed-portal="farmer"] .farmer-farms-kpi-grid {
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] .farmer-farms-kpi-grid > * {
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-farms-kpi-grid .text-2xl,
  body[data-ed-portal="farmer"] .farmer-farms-kpi-grid .text-3xl {
    font-size:17px !important;
    line-height:1.1 !important;
    white-space:normal !important;
  }

  /* 3. Overview activity: compact horizontal list rows, no collapsed title column. */
  body[data-ed-portal="farmer"] .farmer-activity-card,
  body[data-ed-portal="farmer"] .farmer-activity-list,
  body[data-ed-portal="farmer"] .farmer-summary-row {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-row {
    display:grid !important;
    grid-template-columns:28px minmax(0,1fr) auto !important;
    align-items:center !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-copy {
    min-width:0 !important;
    width:auto !important;
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:center !important;
    column-gap:8px !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-label {
    grid-column:1 !important;
    margin:0 !important;
    font-size:10px !important;
    line-height:1.2 !important;
    white-space:normal !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-value {
    grid-column:2 !important;
    margin:0 !important;
    font-size:15px !important;
    line-height:1 !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="farmer"] .farmer-summary-copy > p:nth-child(3) { display:none !important; }

  /* 4. Overview conditions: Smart Advisory teaser is gone; weather owns full lane. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-overview-conditions-grid {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-overview-smart-advisory {
    display:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-overview-weather-card {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    padding:11px !important;
    margin:10px 0 0 !important;
    overflow:hidden !important;
  }

  /* 5. Weather: full-width current row + horizontally scrollable daily strip. */
  body[data-ed-portal="farmer"] .farmer-weather-widget,
  body[data-ed-portal="farmer"] .farmer-weather-current,
  body[data-ed-portal="farmer"] .farmer-weather-source {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] .farmer-weather-current {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:center !important;
    gap:10px !important;
  }
  body[data-ed-portal="farmer"] .farmer-weather-primary {
    min-width:0 !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] .farmer-weather-primary > span {
    font-size:28px !important;
    flex:0 0 auto !important;
  }
  body[data-ed-portal="farmer"] .farmer-weather-primary .text-3xl {
    font-size:22px !important;
  }
  body[data-ed-portal="farmer"] .farmer-weather-details {
    min-width:92px !important;
    text-align:right !important;
    font-size:10.5px !important;
    line-height:1.25 !important;
  }
  body[data-ed-portal="farmer"] .farmer-weather-forecast {
    display:grid !important;
    grid-auto-flow:column !important;
    grid-template-columns:none !important;
    grid-auto-columns:68px !important;
    gap:5px !important;
    width:100% !important;
    overflow-x:auto !important;
    overscroll-behavior-inline:contain !important;
    -webkit-overflow-scrolling:touch !important;
    scrollbar-width:none !important;
    padding-bottom:2px !important;
  }
  body[data-ed-portal="farmer"] .farmer-weather-forecast::-webkit-scrollbar { display:none !important; }
  body[data-ed-portal="farmer"] .farmer-weather-forecast > div {
    width:68px !important;
    min-width:68px !important;
    padding:6px 4px !important;
  }
  body[data-ed-portal="farmer"] .farmer-weather-source {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:center !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] .farmer-weather-source span { min-width:0 !important; }

  /* 6. Disease risk: full-width records with predictable header/meta geometry. */
  body[data-ed-portal="farmer"] .farmer-disease-risk,
  body[data-ed-portal="farmer"] .farmer-disease-list,
  body[data-ed-portal="farmer"] .farmer-disease-item {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] .farmer-disease-overall {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:center !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] .farmer-disease-item {
    padding:10px !important;
    border-radius:10px !important;
  }
  body[data-ed-portal="farmer"] .farmer-disease-head {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:start !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] .farmer-disease-name {
    min-width:0 !important;
    margin:0 !important;
    font-size:12px !important;
    line-height:1.25 !important;
  }
  body[data-ed-portal="farmer"] .farmer-disease-score {
    flex-wrap:nowrap !important;
    align-items:center !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="farmer"] .farmer-disease-drivers,
  body[data-ed-portal="farmer"] .farmer-disease-action {
    font-size:10.5px !important;
    line-height:1.4 !important;
    margin-top:5px !important;
  }
  body[data-ed-portal="farmer"] .farmer-disease-meta {
    display:flex !important;
    flex-direction:row !important;
    flex-wrap:wrap !important;
    gap:3px 10px !important;
    font-size:9.5px !important;
    line-height:1.25 !important;
  }
  body[data-ed-portal="farmer"] .farmer-disease-meta > span { white-space:nowrap !important; }
  body[data-ed-portal="farmer"] .farmer-disease-source {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:center !important;
    gap:8px !important;
    font-size:9.5px !important;
  }
  body[data-ed-portal="farmer"] .farmer-disease-source span { min-width:0 !important; }

  /* 7. My Farms: 2×2 summary, full-width farm card, uncluttered map canvas. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-card {
    width:100% !important;
    padding:0 !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-card > .p-5,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-card > [class~="p-5"] {
    padding:10px 11px !important;
  }

  /* 8. Smart Advisory: all cards/context modules consume the full mobile lane. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-page,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-layout,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-primary,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-context,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-timeline,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-agronomist,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-weather,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-risk {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }

  /* 9. Floating Copilot should not collide with the fixed bottom navigation. */
  body[data-ed-portal="farmer"] .farmer-dashboard-root .copilot-fab {
    right:12px !important;
    bottom:calc(84px + env(safe-area-inset-bottom,0px)) !important;
  }
}

@media (max-width: 380px) {
  body[data-ed-portal="farmer"] .farmer-weather-current {
    grid-template-columns:1fr !important;
    gap:6px !important;
  }
  body[data-ed-portal="farmer"] .farmer-weather-details {
    display:flex !important;
    flex-direction:row !important;
    flex-wrap:wrap !important;
    gap:3px 10px !important;
    min-width:0 !important;
    text-align:left !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   v10.12 — FARMER PORTAL COMPLETE 17-TAB MOBILE LAYOUT CONTRACT
   Final mobile-only reset derived from the 521×872 runtime screenshots and
   a tab-by-tab source audit. It removes character-column collapse, gives
   every section a real content lane, and standardizes all Farmer tab cards,
   forms, records, maps, scanners and AI modules. Desktop is untouched.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body[data-ed-portal="farmer"] #farmer-main-content {
    --fm-gap:10px;
    --fm-pad:11px;
    --fm-line:#202a40;
    --fm-radius:12px;
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    overflow-x:hidden !important;
  }

  /* Every audited tab owns the complete content lane. */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root > *,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .card,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .surface-card,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .surface-inset {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root [class*="grid"],
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root [class*="flex"] {
    min-width:0 !important;
    max-width:100% !important;
  }

  /* Remove the earlier broad break-anywhere behavior. Normal UI copy must
     wrap by words and always remain horizontal. */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root h1,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root h2,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root h3,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root h4,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root h5,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root h6,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root p,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root label,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root li,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root span:not(.nums):not([class*="sr-only"]) {
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
    white-space:normal;
  }

  /* Shared SectionHeader is converted into a deterministic two-track mobile
     header. This fixes Activity Summary, Weather & Disease Risk, Harvest,
     Biological Capacity, Sustainability, AI Agronomist and every other tab
     using the same primitive. */
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:start !important;
    gap:8px !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-main {
    display:grid !important;
    grid-template-columns:auto minmax(0,1fr) !important;
    align-items:start !important;
    gap:9px !important;
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-copy {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-icon {
    width:32px !important;
    height:32px !important;
    min-width:32px !important;
    min-height:32px !important;
    max-width:32px !important;
    max-height:32px !important;
    flex:none !important;
    padding:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-icon svg {
    width:16px !important;
    height:16px !important;
    min-width:16px !important;
    min-height:16px !important;
    max-width:16px !important;
    max-height:16px !important;
    flex:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header .section-title {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    overflow:visible !important;
    text-overflow:clip !important;
    white-space:normal !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
    line-height:1.22 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-actions {
    display:flex !important;
    flex-wrap:wrap !important;
    justify-content:flex-end !important;
    gap:6px !important;
    min-width:0 !important;
    max-width:44vw !important;
  }

  /* MetricTile gets a stable copy + icon grid. This prevents values such as
     0.19 ha from collapsing into one-character columns. */
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-tile {
    min-width:0 !important;
    max-width:100% !important;
    padding:10px !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-body {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) 30px !important;
    align-items:start !important;
    gap:8px !important;
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-copy {
    min-width:0 !important;
    width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-label {
    display:block !important;
    overflow:visible !important;
    text-overflow:clip !important;
    white-space:normal !important;
    font-size:9px !important;
    line-height:1.2 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-value {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    margin-top:6px !important;
    font-size:17px !important;
    line-height:1.12 !important;
    white-space:normal !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-hint {
    overflow:visible !important;
    text-overflow:clip !important;
    white-space:normal !important;
    font-size:10px !important;
    line-height:1.2 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-icon {
    width:30px !important;
    height:30px !important;
    min-width:30px !important;
    min-height:30px !important;
    margin-left:0 !important;
    padding:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-icon svg {
    width:15px !important;
    height:15px !important;
  }

  /* Shared card rhythm across all 17 tabs. */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .card {
    border-radius:var(--fm-radius) !important;
    overflow-wrap:normal !important;
    word-break:normal !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root > * + * {
    margin-top:var(--fm-gap) !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .section-eyebrow {
    font-size:8.5px !important;
    line-height:1.2 !important;
  }

  /* OVERVIEW ----------------------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-kpi-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-quality-metrics {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-quality-stat {
    min-width:0 !important;
    min-height:58px !important;
    padding:7px 5px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-activity-card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-activity-list,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-overview-weather-card {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-overview-conditions-grid {
    display:block !important;
    width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-overview-smart-advisory { display:none !important; }

  /* BATCHES / PAYMENTS / GRADES / CREDIT / QUALITY / MARKET records ---- */
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    border:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table thead { display:none !important; }
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table tbody {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:8px !important;
    width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table tr {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:0 !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    padding:8px 10px !important;
    border:1px solid var(--fm-line) !important;
    border-radius:10px !important;
    background:#0f1423 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table td {
    position:static !important;
    display:grid !important;
    grid-template-columns:minmax(88px,38%) minmax(0,1fr) !important;
    align-items:center !important;
    gap:8px !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    min-height:30px !important;
    padding:4px 0 !important;
    border:0 !important;
    border-bottom:1px solid rgba(32,42,64,.72) !important;
    box-shadow:none !important;
    background:transparent !important;
    white-space:normal !important;
    text-align:right !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table td:last-child { border-bottom:0 !important; }
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table td::before {
    text-align:left !important;
    color:#7f8aa8 !important;
    font-size:8.5px !important;
    line-height:1.2 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .overflow-x-auto:has(table.mobile-record-table) {
    overflow:visible !important;
    width:100% !important;
    max-width:100% !important;
    padding:8px !important;
  }

  /* FARMS -------------------------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farms-kpi-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farms-info-card > div {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-card {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-stats {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-stats > div {
    min-width:0 !important;
    padding:7px 8px !important;
    border:1px solid var(--fm-line) !important;
    border-radius:8px !important;
  }

  /* SMART ADVISORY ----------------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-layout {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-primary,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-context,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-timeline,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-agronomist,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-weather,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-risk,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-timeline-card {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  /* Undo the older broad 100%-SVG rule; only charts should ever stretch. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-weather svg,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-risk svg {
    width:auto !important;
    height:auto !important;
    max-width:24px !important;
    max-height:24px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-head {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:6px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-badges,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .advisory-action-meta {
    display:flex !important;
    flex-direction:row !important;
    flex-wrap:wrap !important;
    gap:4px 7px !important;
    width:100% !important;
  }

  /* PEST + PRODUCT SCANNERS ------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] .farmer-tab-pest-scanner,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-tab-product-scanner {
    width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] img,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] img,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] video,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] canvas {
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    height:auto !important;
    max-height:48dvh !important;
    object-fit:contain !important;
  }

  /* SUSTAINABILITY ----------------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-section-card {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary > .grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary > .grid > div {
    min-width:0 !important;
    padding:8px !important;
  }

  /* ADVISORY ----------------------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .farmer-advisory-item > div:first-child {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:start !important;
    gap:7px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .farmer-advisory-item h4 {
    overflow:visible !important;
    text-overflow:clip !important;
    white-space:normal !important;
  }

  /* HARVEST ------------------------------------------------------------ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-harvest-form-card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] form {
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] form [class*="grid-cols"] {
    grid-template-columns:minmax(0,1fr) !important;
    gap:9px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-batch-verify-row {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-batch-verify-row > div:last-child {
    width:100% !important;
    display:flex !important;
    flex-wrap:wrap !important;
    gap:6px !important;
  }

  /* INPUT CREDIT ------------------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .farmer-input-credit-summary {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .farmer-input-credit-summary > :last-child {
    grid-column:1 / -1 !important;
  }

  /* QUALITY ------------------------------------------------------------ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="quality"] .farmer-quality-record-card {
    width:100% !important;
    min-width:0 !important;
    overflow:visible !important;
  }

  /* YIELD FORECAST ----------------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    padding:10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card > .grid,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card [class*="grid-cols-4"] {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card .ui-section-header {
    margin-bottom:4px !important;
  }

  /* FARM ACTIVITIES ---------------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] .farmer-tab-activities,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] form {
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] [class*="grid-cols-4"] {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] form [class*="grid-cols"] {
    grid-template-columns:minmax(0,1fr) !important;
  }

  /* AI ASSISTANT ------------------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] .farmer-tab-ai-assistant,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] .card {
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] [class*="grid-cols-4"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] [class*="grid-cols-3"] {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] textarea {
    width:100% !important;
    min-height:96px !important;
  }

  /* MARKET ------------------------------------------------------------- */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-tab-market > .grid,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] [class*="grid-cols-4"] {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }

  /* Protect all Farmer icons from accidental global stretching. */
  body[data-ed-portal="farmer"] #farmer-main-content button svg,
  body[data-ed-portal="farmer"] #farmer-main-content [class*="pill-"] svg,
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-icon svg,
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-icon svg {
    flex:none !important;
    max-width:20px !important;
    max-height:20px !important;
  }
}

@media (max-width: 768px) {
  /* Sustainability submodules audited separately: heading + status must never
     compete for a one-character text column. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-carbon-card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-eudr-card {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-carbon-card > .border-b {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:start !important;
    gap:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-eudr-layout {
    display:grid !important;
    grid-template-columns:32px minmax(0,1fr) !important;
    gap:9px !important;
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-eudr-head {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    align-items:start !important;
    gap:7px !important;
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-eudr-head h3 {
    width:100% !important;
    min-width:0 !important;
    white-space:normal !important;
  }

  /* Agronomist module: content and output blocks use the full lane. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-agronomist-card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-agronomist-card > * {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-agronomist-card button {
    width:100% !important;
    min-height:44px !important;
  }
}
@media (max-width: 768px) {
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .truncate:not(.font-mono),
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header .truncate,
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-tile .truncate {
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .nums {
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    word-break:normal !important;
    overflow-wrap:normal !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   v10.13 — FARMER MOBILE COMPACT-DENSITY SYSTEM
   Mobile-first density pass for all 17 Farmer tabs. Keeps 44px controls,
   full-width maps/scanners and readable prose, while reducing decorative
   card footprint, nesting, spacing and oversized metric geometry.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body[data-ed-portal="farmer"] #farmer-main-content {
    --fm-gap:8px !important;
    --fm-pad:9px !important;
    --fm-radius:10px !important;
    padding-left:12px !important;
    padding-right:12px !important;
    padding-top:10px !important;
    padding-bottom:88px !important;
  }

  /* Compact identity strip — identity, not a hero panel. */
  body[data-ed-portal="farmer"] .farmer-identity-card {
    min-height:54px !important;
    padding:8px 9px !important;
    margin-bottom:8px !important;
    border-radius:10px !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card .w-48,
  body[data-ed-portal="farmer"] .farmer-identity-card .h-48 { display:none !important; }
  body[data-ed-portal="farmer"] .farmer-identity-card .relative.flex { gap:8px !important; }
  body[data-ed-portal="farmer"] .farmer-identity-card h1 {
    font-size:14px !important;
    line-height:1.15 !important;
  }
  body[data-ed-portal="farmer"] .farmer-identity-card .flex.flex-wrap > span {
    font-size:9.5px !important;
    line-height:1.15 !important;
  }

  /* KPI tiles — deliberately shallow 2×2 instruments. */
  body[data-ed-portal="farmer"] .farmer-kpi-grid,
  body[data-ed-portal="farmer"] .farmer-farms-kpi-grid {
    gap:6px !important;
    margin-bottom:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-tile,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-metric {
    min-height:68px !important;
    height:auto !important;
    padding:8px 9px !important;
    border-radius:9px !important;
    box-shadow:none !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-body {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) 24px !important;
    align-items:center !important;
    gap:6px !important;
    min-height:50px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-copy,
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-copy > * {
    border:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    padding-left:0 !important;
    padding-right:0 !important;
    min-height:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-label {
    font-size:8px !important;
    line-height:1.1 !important;
    letter-spacing:.055em !important;
    margin:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-value {
    font-size:16px !important;
    line-height:1 !important;
    margin-top:4px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-hint {
    font-size:8.5px !important;
    line-height:1.1 !important;
    margin-top:3px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-icon {
    width:24px !important;
    height:24px !important;
    min-width:24px !important;
    min-height:24px !important;
    max-width:24px !important;
    max-height:24px !important;
    border-radius:7px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-icon svg {
    width:13px !important;
    height:13px !important;
  }

  /* Shared card density for every Farmer tab. */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root {
    gap:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root > * + * {
    margin-top:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .surface-card,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .card {
    padding:9px !important;
    border-radius:10px !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .surface-inset {
    padding:7px 8px !important;
    border-radius:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root [class*="space-y-6"] > * + *,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root [class*="space-y-4"] > * + * {
    margin-top:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root [class*="gap-6"] { gap:8px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root [class*="gap-4"] { gap:7px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root [class*="gap-3"] { gap:6px !important; }

  /* Section headers — one compact horizontal information row. */
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header {
    gap:6px !important;
    margin-bottom:6px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-main { gap:7px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-icon {
    width:26px !important;
    height:26px !important;
    min-width:26px !important;
    min-height:26px !important;
    max-width:26px !important;
    max-height:26px !important;
    border-radius:7px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-icon svg {
    width:13px !important;
    height:13px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header .section-eyebrow {
    font-size:7.5px !important;
    line-height:1.05 !important;
    margin-bottom:1px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header .section-title {
    font-size:13px !important;
    line-height:1.15 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header p:not(.section-eyebrow) {
    font-size:9.5px !important;
    line-height:1.25 !important;
    margin-top:2px !important;
  }

  /* Compact record/list surfaces across batches, money, grades, credit,
     quality, market and activity histories. */
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table tbody {
    gap:6px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table tr {
    padding:8px 9px !important;
    border-radius:9px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table td {
    min-height:0 !important;
    padding:4px 0 !important;
    font-size:10.5px !important;
    line-height:1.2 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table td::before {
    font-size:7.5px !important;
    line-height:1.1 !important;
  }

  /* Buttons remain accessible but visually compact. */
  body[data-ed-portal="farmer"] #farmer-main-content button:not(.farmer-mobile-bottom-tab):not(.ed-drawer-close),
  body[data-ed-portal="farmer"] #farmer-main-content .btn-primary,
  body[data-ed-portal="farmer"] #farmer-main-content .btn-secondary,
  body[data-ed-portal="farmer"] #farmer-main-content .btn-accent {
    min-height:42px !important;
    padding-top:7px !important;
    padding-bottom:7px !important;
    font-size:11px !important;
    border-radius:9px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content input,
  body[data-ed-portal="farmer"] #farmer-main-content select {
    min-height:44px !important;
    padding:8px 10px !important;
    font-size:16px !important; /* prevents iOS zoom */
  }
  body[data-ed-portal="farmer"] #farmer-main-content textarea {
    min-height:76px !important;
    padding:9px 10px !important;
    font-size:16px !important;
  }

  /* Summary/stat grids: compact 2-up where meaningful, never tall hero cards. */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-quality-stat,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-activity-row {
    min-height:48px !important;
    padding:6px 7px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-quality-stat [class*="text-xl"],
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-quality-stat [class*="text-2xl"] {
    font-size:15px !important;
  }

  /* Weather/disease and sustainability: compact reading surfaces, not heroes. */
  body[data-ed-portal="farmer"] .farmer-weather-root,
  body[data-ed-portal="farmer"] .farmer-disease-root,
  body[data-ed-portal="farmer"] .farmer-disease-card,
  body[data-ed-portal="farmer"] .farmer-sustainability-card,
  body[data-ed-portal="farmer"] .farmer-eudr-card,
  body[data-ed-portal="farmer"] .farmer-carbon-card,
  body[data-ed-portal="farmer"] .farmer-agronomist-card {
    padding:9px !important;
    border-radius:10px !important;
  }
  body[data-ed-portal="farmer"] .farmer-disease-card { margin-top:6px !important; }
  body[data-ed-portal="farmer"] .farmer-disease-card h3,
  body[data-ed-portal="farmer"] .farmer-disease-card h4 { font-size:11px !important; line-height:1.2 !important; }
  body[data-ed-portal="farmer"] .farmer-disease-card p { font-size:9.5px !important; line-height:1.3 !important; }

  /* Maps/scanners are functional workspaces: keep width, reduce surrounding card chrome. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] .surface-card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .surface-card {
    padding:7px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] video,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] canvas,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] video,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] canvas {
    border-radius:8px !important;
  }

  /* AI launchers and market/yield cards: dense, glanceable. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] [class*="grid-cols-4"] > *,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] [class*="grid-cols-3"] > * {
    padding:7px !important;
    min-height:58px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .surface-card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .surface-card {
    padding:8px !important;
  }

  /* Preserve readable prose: density must never recreate character stacking. */
  body[data-ed-portal="farmer"] #farmer-main-content h1,
  body[data-ed-portal="farmer"] #farmer-main-content h2,
  body[data-ed-portal="farmer"] #farmer-main-content h3,
  body[data-ed-portal="farmer"] #farmer-main-content h4,
  body[data-ed-portal="farmer"] #farmer-main-content h5,
  body[data-ed-portal="farmer"] #farmer-main-content p,
  body[data-ed-portal="farmer"] #farmer-main-content span:not(.nums),
  body[data-ed-portal="farmer"] #farmer-main-content label {
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
  }
}

@media (max-width: 360px) {
  body[data-ed-portal="farmer"] #farmer-main-content { padding-left:10px !important; padding-right:10px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-tile,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-metric { padding:7px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-value { font-size:15px !important; }
}

/* ========================================================================== 
   FARMER MOBILE PRODUCT SYSTEM v11 — wallet-first, quiet, dense, hairline UI
   Presentation-only. Desktop and all business logic remain unchanged.
   ========================================================================== */
@media (max-width: 768px) {
  body[data-ed-portal="farmer"] {
    --fm-bg:#0A0A0B;
    --fm-surface:#101012;
    --fm-surface-2:#0E0E10;
    --fm-line:rgba(255,255,255,.065);
    --fm-line-strong:rgba(255,255,255,.11);
    --fm-text:#FAFAFA;
    --fm-text-2:#A0A0A6;
    --fm-text-3:#6B6B70;
    --fm-amber:#F5A623;
    --fm-amber-soft:rgba(245,166,35,.12);
    --fm-green:#10B981;
    --fm-red:#EF4444;
    --fm-radius:14px;
    background:var(--fm-bg) !important;
    color:var(--fm-text) !important;
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root {
    background:
      radial-gradient(90% 45% at 50% -10%,rgba(245,166,35,.035),transparent 62%),
      var(--fm-bg) !important;
    color:var(--fm-text) !important;
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar {
    height:56px !important;
    min-height:56px !important;
    background:rgba(10,10,11,.96) !important;
    border-bottom:1px solid var(--fm-line) !important;
    box-shadow:none !important;
    backdrop-filter:blur(16px) saturate(125%);
    -webkit-backdrop-filter:blur(16px) saturate(125%);
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar > div {
    height:56px !important;
    padding-left:16px !important;
    padding-right:14px !important;
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar button {
    color:var(--fm-text-2) !important;
    border-color:transparent !important;
    background:transparent !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger {
    left:14px !important;
    top:calc(6px + env(safe-area-inset-top,0px)) !important;
    height:44px !important;
    min-height:44px !important;
    max-width:205px !important;
    padding:5px 8px !important;
    gap:8px !important;
    border:0 !important;
    border-radius:10px !important;
    background:transparent !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger .ed-workspace-mark {
    width:32px !important;height:32px !important;min-width:32px !important;
    border-radius:50% !important;
    background:var(--fm-amber-soft) !important;
    border:1px solid rgba(245,166,35,.28) !important;
    color:var(--fm-amber) !important;
    font-weight:800 !important;
  }
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger .ed-workspace-copy small {
    color:var(--fm-text-3) !important;
    font-size:8px !important;
    line-height:1 !important;
    letter-spacing:.12em !important;
  }
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger .ed-workspace-copy strong {
    color:var(--fm-text) !important;
    font-size:12px !important;
    line-height:1.15 !important;
    font-weight:650 !important;
  }

  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8 {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    padding:68px 16px calc(92px + env(safe-area-inset-bottom,0px)) !important;
    margin:0 !important;
    overflow-x:hidden !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root {
    width:100% !important;min-width:0 !important;max-width:100% !important;
  }

  /* One visual language across all Farmer tabs. */
  body[data-ed-portal="farmer"] #farmer-main-content .surface-card,
  body[data-ed-portal="farmer"] #farmer-main-content .surface-elevated,
  body[data-ed-portal="farmer"] #farmer-main-content .surface-inset,
  body[data-ed-portal="farmer"] #farmer-main-content .card {
    background:var(--fm-surface) !important;
    border:1px solid var(--fm-line) !important;
    border-radius:var(--fm-radius) !important;
    box-shadow:none !important;
    color:var(--fm-text) !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .surface-inset {
    background:var(--fm-surface-2) !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root > * + * { margin-top:12px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .surface-card,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .card { padding:12px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .section-eyebrow,
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header .section-eyebrow {
    color:var(--fm-text-3) !important;
    font-size:9px !important;
    line-height:1.15 !important;
    letter-spacing:.11em !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header { gap:8px !important;margin-bottom:8px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-main { gap:8px !important; }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-icon {
    width:28px !important;height:28px !important;min-width:28px !important;max-width:28px !important;
    border-radius:8px !important;background:var(--fm-surface-2) !important;border:1px solid var(--fm-line) !important;color:var(--fm-text-2) !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-icon svg {width:14px !important;height:14px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header .section-title {
    color:var(--fm-text) !important;font-size:14px !important;line-height:1.2 !important;font-weight:650 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header p:not(.section-eyebrow) {
    color:var(--fm-text-2) !important;font-size:11px !important;line-height:1.35 !important;margin-top:2px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content h1,
  body[data-ed-portal="farmer"] #farmer-main-content h2,
  body[data-ed-portal="farmer"] #farmer-main-content h3,
  body[data-ed-portal="farmer"] #farmer-main-content h4,
  body[data-ed-portal="farmer"] #farmer-main-content p,
  body[data-ed-portal="farmer"] #farmer-main-content span,
  body[data-ed-portal="farmer"] #farmer-main-content label {
    writing-mode:horizontal-tb !important;text-orientation:mixed !important;word-break:normal !important;overflow-wrap:break-word !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .nums { font-variant-numeric:tabular-nums lining-nums !important; }

  /* Consistent compact header on every non-home tab. */
  body[data-ed-portal="farmer"] .farmer-mobile-page-head-v11 { margin:0 0 12px;padding:0 2px; }
  body[data-ed-portal="farmer"] .farmer-mobile-page-head-v11 p {margin:0;color:var(--fm-text-3) !important;font-size:9px !important;letter-spacing:.12em;font-weight:650;}
  body[data-ed-portal="farmer"] .farmer-mobile-page-head-v11 h1 {margin:4px 0 0;color:var(--fm-text) !important;font-size:21px !important;line-height:1.1 !important;font-weight:700;letter-spacing:-.02em;}

  /* Home: identity */
  body[data-ed-portal="farmer"] .farmer-mobile-home-v11 {display:flex;flex-direction:column;gap:12px;width:100%;min-width:0;}
  body[data-ed-portal="farmer"] .farmer-mobile-identity-v11 {
    display:grid;grid-template-columns:48px minmax(0,1fr);gap:12px;align-items:center;
    padding:16px 16px 12px;background:var(--fm-surface);border:1px solid var(--fm-line);border-radius:var(--fm-radius);
  }
  body[data-ed-portal="farmer"] .farmer-mobile-avatar-v11 {
    width:48px;height:48px;border-radius:50%;display:grid;place-items:center;
    border:2px solid var(--fm-amber);outline:3px solid rgba(245,166,35,.08);
    background:#2A2118;color:var(--fm-text);font-size:22px;font-weight:650;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-identity-copy-v11 {min-width:0;}
  body[data-ed-portal="farmer"] .farmer-mobile-name-row-v11 {display:flex;align-items:center;gap:8px;min-width:0;flex-wrap:wrap;}
  body[data-ed-portal="farmer"] .farmer-mobile-name-row-v11 h1 {margin:0;color:var(--fm-text) !important;font-size:20px !important;line-height:1;font-weight:700;letter-spacing:-.015em;}
  body[data-ed-portal="farmer"] .farmer-mobile-verified-v11 {display:inline-flex;align-items:center;gap:4px;min-height:24px;padding:3px 7px;border-radius:999px;font-size:10px;line-height:1;font-weight:650;white-space:nowrap;}
  body[data-ed-portal="farmer"] .farmer-mobile-verified-v11.is-verified {color:var(--fm-amber);background:var(--fm-amber-soft);border:1px solid rgba(245,166,35,.20);}
  body[data-ed-portal="farmer"] .farmer-mobile-verified-v11.is-pending {color:var(--fm-text-2);background:rgba(255,255,255,.04);border:1px solid var(--fm-line);}
  body[data-ed-portal="farmer"] .farmer-mobile-location-v11 {display:flex;align-items:center;gap:5px;margin-top:7px;color:var(--fm-text-2);font-size:12px;min-width:0;}
  body[data-ed-portal="farmer"] .farmer-mobile-id-v11 {grid-column:1/-1;display:flex;align-items:center;gap:7px;min-width:0;border-top:1px solid var(--fm-line);margin:2px -16px -12px;padding:10px 16px;color:var(--fm-text-3);}
  body[data-ed-portal="farmer"] .farmer-mobile-id-v11 span {font-size:9px;letter-spacing:.11em;white-space:nowrap;}
  body[data-ed-portal="farmer"] .farmer-mobile-id-v11 strong {font-size:10.5px;color:var(--fm-text-2);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;}

  /* Home: wallet hero */
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-v11 {padding:16px;background:var(--fm-surface);border:1px solid var(--fm-line);border-radius:var(--fm-radius);text-align:center;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-head-v11 {display:flex;align-items:center;justify-content:space-between;text-align:left;color:var(--fm-text-2);font-size:9px;font-weight:650;letter-spacing:.11em;}
  body[data-ed-portal="farmer"] .farmer-mobile-currency-v11 {padding:4px 7px;border:1px solid var(--fm-line);border-radius:999px;color:var(--fm-text-2);letter-spacing:.04em;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-value-v11 {margin-top:8px;color:var(--fm-text);font-size:44px;line-height:1;font-weight:650;letter-spacing:-.04em;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-value-v11 small {font-size:17px;color:var(--fm-text-2);font-weight:550;letter-spacing:0;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-v11 > p {margin:5px 0 0;color:var(--fm-text-2) !important;font-size:11px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 {display:flex;justify-content:center;gap:6px;flex-wrap:wrap;margin-top:12px;}
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 > span {display:inline-flex;align-items:center;gap:5px;padding:5px 8px;border:1px solid var(--fm-line);border-radius:999px;background:rgba(255,255,255,.025);color:var(--fm-text);font-size:10px;white-space:nowrap;}
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 i {width:7px;height:7px;border-radius:50%;background:#8B8B90;}
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 i.is-amber {background:var(--fm-amber);}
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 b {color:var(--fm-text-3);font-weight:500;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-actions-v11 {display:grid;grid-template-columns:minmax(0,1.55fr) minmax(0,1fr);gap:8px;margin-top:12px;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-actions-v11 button {height:46px !important;min-height:46px !important;border-radius:9px !important;font-size:12px !important;font-weight:700 !important;display:flex;align-items:center;justify-content:center;gap:7px;box-shadow:none !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-primary-v11 {background:var(--fm-amber) !important;color:#17120A !important;border:1px solid var(--fm-amber) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-primary-v11:disabled {opacity:.42 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-secondary-v11 {background:transparent !important;color:var(--fm-text) !important;border:1px solid var(--fm-line-strong) !important;}

  /* Home: two dense KPIs */
  body[data-ed-portal="farmer"] .farmer-mobile-kpis-v11 {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 {position:relative;display:block;text-align:left;min-width:0;height:104px !important;min-height:104px !important;padding:12px !important;border-radius:var(--fm-radius) !important;background:var(--fm-surface) !important;border:1px solid var(--fm-line) !important;color:var(--fm-text) !important;overflow:hidden;box-shadow:none !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-label-v11 {display:block;padding-right:24px;color:var(--fm-text-2);font-size:8.5px;line-height:1.15;font-weight:650;letter-spacing:.09em;white-space:normal;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-icon-v11 {position:absolute;right:11px;top:11px;width:17px !important;height:17px !important;color:var(--fm-text-2);}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 strong {display:block;margin-top:8px;font-size:25px;line-height:1;font-weight:650;letter-spacing:-.03em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 strong em {font-size:11px;color:var(--fm-text-2);font-style:normal;font-weight:550;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 small {display:block;margin-top:4px;color:var(--fm-text-3);font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  body[data-ed-portal="farmer"] .farmer-mobile-spark-v11 {position:absolute;right:10px;bottom:9px;width:62px !important;height:23px !important;overflow:visible;}
  body[data-ed-portal="farmer"] .farmer-mobile-spark-v11 path {fill:none;stroke:var(--fm-amber);stroke-width:1.8;vector-effect:non-scaling-stroke;}

  /* Home: quick actions */
  body[data-ed-portal="farmer"] .farmer-mobile-quick-v11 > h2 {margin:2px 0 8px;color:var(--fm-text-2) !important;font-size:9px !important;line-height:1;font-weight:650;letter-spacing:.11em;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button {display:grid;grid-template-columns:32px minmax(0,1fr);grid-template-rows:auto auto;column-gap:9px;row-gap:2px;text-align:left;align-items:center;min-width:0;min-height:74px !important;padding:10px !important;background:var(--fm-surface) !important;border:1px solid var(--fm-line) !important;border-radius:var(--fm-radius) !important;color:var(--fm-text) !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button > span {grid-row:1/3;width:32px;height:32px;border-radius:9px;display:grid;place-items:center;background:var(--fm-amber-soft);color:var(--fm-amber);}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button > span svg {width:17px !important;height:17px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 strong {align-self:end;min-width:0;color:var(--fm-text);font-size:11.5px;line-height:1.15;font-weight:650;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 small {align-self:start;color:var(--fm-text-3);font-size:8.5px;line-height:1.2;}

  /* Home: activity list, no giant container card. */
  body[data-ed-portal="farmer"] .farmer-mobile-section-head-v11 {display:flex;align-items:center;justify-content:space-between;gap:10px;padding:1px 1px 0;}
  body[data-ed-portal="farmer"] .farmer-mobile-section-head-v11 h2 {margin:0;color:var(--fm-text) !important;font-size:15px !important;line-height:1.1;font-weight:700;}
  body[data-ed-portal="farmer"] .farmer-mobile-section-head-v11 button {min-height:32px !important;padding:0 2px !important;background:transparent !important;border:0 !important;color:var(--fm-amber) !important;font-size:10px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-list-v11 {margin-top:5px;border-top:1px solid var(--fm-line);}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-row-v11 {width:100%;display:grid;grid-template-columns:32px minmax(0,1fr) auto;align-items:center;gap:9px;min-height:58px !important;padding:9px 1px !important;background:transparent !important;border:0 !important;border-bottom:1px solid var(--fm-line) !important;color:var(--fm-text) !important;text-align:left;box-shadow:none !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-icon-v11 {width:32px;height:32px;border-radius:9px;display:grid;place-items:center;background:rgba(255,255,255,.05);border:1px solid var(--fm-line);color:var(--fm-text-2);}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-icon-v11 svg {width:16px !important;height:16px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-copy-v11 {display:flex;flex-direction:column;min-width:0;gap:2px;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-copy-v11 strong {min-width:0;color:var(--fm-text);font-size:11.5px;line-height:1.2;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-copy-v11 small {min-width:0;color:var(--fm-text-3);font-size:9px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  body[data-ed-portal="farmer"] .farmer-mobile-status-v11 {max-width:84px;padding:4px 7px;border-radius:999px;border:1px solid var(--fm-line);font-size:8.5px;line-height:1;text-transform:capitalize;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  body[data-ed-portal="farmer"] .farmer-mobile-status-v11.is-success {color:#4ADE80;background:rgba(16,185,129,.10);border-color:rgba(16,185,129,.25);}
  body[data-ed-portal="farmer"] .farmer-mobile-status-v11.is-warning {color:#FBBF24;background:rgba(245,166,35,.10);border-color:rgba(245,166,35,.24);}
  body[data-ed-portal="farmer"] .farmer-mobile-empty-hint-v11 {width:100%;display:grid;grid-template-columns:20px minmax(0,1fr) 18px;gap:7px;align-items:center;min-height:48px !important;margin-top:8px;padding:9px 10px !important;border:1px dashed var(--fm-line-strong) !important;border-radius:11px !important;background:var(--fm-surface-2) !important;color:var(--fm-text-2) !important;text-align:left;font-size:10px !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-empty-hint-v11 svg:last-child {color:var(--fm-amber);}

  /* All non-home tab cards: compact, quiet, readable. */
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-tile,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-metric {min-height:76px !important;padding:10px !important;border-radius:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-body {min-height:54px !important;grid-template-columns:minmax(0,1fr) 28px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-label {font-size:8.5px !important;color:var(--fm-text-3) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-value {font-size:18px !important;color:var(--fm-text) !important;margin-top:5px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-hint {font-size:9px !important;color:var(--fm-text-3) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-icon {width:28px !important;height:28px !important;min-width:28px !important;max-width:28px !important;border-radius:8px !important;background:var(--fm-surface-2) !important;border:1px solid var(--fm-line) !important;color:var(--fm-text-2) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-icon svg {width:14px !important;height:14px !important;}

  /* Tables become compact record surfaces with hairlines. */
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table tbody {gap:7px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table tr {background:var(--fm-surface) !important;border:1px solid var(--fm-line) !important;border-radius:12px !important;padding:9px 10px !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table td {padding:4px 0 !important;color:var(--fm-text) !important;font-size:10.5px !important;line-height:1.25 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table td::before {color:var(--fm-text-3) !important;font-size:8px !important;letter-spacing:.08em !important;}

  /* Touch targets stay safe without making cards tall. */
  body[data-ed-portal="farmer"] #farmer-main-content button:not(.farmer-mobile-bottom-tab):not(.ed-drawer-close) {min-height:42px;}
  body[data-ed-portal="farmer"] #farmer-main-content input,
  body[data-ed-portal="farmer"] #farmer-main-content select,
  body[data-ed-portal="farmer"] #farmer-main-content textarea {background:var(--fm-surface-2) !important;border:1px solid var(--fm-line-strong) !important;color:var(--fm-text) !important;border-radius:10px !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] #farmer-main-content input,
  body[data-ed-portal="farmer"] #farmer-main-content select {min-height:44px !important;font-size:16px !important;}

  /* Bottom nav: fixed, calm, regular tabs — no FAB. */
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-nav {height:72px !important;min-height:72px !important;padding:5px 8px calc(6px + env(safe-area-inset-bottom,0px)) !important;background:rgba(12,12,14,.97) !important;border-top:1px solid var(--fm-line) !important;box-shadow:none !important;backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);}
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-tab {min-height:54px !important;padding:5px 4px !important;border-radius:10px !important;background:transparent !important;color:#8A8A90 !important;font-size:9px !important;gap:2px !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-tab.is-active {background:transparent !important;color:var(--fm-amber) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-tab.is-active::after {content:"";position:absolute;bottom:3px;width:4px;height:4px;border-radius:50%;background:var(--fm-amber);}
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-icon {width:23px;height:23px;display:grid;place-items:center;}
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-icon svg {width:21px !important;height:21px !important;stroke-width:1.5;}
  body[data-ed-portal="farmer"] .farmer-dashboard-root .copilot-fab {width:42px !important;height:42px !important;right:14px !important;bottom:calc(82px + env(safe-area-inset-bottom,0px)) !important;border-radius:12px !important;box-shadow:none !important;}

  /* Drawer follows the same restrained system. */
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar {width:min(82vw,312px) !important;background:#0C0C0E !important;border-right:1px solid var(--fm-line) !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item {border-radius:9px !important;min-height:42px !important;color:var(--fm-text-2) !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-group-label {color:var(--fm-text-3) !important;}
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 {border-top:1px solid var(--fm-line) !important;background:#0C0C0E !important;}
}

@media (max-width: 360px) {
  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8 {padding-left:12px !important;padding-right:12px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpis-v11,
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 {gap:8px;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-value-v11 {font-size:40px;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button {grid-template-columns:28px minmax(0,1fr);column-gap:7px;padding:9px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button > span {width:28px;height:28px;}
}

/* ═══════════════════════════════════════════════════════════════════════
   v12.0 — FARMER MOBILE REFERENCE PARITY
   Final mobile-only presentation contract.  This deliberately overrides
   earlier experimental farmer-mobile rules so the production composition
   follows one deterministic wallet-first hierarchy.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  body[data-ed-portal="farmer"] {
    --fm12-bg:#0A0A0B;
    --fm12-surface:#101012;
    --fm12-surface-2:#0E0E10;
    --fm12-line:rgba(255,255,255,.06);
    --fm12-line-strong:rgba(255,255,255,.11);
    --fm12-text:#FAFAFA;
    --fm12-text-2:#A0A0A6;
    --fm12-text-3:#6B6B70;
    --fm12-amber:#F5A623;
    --fm12-amber-soft:rgba(245,166,35,.11);
    --fm12-green:#10B981;
    --fm12-red:#EF4444;
    background:var(--fm12-bg) !important;
    overflow-x:hidden !important;
  }

  body[data-ed-portal="farmer"] .farmer-dashboard-root {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    min-height:100dvh !important;
    padding-top:56px !important;
    padding-bottom:72px !important;
    overflow-x:hidden !important;
    background:radial-gradient(90% 42% at 50% -8%,rgba(245,166,35,.025),transparent 66%),var(--fm12-bg) !important;
    color:var(--fm12-text) !important;
  }

  /* One fixed 56px app-bar.  No duplicate mobile brand row. */
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar {
    position:fixed !important;
    z-index:40 !important;
    inset:0 0 auto 0 !important;
    height:56px !important;
    min-height:56px !important;
    padding:0 !important;
    background:rgba(10,10,11,.97) !important;
    border:0 !important;
    border-bottom:1px solid var(--fm12-line) !important;
    box-shadow:none !important;
    backdrop-filter:blur(18px) saturate(130%);
    -webkit-backdrop-filter:blur(18px) saturate(130%);
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar > div {
    width:100% !important;
    max-width:none !important;
    min-width:0 !important;
    height:56px !important;
    margin:0 !important;
    padding:0 14px 0 16px !important;
    justify-content:flex-end !important;
  }
  body[data-ed-portal="farmer"] .farmer-topbar-identity { display:none !important; }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar .flex.items-center.gap-1\.5 {
    gap:6px !important;
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar button {
    width:40px !important;
    min-width:40px !important;
    height:40px !important;
    min-height:40px !important;
    padding:0 !important;
    border:0 !important;
    border-radius:10px !important;
    background:transparent !important;
    color:var(--fm12-text-2) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar button svg {
    width:18px !important;height:18px !important;stroke-width:1.5 !important;
  }

  /* Injected workspace trigger occupies the left side of the same app bar. */
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger {
    position:fixed !important;
    z-index:46 !important;
    top:6px !important;
    left:14px !important;
    width:auto !important;
    max-width:220px !important;
    height:44px !important;
    min-height:44px !important;
    padding:4px 7px !important;
    gap:9px !important;
    border:0 !important;
    border-radius:10px !important;
    background:transparent !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger .ed-workspace-mark {
    width:34px !important;height:34px !important;min-width:34px !important;
    border-radius:50% !important;
    border:1px solid rgba(245,166,35,.30) !important;
    background:var(--fm12-amber-soft) !important;
    color:var(--fm12-amber) !important;
    font-size:14px !important;font-weight:800 !important;
  }
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger .ed-workspace-copy {
    min-width:0 !important;align-items:flex-start !important;
  }
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger .ed-workspace-copy small {
    color:var(--fm12-text-3) !important;
    font-size:8.5px !important;line-height:1 !important;font-weight:650 !important;letter-spacing:.12em !important;
    text-transform:uppercase !important;
  }
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger .ed-workspace-copy strong {
    color:var(--fm12-text) !important;
    font-size:13px !important;line-height:1.2 !important;font-weight:650 !important;
  }

  /* The old desktop identity/KPI/overview blocks must NEVER enter mobile flow. */
  body[data-ed-portal="farmer"] #farmer-main-content > .farmer-identity-card,
  body[data-ed-portal="farmer"] #farmer-main-content > .farmer-kpi-grid,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-desktop-overview {
    display:none !important;
  }

  /* Header is already compensated by root padding. Content begins 14px below it. */
  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8,
  body[data-ed-portal="farmer"] #farmer-main-content {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin:0 !important;
    padding:14px 16px calc(88px + env(safe-area-inset-bottom,0px)) !important;
    overflow-x:hidden !important;
    overflow-y:visible !important;
    touch-action:pan-y !important;
    box-sizing:border-box !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root {
    width:100% !important;max-width:100% !important;min-width:0 !important;
  }

  /* Global mobile type discipline prevents single-character vertical collapse. */
  body[data-ed-portal="farmer"] #farmer-main-content h1,
  body[data-ed-portal="farmer"] #farmer-main-content h2,
  body[data-ed-portal="farmer"] #farmer-main-content h3,
  body[data-ed-portal="farmer"] #farmer-main-content h4,
  body[data-ed-portal="farmer"] #farmer-main-content p,
  body[data-ed-portal="farmer"] #farmer-main-content span,
  body[data-ed-portal="farmer"] #farmer-main-content strong,
  body[data-ed-portal="farmer"] #farmer-main-content small,
  body[data-ed-portal="farmer"] #farmer-main-content label {
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .nums {
    font-variant-numeric:tabular-nums lining-nums !important;
  }

  /* ── EXACT MOBILE HOME COMPOSITION ─────────────────────────────── */
  body[data-ed-portal="farmer"] .farmer-mobile-home-v11 {
    display:flex !important;
    flex-direction:column !important;
    gap:14px !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }

  /* Identity hero */
  body[data-ed-portal="farmer"] .farmer-mobile-identity-v11 {
    display:grid !important;
    grid-template-columns:52px minmax(0,1fr) !important;
    gap:13px !important;
    align-items:center !important;
    width:100% !important;
    min-width:0 !important;
    padding:18px 18px 12px !important;
    background:var(--fm12-surface) !important;
    border:1px solid var(--fm12-line) !important;
    border-radius:14px !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-avatar-v11 {
    width:52px !important;height:52px !important;min-width:52px !important;
    border-radius:50% !important;
    border:2px solid var(--fm12-amber) !important;
    outline:3px solid rgba(245,166,35,.07) !important;
    background:#2A2118 !important;
    color:var(--fm12-text) !important;
    font-size:23px !important;font-weight:650 !important;
    display:grid !important;place-items:center !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-identity-copy-v11 {min-width:0 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-name-row-v11 {
    display:flex !important;align-items:center !important;gap:7px !important;flex-wrap:wrap !important;min-width:0 !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-name-row-v11 h1 {
    margin:0 !important;color:var(--fm12-text) !important;font-size:20px !important;line-height:1.05 !important;font-weight:700 !important;letter-spacing:-.02em !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-location-v11 {
    margin-top:7px !important;display:flex !important;align-items:center !important;gap:5px !important;min-width:0 !important;
    color:var(--fm12-text-2) !important;font-size:12.5px !important;line-height:1.2 !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-location-v11 svg {width:14px !important;height:14px !important;flex:0 0 auto !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-verified-v11 {
    display:inline-flex !important;align-items:center !important;gap:4px !important;min-height:24px !important;
    padding:4px 7px !important;border-radius:999px !important;font-size:10px !important;line-height:1 !important;font-weight:650 !important;white-space:nowrap !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-verified-v11.is-verified {
    color:var(--fm12-amber) !important;background:var(--fm12-amber-soft) !important;border:1px solid rgba(245,166,35,.20) !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-verified-v11.is-pending {
    color:var(--fm12-text-2) !important;background:rgba(255,255,255,.035) !important;border:1px solid var(--fm12-line) !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-verified-v11 svg {width:13px !important;height:13px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-id-v11 {
    grid-column:1/-1 !important;
    display:grid !important;grid-template-columns:auto minmax(0,1fr) 28px !important;align-items:center !important;gap:6px !important;
    min-width:0 !important;margin:2px -18px -12px !important;padding:10px 18px !important;border-top:1px solid var(--fm12-line) !important;
    color:var(--fm12-text-3) !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-id-v11 > span {font-size:9px !important;line-height:1 !important;letter-spacing:.11em !important;white-space:nowrap !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-id-v11 > strong {
    min-width:0 !important;color:var(--fm12-text-2) !important;font-size:10.5px !important;line-height:1 !important;font-weight:500 !important;
    white-space:nowrap !important;overflow:hidden !important;text-overflow:ellipsis !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-copy-v12 {
    width:28px !important;min-width:28px !important;height:28px !important;min-height:28px !important;padding:0 !important;
    display:grid !important;place-items:center !important;background:transparent !important;border:0 !important;border-radius:7px !important;color:var(--fm12-text-2) !important;box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-copy-v12 svg {width:14px !important;height:14px !important;}

  /* Wallet hero — money is the primary decision object. */
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-v11 {
    width:100% !important;min-width:0 !important;
    padding:18px !important;
    background:var(--fm12-surface) !important;
    border:1px solid var(--fm12-line) !important;
    border-radius:14px !important;
    box-shadow:none !important;
    text-align:center !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-head-v11 {
    display:flex !important;align-items:center !important;justify-content:space-between !important;gap:10px !important;text-align:left !important;
    color:var(--fm12-text-2) !important;font-size:9.5px !important;line-height:1 !important;font-weight:650 !important;letter-spacing:.11em !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-currency-v11 {
    padding:4px 7px !important;border:1px solid var(--fm12-line-strong) !important;border-radius:999px !important;
    color:var(--fm12-text-2) !important;background:rgba(255,255,255,.03) !important;font-size:9.5px !important;letter-spacing:.04em !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-value-v11 {
    margin:14px 0 0 !important;color:var(--fm12-text) !important;font-size:48px !important;line-height:.95 !important;font-weight:650 !important;letter-spacing:-.045em !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-value-v11 small {
    font-size:18px !important;color:var(--fm12-text-2) !important;font-weight:550 !important;letter-spacing:0 !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-v11 > p {
    margin:7px 0 0 !important;color:var(--fm12-text-2) !important;font-size:11.5px !important;line-height:1.2 !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 {
    margin-top:13px !important;display:flex !important;justify-content:center !important;gap:6px !important;flex-wrap:wrap !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 > span {
    display:inline-flex !important;align-items:center !important;gap:5px !important;min-height:28px !important;padding:5px 8px !important;
    border:1px solid var(--fm12-line) !important;border-radius:999px !important;background:rgba(255,255,255,.025) !important;
    color:var(--fm12-text) !important;font-size:10px !important;line-height:1 !important;white-space:nowrap !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 b {color:var(--fm12-text-2) !important;font-weight:500 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 i {width:7px !important;height:7px !important;flex:0 0 7px !important;border-radius:50% !important;background:#8B8B90 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 i.is-amber {background:var(--fm12-amber) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-actions-v11 {
    margin-top:14px !important;display:grid !important;grid-template-columns:minmax(0,1.55fr) minmax(0,1fr) !important;gap:8px !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-actions-v11 button {
    min-width:0 !important;height:48px !important;min-height:48px !important;padding:0 12px !important;border-radius:9px !important;
    display:inline-flex !important;align-items:center !important;justify-content:center !important;gap:7px !important;
    font-size:12.5px !important;line-height:1 !important;font-weight:650 !important;box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-primary-v11 {
    color:#171006 !important;background:var(--fm12-amber) !important;border:1px solid var(--fm12-amber) !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-primary-v11:disabled {opacity:.42 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-secondary-v11 {
    color:var(--fm12-text) !important;background:transparent !important;border:1px solid var(--fm12-line-strong) !important;
  }

  /* Exactly two compact KPI cards on Home. */
  body[data-ed-portal="farmer"] .farmer-mobile-kpis-v11 {
    width:100% !important;display:grid !important;grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:10px !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 {
    position:relative !important;display:block !important;width:100% !important;min-width:0 !important;height:108px !important;min-height:108px !important;
    padding:14px !important;text-align:left !important;overflow:hidden !important;
    background:var(--fm12-surface) !important;border:1px solid var(--fm12-line) !important;border-radius:14px !important;color:var(--fm12-text) !important;box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-label-v11 {
    display:block !important;max-width:calc(100% - 30px) !important;color:var(--fm12-text-2) !important;font-size:9px !important;line-height:1.15 !important;font-weight:650 !important;letter-spacing:.085em !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-icon-wrap-v12 {
    position:absolute !important;right:12px !important;top:12px !important;width:26px !important;height:26px !important;border-radius:8px !important;
    display:grid !important;place-items:center !important;background:var(--fm12-surface-2) !important;border:1px solid var(--fm12-line) !important;color:var(--fm12-text-2) !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-icon-v11 {width:14px !important;height:14px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 > strong {
    display:block !important;margin-top:12px !important;color:var(--fm12-text) !important;font-size:26px !important;line-height:1 !important;font-weight:650 !important;letter-spacing:-.025em !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 > strong em {font-size:13px !important;color:var(--fm12-text-2) !important;font-style:normal !important;font-weight:550 !important;letter-spacing:0 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 > small {
    display:block !important;margin-top:6px !important;color:var(--fm12-text-3) !important;font-size:9px !important;line-height:1 !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-spark-v11 {
    position:absolute !important;right:10px !important;bottom:11px !important;width:54px !important;height:24px !important;overflow:visible !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-spark-v11 path {fill:none !important;stroke:var(--fm12-amber) !important;stroke-width:1.6 !important;vector-effect:non-scaling-stroke !important;}

  /* Quick Actions: 2×2, dense but comfortably tappable. */
  body[data-ed-portal="farmer"] .farmer-mobile-quick-v11 {width:100% !important;min-width:0 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-v11 > h2 {
    margin:1px 0 8px !important;color:var(--fm12-text-2) !important;font-size:9.5px !important;line-height:1 !important;font-weight:650 !important;letter-spacing:.11em !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 {
    display:grid !important;grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:9px !important;width:100% !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button {
    width:100% !important;min-width:0 !important;height:82px !important;min-height:82px !important;padding:11px !important;
    display:grid !important;grid-template-columns:34px minmax(0,1fr) !important;grid-template-rows:auto auto !important;column-gap:9px !important;row-gap:2px !important;align-items:center !important;text-align:left !important;
    background:var(--fm12-surface) !important;border:1px solid var(--fm12-line) !important;border-radius:14px !important;color:var(--fm12-text) !important;box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button > span {
    grid-row:1/3 !important;width:34px !important;height:34px !important;border-radius:9px !important;display:grid !important;place-items:center !important;
    background:var(--fm12-amber-soft) !important;border:1px solid rgba(245,166,35,.10) !important;color:var(--fm12-amber) !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button > span svg {width:17px !important;height:17px !important;stroke-width:1.5 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 strong {align-self:end !important;color:var(--fm12-text) !important;font-size:12px !important;line-height:1.15 !important;font-weight:650 !important;min-width:0 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 small {align-self:start !important;color:var(--fm12-text-3) !important;font-size:9px !important;line-height:1.2 !important;min-width:0 !important;}

  /* Recent Activity: rows, not cards. */
  body[data-ed-portal="farmer"] .farmer-mobile-activity-v11 {width:100% !important;min-width:0 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-section-head-v11 {display:flex !important;align-items:center !important;justify-content:space-between !important;gap:10px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-section-head-v11 h2 {margin:0 !important;color:var(--fm12-text) !important;font-size:15px !important;line-height:1.15 !important;font-weight:700 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-section-head-v11 button {min-height:32px !important;padding:0 1px !important;background:transparent !important;border:0 !important;color:var(--fm12-amber) !important;font-size:10.5px !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-list-v11 {margin-top:5px !important;border-top:1px solid var(--fm12-line) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-row-v11 {
    width:100% !important;min-width:0 !important;min-height:60px !important;padding:10px 1px !important;
    display:grid !important;grid-template-columns:34px minmax(0,1fr) auto !important;align-items:center !important;gap:9px !important;
    background:transparent !important;border:0 !important;border-bottom:1px solid var(--fm12-line) !important;color:var(--fm12-text) !important;text-align:left !important;box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-activity-icon-v11 {width:34px !important;height:34px !important;border-radius:9px !important;display:grid !important;place-items:center !important;background:rgba(255,255,255,.045) !important;border:1px solid var(--fm12-line) !important;color:var(--fm12-text-2) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-icon-v11 svg {width:16px !important;height:16px !important;stroke-width:1.5 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-copy-v11 {display:flex !important;flex-direction:column !important;gap:2px !important;min-width:0 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-copy-v11 strong {color:var(--fm12-text) !important;font-size:11.5px !important;line-height:1.2 !important;font-weight:600 !important;white-space:nowrap !important;overflow:hidden !important;text-overflow:ellipsis !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-copy-v11 small {color:var(--fm12-text-3) !important;font-size:9px !important;line-height:1.2 !important;white-space:nowrap !important;overflow:hidden !important;text-overflow:ellipsis !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-status-v11 {max-width:84px !important;padding:4px 7px !important;border-radius:999px !important;border:1px solid var(--fm12-line) !important;color:var(--fm12-text-2) !important;background:rgba(255,255,255,.025) !important;font-size:8.5px !important;line-height:1 !important;white-space:nowrap !important;overflow:hidden !important;text-overflow:ellipsis !important;text-transform:capitalize !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-status-v11.is-success {color:#34D399 !important;background:rgba(16,185,129,.10) !important;border-color:rgba(16,185,129,.25) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-status-v11.is-warning {color:#FBBF24 !important;background:rgba(245,166,35,.10) !important;border-color:rgba(245,166,35,.24) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-empty-hint-v11 {width:100% !important;min-height:50px !important;margin-top:9px !important;padding:10px 11px !important;display:grid !important;grid-template-columns:20px minmax(0,1fr) 18px !important;gap:8px !important;align-items:center !important;background:var(--fm12-surface-2) !important;border:1px dashed var(--fm12-line-strong) !important;border-radius:12px !important;color:var(--fm12-text-2) !important;text-align:left !important;font-size:10px !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-empty-hint-v11 svg:last-child {color:var(--fm12-amber) !important;}

  /* ── ALL 17 OTHER TAB PRESENTATIONS SHARE THIS CONTRACT ───────── */
  body[data-ed-portal="farmer"] .farmer-mobile-page-head-v11 {margin:0 0 12px !important;padding:0 1px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-page-head-v11 p {margin:0 !important;color:var(--fm12-text-3) !important;font-size:9px !important;line-height:1 !important;font-weight:650 !important;letter-spacing:.11em !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-page-head-v11 h1 {margin:4px 0 0 !important;color:var(--fm12-text) !important;font-size:21px !important;line-height:1.08 !important;font-weight:700 !important;letter-spacing:-.02em !important;}

  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .card,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .surface-card,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .surface-elevated,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .surface-inset {
    max-width:100% !important;min-width:0 !important;
    background:var(--fm12-surface) !important;border:1px solid var(--fm12-line) !important;border-radius:14px !important;box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root > .card,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root > .surface-card {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root .card .card {padding:10px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root > * + * {margin-top:10px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root [class*="gap-6"] {gap:10px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root [class*="gap-4"] {gap:9px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-tab-root [class*="gap-3"] {gap:8px !important;}

  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header {display:grid !important;grid-template-columns:auto minmax(0,1fr) auto !important;align-items:center !important;gap:8px !important;margin-bottom:9px !important;min-width:0 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-main {min-width:0 !important;display:flex !important;align-items:center !important;gap:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-copy {min-width:0 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-icon {width:30px !important;height:30px !important;min-width:30px !important;border-radius:8px !important;background:var(--fm12-surface-2) !important;border:1px solid var(--fm12-line) !important;color:var(--fm12-text-2) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header-icon svg {width:15px !important;height:15px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header .section-eyebrow {font-size:8px !important;line-height:1 !important;color:var(--fm12-text-3) !important;letter-spacing:.10em !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header .section-title {font-size:14px !important;line-height:1.15 !important;color:var(--fm12-text) !important;font-weight:650 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-section-header p:not(.section-eyebrow) {margin-top:2px !important;color:var(--fm12-text-2) !important;font-size:10px !important;line-height:1.3 !important;}

  /* Generic metrics are compact 2-up instruments, never tall nested cards. */
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-tile,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-metric {
    min-width:0 !important;min-height:74px !important;height:auto !important;padding:9px !important;border-radius:12px !important;background:var(--fm12-surface) !important;border:1px solid var(--fm12-line) !important;box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-body {min-height:54px !important;display:grid !important;grid-template-columns:minmax(0,1fr) 28px !important;align-items:center !important;gap:6px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-copy {min-width:0 !important;background:transparent !important;border:0 !important;padding:0 !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-label {font-size:8px !important;line-height:1.15 !important;color:var(--fm12-text-3) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-value {margin-top:5px !important;font-size:17px !important;line-height:1 !important;color:var(--fm12-text) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-hint {margin-top:4px !important;font-size:8.5px !important;line-height:1.15 !important;color:var(--fm12-text-3) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-icon {width:28px !important;height:28px !important;min-width:28px !important;border-radius:8px !important;background:var(--fm12-surface-2) !important;border:1px solid var(--fm12-line) !important;color:var(--fm12-text-2) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .ui-metric-icon svg {width:14px !important;height:14px !important;}

  /* Forms become one-column mobile workflows unless a semantic 2-up metric grid overrides them. */
  body[data-ed-portal="farmer"] #farmer-main-content form .grid.grid-cols-2,
  body[data-ed-portal="farmer"] #farmer-main-content form .grid.grid-cols-3,
  body[data-ed-portal="farmer"] #farmer-main-content form .grid.grid-cols-4,
  body[data-ed-portal="farmer"] #farmer-main-content form [class*="md:grid-cols-"] {
    grid-template-columns:minmax(0,1fr) !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content input,
  body[data-ed-portal="farmer"] #farmer-main-content select,
  body[data-ed-portal="farmer"] #farmer-main-content textarea {
    width:100% !important;max-width:100% !important;min-width:0 !important;background:var(--fm12-surface-2) !important;border:1px solid var(--fm12-line-strong) !important;border-radius:10px !important;color:var(--fm12-text) !important;box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content input,
  body[data-ed-portal="farmer"] #farmer-main-content select {min-height:44px !important;font-size:16px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content textarea {font-size:16px !important;line-height:1.4 !important;}

  /* Wide information is bounded to its own scroller, never the document. */
  body[data-ed-portal="farmer"] #farmer-main-content .table-responsive,
  body[data-ed-portal="farmer"] #farmer-main-content [class*="overflow-x-auto"] {max-width:100% !important;overflow-x:auto !important;overscroll-behavior-x:contain !important;}
  body[data-ed-portal="farmer"] #farmer-main-content img,
  body[data-ed-portal="farmer"] #farmer-main-content canvas,
  body[data-ed-portal="farmer"] #farmer-main-content svg:not(.farmer-mobile-spark-v11),
  body[data-ed-portal="farmer"] #farmer-main-content .leaflet-container {max-width:100% !important;}

  /* Mobile record tables present as compact record surfaces. */
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table tbody {display:grid !important;gap:7px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table tr {display:block !important;width:100% !important;min-width:0 !important;padding:9px 10px !important;background:var(--fm12-surface) !important;border:1px solid var(--fm12-line) !important;border-radius:12px !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table td {display:grid !important;grid-template-columns:minmax(90px,.8fr) minmax(0,1.2fr) !important;gap:8px !important;min-width:0 !important;padding:4px 0 !important;border:0 !important;color:var(--fm12-text) !important;font-size:10.5px !important;line-height:1.25 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content table.mobile-record-table td::before {color:var(--fm12-text-3) !important;font-size:8px !important;line-height:1.2 !important;letter-spacing:.08em !important;}

  /* Fixed 5-tab navigation. */
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-nav {
    position:fixed !important;z-index:50 !important;left:0 !important;right:0 !important;bottom:0 !important;
    height:72px !important;min-height:72px !important;margin:0 !important;padding:5px 8px calc(6px + env(safe-area-inset-bottom,0px)) !important;
    display:grid !important;grid-template-columns:repeat(5,minmax(0,1fr)) !important;align-items:center !important;
    background:rgba(12,12,14,.98) !important;border:0 !important;border-top:1px solid var(--fm12-line) !important;box-shadow:none !important;
    backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);
  }
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-tab {
    position:relative !important;display:flex !important;flex-direction:column !important;align-items:center !important;justify-content:center !important;gap:2px !important;
    min-width:0 !important;min-height:54px !important;padding:5px 2px !important;border:0 !important;border-radius:10px !important;background:transparent !important;color:#8A8A90 !important;box-shadow:none !important;font-size:9px !important;line-height:1 !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-tab.is-active {color:var(--fm12-amber) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-tab.is-active::after {content:"" !important;position:absolute !important;bottom:2px !important;width:4px !important;height:4px !important;border-radius:50% !important;background:var(--fm12-amber) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-icon {position:relative !important;width:24px !important;height:24px !important;display:grid !important;place-items:center !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-icon > svg {width:21px !important;height:21px !important;stroke-width:1.5 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-money-badge-v12 {position:absolute !important;top:-4px !important;right:-6px !important;min-width:16px !important;height:16px !important;padding:0 4px !important;border-radius:999px !important;display:grid !important;place-items:center !important;background:var(--fm12-green) !important;color:#07120D !important;border:2px solid #0C0C0E !important;font-size:8px !important;font-weight:750 !important;line-height:1 !important;}

  /* Preserve Copilot but make it visually subordinate to farmer workflows. */
  body[data-ed-portal="farmer"] .farmer-dashboard-root .copilot-fab {
    width:38px !important;height:38px !important;right:14px !important;bottom:calc(82px + env(safe-area-inset-bottom,0px)) !important;
    border-radius:11px !important;background:var(--fm12-surface) !important;border:1px solid var(--fm12-line-strong) !important;color:var(--fm12-amber) !important;box-shadow:none !important;
  }

  /* Drawer matches the same visual system and keeps logout available. */
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar {width:min(82vw,312px) !important;background:#0C0C0E !important;border-right:1px solid var(--fm12-line) !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item {min-height:42px !important;border-radius:9px !important;color:var(--fm12-text-2) !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item.is-active,
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item.active {color:var(--fm12-text) !important;background:var(--fm12-amber-soft) !important;}
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 {background:#0C0C0E !important;border-top:1px solid var(--fm12-line) !important;}
}

@media (max-width: 360px) {
  body[data-ed-portal="farmer"] #farmer-main-content.ed-mobile-main-v8,
  body[data-ed-portal="farmer"] #farmer-main-content {padding-left:12px !important;padding-right:12px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-home-v11 {gap:12px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-actions-v11 {grid-template-columns:minmax(0,1.4fr) minmax(0,.9fr) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 {height:104px !important;min-height:104px !important;padding:12px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button {height:80px !important;min-height:80px !important;padding:9px !important;}
}

/* v12.1 — density calibration against the approved 521×872 reference viewport. */
@media (min-width: 400px) and (max-width: 767px) {
  body[data-ed-portal="farmer"] .farmer-mobile-identity-v11 {padding:14px 16px 10px !important;grid-template-columns:48px minmax(0,1fr) !important;gap:12px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-avatar-v11 {width:48px !important;height:48px !important;min-width:48px !important;font-size:21px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-id-v11 {margin:1px -16px -10px !important;padding:9px 16px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-v11 {padding:15px 16px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-value-v11 {font-size:44px !important;margin-top:10px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-payouts-v11 {margin-top:10px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-actions-v11 {margin-top:11px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-wallet-actions-v11 button {height:46px !important;min-height:46px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 {height:100px !important;min-height:100px !important;padding:12px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-kpi-v11 > strong {font-size:24px !important;margin-top:10px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 {grid-template-columns:repeat(4,minmax(0,1fr)) !important;gap:8px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button {height:86px !important;min-height:86px !important;padding:9px 8px !important;display:flex !important;flex-direction:column !important;align-items:flex-start !important;justify-content:flex-start !important;gap:7px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 button > span {width:32px !important;height:32px !important;flex:0 0 32px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 strong {font-size:10.5px !important;line-height:1.1 !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 small {display:none !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-activity-row-v11 {min-height:56px !important;padding:8px 1px !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-home-v11 {gap:12px !important;}
}

@media (max-width: 399px) {
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 {grid-template-columns:repeat(2,minmax(0,1fr)) !important;}
  body[data-ed-portal="farmer"] .farmer-mobile-quick-grid-v11 small {display:block !important;}
}

/* ═══════════════════════════════════════════════════════════════════════
   v13.0 — FARMER PORTAL COMPLETE MOBILE PRODUCT SYSTEM
   Canonical mobile contract for all 17 Farmer tabs.  This block is last on
   purpose and overrides all earlier experimental Farmer mobile rules.
   Visual language: wallet-first Home, quiet near-black surfaces, 1px
   hairlines, one amber accent, compact operational lists, no document drift.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  body[data-ed-portal="farmer"] {
    --fm13-bg:#0A0A0B;
    --fm13-surface:#101012;
    --fm13-surface-2:#0E0E10;
    --fm13-surface-3:#141416;
    --fm13-line:rgba(255,255,255,.06);
    --fm13-line-strong:rgba(255,255,255,.11);
    --fm13-text:#FAFAFA;
    --fm13-text-2:#A0A0A6;
    --fm13-text-3:#6B6B70;
    --fm13-amber:#F5A623;
    --fm13-amber-soft:rgba(245,166,35,.10);
    --fm13-green:#10B981;
    --fm13-red:#EF4444;
    --fm13-radius:14px;
    --fm13-gap:12px;
  }

  /* ---- hard responsive safety contract ---- */
  body[data-ed-portal="farmer"],
  body[data-ed-portal="farmer"] #root,
  body[data-ed-portal="farmer"] .farmer-dashboard-root,
  body[data-ed-portal="farmer"] #farmer-main-content,
  body[data-ed-portal="farmer"] .farmer-tab-root,
  body[data-ed-portal="farmer"] .farmer-mobile-v13 {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
    box-sizing:border-box !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content {
    padding-left:16px !important;
    padding-right:16px !important;
    padding-top:14px !important;
    padding-bottom:92px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] {padding-top:14px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content :where(h1,h2,h3,h4,h5,h6,p,span,strong,small,label,td,th,button,a,li) {
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
    hyphens:none !important;
    min-width:0;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .nums,
  body[data-ed-portal="farmer"] #farmer-main-content [class*="font-mono"] {font-variant-numeric:tabular-nums lining-nums !important;}

  /* ---- one visual system for every non-Home tab ---- */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 {
    display:flex !important;
    flex-direction:column !important;
    gap:var(--fm13-gap) !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 > * {min-width:0 !important;max-width:100% !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 :where(.surface-card,.surface-elevated) {
    background:var(--fm13-surface) !important;
    border:1px solid var(--fm13-line) !important;
    border-radius:var(--fm13-radius) !important;
    box-shadow:none !important;
    background-image:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 :where(.surface-inset) {
    background:var(--fm13-surface-2) !important;
    border:1px solid var(--fm13-line) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 > .surface-card:not([class*="p-0"]),
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 > .surface-elevated:not([class*="p-0"]) {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 [class*="p-5"],
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 [class*="p-6"],
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 [class*="p-7"] {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 [class*="space-y-6"] > :not([hidden]) ~ :not([hidden]) {margin-top:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 [class*="space-y-4"] > :not([hidden]) ~ :not([hidden]) {margin-top:10px !important;}

  /* ---- tab title bar: same quiet hierarchy across 16 secondary tabs ---- */
  body[data-ed-portal="farmer"] .farmer-mobile-page-head-v11 {
    margin:0 0 12px !important;
    padding:0 0 10px !important;
    border-bottom:1px solid var(--fm13-line) !important;
    background:transparent !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-page-head-v11 p {
    margin:0 0 4px !important;color:var(--fm13-text-3) !important;font-size:9px !important;font-weight:650 !important;letter-spacing:.12em !important;line-height:1 !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-page-head-v11 h1 {
    margin:0 !important;color:var(--fm13-text) !important;font-size:20px !important;font-weight:680 !important;letter-spacing:-.015em !important;line-height:1.15 !important;
  }

  /* ---- section headers ---- */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .ui-section-header {
    display:grid !important;grid-template-columns:minmax(0,1fr) auto !important;gap:10px !important;align-items:center !important;width:100% !important;min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .ui-section-header-main {display:flex !important;flex:1 1 auto !important;gap:8px !important;align-items:flex-start !important;min-width:0 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .ui-section-header-icon {width:28px !important;height:28px !important;min-width:28px !important;border-radius:8px !important;background:var(--fm13-surface-2) !important;border:1px solid var(--fm13-line) !important;color:var(--fm13-text-2) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .ui-section-header-icon svg {width:14px !important;height:14px !important;stroke-width:1.5 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .section-eyebrow {font-size:8px !important;line-height:1 !important;color:var(--fm13-text-3) !important;letter-spacing:.11em !important;margin-bottom:3px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .section-title {font-size:14px !important;line-height:1.18 !important;font-weight:650 !important;color:var(--fm13-text) !important;white-space:normal !important;overflow:visible !important;text-overflow:clip !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .ui-section-header p:not(.section-eyebrow) {font-size:10px !important;line-height:1.35 !important;color:var(--fm13-text-2) !important;margin-top:3px !important;}

  /* ---- buttons / fields ---- */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 :where(button,.btn-primary,.btn-secondary,.btn-accent) {min-height:44px !important;border-radius:10px !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 :where(.btn-primary,.btn-accent) {background:var(--fm13-amber) !important;color:#111 !important;border:1px solid rgba(245,166,35,.60) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .btn-secondary {background:transparent !important;color:var(--fm13-text) !important;border:1px solid var(--fm13-line-strong) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 :where(input,select,textarea) {width:100% !important;min-width:0 !important;max-width:100% !important;background:var(--fm13-surface-2) !important;border:1px solid var(--fm13-line-strong) !important;border-radius:10px !important;color:var(--fm13-text) !important;box-shadow:none !important;font-size:16px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 :where(input,select) {min-height:44px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 textarea {min-height:92px !important;line-height:1.4 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 form :where(.grid.grid-cols-2,.grid.grid-cols-3,.grid.grid-cols-4,[class*="md:grid-cols-"]) {grid-template-columns:minmax(0,1fr) !important;gap:10px !important;}

  /* ---- records: compact list surfaces, never mobile desktop tables ---- */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 table.mobile-record-table {display:block !important;width:100% !important;min-width:0 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 table.mobile-record-table thead {display:none !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 table.mobile-record-table tbody {display:grid !important;gap:8px !important;padding:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 table.mobile-record-table tr {display:block !important;width:100% !important;min-width:0 !important;padding:9px 10px !important;background:var(--fm13-surface-2) !important;border:1px solid var(--fm13-line) !important;border-radius:11px !important;box-shadow:none !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 table.mobile-record-table td {display:grid !important;grid-template-columns:minmax(88px,.85fr) minmax(0,1.15fr) !important;align-items:center !important;gap:8px !important;min-height:28px !important;padding:4px 0 !important;border:0 !important;border-bottom:1px solid rgba(255,255,255,.04) !important;text-align:right !important;font-size:11px !important;line-height:1.25 !important;color:var(--fm13-text) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 table.mobile-record-table td:last-child {border-bottom:0 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 table.mobile-record-table td::before {color:var(--fm13-text-3) !important;font-size:8px !important;font-weight:650 !important;letter-spacing:.08em !important;line-height:1.15 !important;text-align:left !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .overflow-x-auto:has(table.mobile-record-table) {overflow:visible !important;max-width:100% !important;border:0 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-record-section-head {padding:11px 12px !important;border-bottom:1px solid var(--fm13-line) !important;}

  /* ═══ BATCHES ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="batches"] .farmer-batches-section {overflow:hidden !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="batches"] .farmer-batches-records td:first-child {font-size:11px !important;color:var(--fm13-text-2) !important;font-variant-numeric:tabular-nums !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="batches"] .pagination {border-top:1px solid var(--fm13-line) !important;}

  /* ═══ PAYMENTS — wallet first, then transaction lists ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="payments"] .farmer-payments-wallet-card {padding:14px !important;background:var(--fm13-surface) !important;border:1px solid var(--fm13-line) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="payments"] .farmer-payments-wallet-layout {display:grid !important;grid-template-columns:minmax(0,1fr) !important;gap:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="payments"] .farmer-payments-wallet-card [class*="text-3xl"] {font-size:34px !important;line-height:1 !important;letter-spacing:-.03em !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="payments"] .farmer-payments-wallet-card .btn-accent {width:100% !important;justify-content:center !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="payments"] :is(.farmer-payments-pending-card,.farmer-payments-history-card,.farmer-withdrawal-history-card) {overflow:hidden !important;}

  /* ═══ MY FARMS — compact list + map-dominant detail ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farms-kpi-grid {grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farms-info-card {padding:11px 12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-card {width:100% !important;overflow:hidden !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-card > :first-child {padding:11px 12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-card [class*="grid-cols-2"] {grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-card [class*="grid-cols-3"] {grid-template-columns:minmax(0,1fr) !important;}

  /* ═══ SMART ADVISORY — priority / timeline / context ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero {padding:12px !important;background:var(--fm13-surface) !important;border:1px solid var(--fm13-line) !important;border-radius:var(--fm13-radius) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero > div {display:grid !important;grid-template-columns:minmax(0,1fr) !important;gap:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero [class*="min-w-[260px]"] {min-width:0 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero h2 {font-size:15px !important;line-height:1.2 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-hero > div > div:last-child {display:none !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-layout {display:grid !important;grid-template-columns:minmax(0,1fr) !important;gap:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] :is(.farmer-smart-advisory-timeline,.farmer-smart-advisory-agronomist,.farmer-smart-advisory-weather,.farmer-smart-advisory-risk) {width:100% !important;padding:12px !important;border-left-width:1px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-context {display:grid !important;grid-template-columns:minmax(0,1fr) !important;gap:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-smart-advisory-timeline-heading {margin-bottom:2px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="smart-advisory"] .farmer-agronomist-card :is(p,li) {font-size:11px !important;line-height:1.45 !important;}

  /* ═══ PEST SCANNER — scanner first ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] .farmer-tab-pest-scanner > .surface-card:first-child {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] .farmer-tab-pest-scanner img {width:100% !important;max-height:300px !important;object-fit:cover !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] .farmer-tab-pest-scanner .surface-inset {padding:10px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="pest-scanner"] .farmer-pest-records {margin-top:0 !important;}

  /* ═══ PRODUCT SCAN — scan controls first, result second ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-product-scanner-root {display:flex !important;flex-direction:column !important;gap:12px !important;width:100% !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] :is(.farmer-product-scanner-intro-card,.farmer-product-scanner-form-card,.farmer-product-scanner-result-card) {padding:12px !important;background:var(--fm13-surface) !important;border:1px solid var(--fm13-line) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-product-scanner-form-card > .flex.gap-2 {display:grid !important;grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-product-scanner-form-card > .flex.gap-2 button {width:100% !important;min-width:0 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-product-scanner-result-card [class*="grid-cols-2"] {grid-template-columns:minmax(0,1fr) !important;gap:6px !important;}

  /* ═══ SUSTAINABILITY — score, carbon, compliance ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary > .grid {grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary > .grid > div {min-height:74px !important;padding:9px !important;border-width:1px !important;border-color:var(--fm13-line) !important;background:var(--fm13-surface-2) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-sustainability-summary .text-3xl.block {display:none !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-carbon-card {margin-bottom:0 !important;overflow:hidden !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-carbon-card > .p-5 {padding:11px 12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-carbon-card > .grid {grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="sustainability"] .farmer-eudr-card {margin-bottom:0 !important;padding:12px !important;}

  /* ═══ ADVISORY — reading feed ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .farmer-advisory-feed-card {overflow:hidden !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .farmer-advisory-feed-card > .divide-y > div {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .farmer-advisory-feed-card h4 {font-size:13px !important;white-space:normal !important;overflow:visible !important;text-overflow:clip !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="advisory"] .farmer-advisory-feed-card p {font-size:11px !important;line-height:1.45 !important;}

  /* ═══ NOTIFY HARVEST — sequential, one-column workflow ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-harvest-form-card {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-harvest-form-card form {display:flex !important;flex-direction:column !important;gap:10px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-harvest-form-card form > * {margin:0 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-harvest-history-card {overflow:hidden !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-harvest-verify-card {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-batch-verify-row {display:grid !important;grid-template-columns:minmax(0,1fr) !important;gap:8px !important;padding:10px !important;background:var(--fm13-surface-2) !important;border:1px solid var(--fm13-line) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-batch-verify-row > :last-child {width:100% !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-batch-verify-row .flex.gap-2 {display:grid !important;grid-template-columns:84px minmax(0,1fr) minmax(0,1fr) !important;gap:6px !important;}

  /* ═══ MY GRADES ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="grade-history"] .farmer-grade-summary-card {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="grade-history"] .farmer-grade-records td:nth-child(2) {font-size:12px !important;font-weight:650 !important;}

  /* ═══ INPUT CREDIT — summary first, ledger second ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .farmer-input-credit-summary {grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .farmer-input-credit-summary > :nth-child(3) {grid-column:1 / -1 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .farmer-input-credit-summary .surface-card {min-height:72px !important;padding:10px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .farmer-input-credit-summary [class*="text-xl"] {font-size:18px !important;line-height:1.1 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .farmer-input-credit-ledger {overflow:hidden !important;}

  /* ═══ QUALITY — two result lists, no giant metric slabs ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="quality"] .farmer-quality-record-card {overflow:hidden !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="quality"] .farmer-quality-record-card > .p-5 {padding:11px 12px !important;}

  /* ═══ YIELD — forecast summary + compact biological capacity cards ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card > .grid {grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card > .grid > div {min-width:0 !important;padding:8px !important;background:var(--fm13-surface-2) !important;border:1px solid var(--fm13-line) !important;border-radius:10px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card > .mt-3.grid {font-size:10.5px !important;}

  /* ═══ FARM ACTIVITIES — farmer-friendly step flow, no oversized pictograms ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] .farmer-activities-intro-card {padding:10px 12px !important;background:var(--fm13-surface) !important;border-color:var(--fm13-line) !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] .farmer-activities-intro-card > div {align-items:center !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] .farmer-activities-intro-icon,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-empty-icon {width:32px !important;height:32px !important;display:grid !important;place-items:center !important;border-radius:9px !important;background:var(--fm13-amber-soft) !important;color:var(--fm13-amber) !important;border:1px solid rgba(245,166,35,.18) !important;margin:0 auto 10px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] .farmer-activities-records-card {overflow:hidden !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] .farmer-activities-records-head {padding:10px 12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] .farmer-activities-records-card .divide-y > div {padding:10px 12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="activities"] .farmer-activities-records-card .w-12.h-12 {width:36px !important;height:36px !important;min-width:36px !important;border-radius:10px !important;font-size:16px !important;}
  body[data-ed-portal="farmer"] .sheet [class*="grid-cols-4"] {grid-template-columns:repeat(2,minmax(0,1fr)) !important;}
  body[data-ed-portal="farmer"] .sheet [class*="scale-105"] {transform:none !important;box-shadow:none !important;}

  /* ═══ AI ASSISTANT — task form + full-width result area ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] .farmer-tab-ai-assistant > .surface-card {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] .farmer-tab-ai-assistant [class*="grid-cols-2"],
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] .farmer-tab-ai-assistant [class*="grid-cols-3"] {grid-template-columns:minmax(0,1fr) !important;gap:10px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] .farmer-tab-ai-assistant pre,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="ai-assistant"] .farmer-tab-ai-assistant code {white-space:pre-wrap !important;word-break:break-word !important;max-width:100% !important;overflow-wrap:break-word !important;}

  /* ═══ MARKET — current price first, records + AI analysis second ═══ */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-tab-market > .grid {grid-template-columns:repeat(2,minmax(0,1fr)) !important;gap:8px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-tab-market > .grid .surface-card {min-height:76px !important;padding:10px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-tab-market > .surface-card {padding:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-tab-market .data-table {margin-top:0 !important;}

  /* ---- alerts / empty states / status pills consistent everywhere ---- */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .alert,
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 [role="alert"] {border-radius:10px !important;box-shadow:none !important;font-size:11px !important;line-height:1.4 !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .empty-state {padding:20px 12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 :where(.pill-success,.pill-warning,.pill-danger,.pill-info,.pill-neutral) {font-size:9px !important;line-height:1 !important;padding:4px 7px !important;white-space:nowrap !important;}

  /* ---- media / map safety ---- */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 :where(img,canvas,video,.leaflet-container) {max-width:100% !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 svg:not(.farmer-mobile-spark-v11) {max-width:100%;}

  /* ---- Copilot remains available but visually subordinate ---- */
  body[data-ed-portal="farmer"] .farmer-dashboard-root .copilot-fab {width:36px !important;height:36px !important;right:12px !important;bottom:calc(84px + env(safe-area-inset-bottom,0px)) !important;border-radius:10px !important;}
}

@media (max-width: 360px) {
  body[data-ed-portal="farmer"] #farmer-main-content {padding-left:12px !important;padding-right:12px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 table.mobile-record-table td {grid-template-columns:minmax(78px,.8fr) minmax(0,1.2fr) !important;gap:6px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-tab-market > .grid,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .farmer-input-credit-summary,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="yield"] .farmer-yield-forecast-card > .grid {grid-template-columns:repeat(2,minmax(0,1fr)) !important;}
}
@media (max-width: 767px) {
  body[data-ed-portal="farmer"] .farmer-activity-type-icon,
  body[data-ed-portal="farmer"] .farmer-method-icon {
    display:grid !important;place-items:center !important;margin:0 auto 6px !important;color:var(--fm13-amber) !important;
  }
  body[data-ed-portal="farmer"] .farmer-activity-type-icon svg {width:22px !important;height:22px !important;stroke-width:1.5 !important;}
  body[data-ed-portal="farmer"] .farmer-method-icon svg {width:18px !important;height:18px !important;stroke-width:1.5 !important;}
}
@media (max-width: 767px) {
  body[data-ed-portal="farmer"] .farmer-tier-icon {width:28px !important;height:28px !important;display:grid !important;place-items:center !important;margin:0 auto 5px !important;color:var(--fm13-amber) !important;}
  body[data-ed-portal="farmer"] .farmer-tier-icon svg {width:18px !important;height:18px !important;stroke-width:1.5 !important;}
}


/* ═══════════════════════════════════════════════════════════════════════
   FARMER / MY FARMS — LEAFLET GEOMETRY CONTRACT v4.4.20
   One authority only: .farmer-map-viewer owns the viewport height;
   Leaflet fills it exactly. Generic responsive image rules must never
   resize Leaflet tiles/markers. Mobile-only; desktop geometry is preserved.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px), (max-width: 900px) and (max-height: 500px) {
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-farm-card {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    padding:0 !important;
    overflow:hidden !important;
  }

  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-viewer {
    position:relative !important;
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    overflow:hidden !important;
    border-radius:0 !important;
    contain:layout paint;
  }

  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-canvas,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-viewer .leaflet-container {
    position:absolute !important;
    inset:0 !important;
    width:100% !important;
    height:100% !important;
    min-width:0 !important;
    min-height:0 !important;
    max-width:none !important;
    max-height:none !important;
    margin:0 !important;
    border-radius:0 !important;
  }

  /* Leaflet owns tile/marker pixel dimensions. Never apply responsive-image
     resizing to these generated map assets. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-viewer img.leaflet-tile,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-viewer img.leaflet-marker-icon,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-viewer img.leaflet-marker-shadow,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-viewer .leaflet-pane img {
    max-width:none !important;
    max-height:none !important;
    object-fit:unset !important;
  }

  /* Keep Leaflet panes and custom overlays clipped to the same viewport. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-viewer :where(.leaflet-map-pane,.leaflet-tile-pane,.leaflet-overlay-pane,.leaflet-marker-pane,.leaflet-tooltip-pane,.leaflet-popup-pane) {
    max-width:none !important;
  }

  /* Mobile control geometry: touch-safe, inside viewport, no overlap with
     farm name / EUDR / area badges. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-layers {
    top:8px !important;
    right:8px !important;
    display:flex !important;
    flex-direction:row !important;
    gap:4px !important;
    max-width:calc(100% - 16px) !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-layers button,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-actions button {
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    min-height:44px !important;
    padding:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-layers button {
    font-size:0 !important;
    gap:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-layers button svg {
    width:15px !important;
    height:15px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-actions {
    top:auto !important;
    bottom:8px !important;
    left:8px !important;
    right:auto !important;
    transform:none !important;
    gap:4px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-label {
    left:52px !important;
    top:8px !important;
    max-width:calc(100% - 208px) !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-status {
    right:8px !important;
    bottom:60px !important;
    max-width:52% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-status > * {
    max-width:100% !important;
    white-space:normal !important;
    overflow-wrap:break-word !important;
    word-break:normal !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-coordinates { display:none !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-compass { display:none !important; }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .farmer-map-help {
    display:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .leaflet-control-scale {
    margin-left:8px !important;
    margin-bottom:60px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .leaflet-control-attribution {
    max-width:68% !important;
    white-space:normal !important;
    line-height:1.2 !important;
    font-size:8px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .leaflet-popup-content-wrapper,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="farms"] .leaflet-popup-content {
    max-width:min(260px, calc(100vw - 56px)) !important;
    overflow-wrap:break-word !important;
    word-break:normal !important;
    writing-mode:horizontal-tb !important;
  }
}

/* Farm map fullscreen uses the same wrapper-owned geometry contract. */
.farmer-map-viewer:fullscreen {
  width:100vw !important;
  height:100vh !important;
  max-width:none !important;
  max-height:none !important;
  border-radius:0 !important;
  background:#0a0a0b !important;
}
.farmer-map-viewer:fullscreen .farmer-map-canvas,
.farmer-map-viewer:fullscreen .leaflet-container {
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
  max-height:none !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   FARMER MOBILE RESPONSIVE CONTRACT v14.0 — REGRESSION CLOSURE
   Final authority for mobile composition, section-header geometry and
   record readability. This block intentionally comes last so obsolete
   legacy mobile rules cannot re-open the narrow-column/KPI-first bugs.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* 1) Home composition precedence: old desktop identity/KPI/overview never
     participate in mobile layout. The dedicated wallet-first Home is the
     only Overview composition below the workspace app bar. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] > .farmer-identity-card,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] > .farmer-kpi-grid,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-desktop-overview {
    display:none !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="overview"] .farmer-mobile-home-v11 {
    display:flex !important;
    flex-direction:column !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }

  /* 2) SectionHeader geometry. The previous v13 rule always reserved a 28px
     grid column for an icon even when no icon existed; in icon-less headers
     the copy therefore occupied the 28px column and wrapped character by
     character. Flex correctly handles both icon and no-icon variants. */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .ui-section-header {
    display:flex !important;
    align-items:flex-start !important;
    justify-content:space-between !important;
    gap:10px !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .ui-section-header-main {
    display:flex !important;
    flex:1 1 auto !important;
    align-items:flex-start !important;
    gap:8px !important;
    width:auto !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .ui-section-header-copy {
    display:block !important;
    flex:1 1 auto !important;
    width:auto !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .ui-section-header-actions {
    flex:0 0 auto !important;
    width:auto !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .ui-section-header-copy :where(.section-eyebrow,.section-title,p) {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    white-space:normal !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
    hyphens:none !important;
  }

  /* 3) Record/header cards must use their complete content lane. */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 :where(
    .farmer-record-section-head,
    .farmer-product-scanner-intro-card,
    .farmer-product-scanner-form-card,
    .farmer-product-scanner-result-card,
    .farmer-input-credit-ledger,
    .farmer-harvest-history-card
  ) {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 .farmer-record-section-head > .ui-section-header,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-product-scanner-intro-card > .ui-section-header {
    width:100% !important;
    min-width:0 !important;
  }

  /* 4) Product Scan: scanner/form uses the entire card, no intrinsic-width
     collapse and no desktop paired fields squeezed side-by-side. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .product-scanner-root,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .product-scanner-root > * {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-product-scanner-form-card > .flex.gap-2 {
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
    width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-product-scanner-form-card .space-y-3,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-product-scanner-form-card .space-y-3 > * {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-product-scanner-form-card .grid.grid-cols-2 {
    grid-template-columns:minmax(0,1fr) !important;
    gap:8px !important;
  }

  /* 5) Input Credit + Harvest history: compact, full-width, content-height
     records/empty state surfaces rather than tall empty shells. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .farmer-input-credit-ledger,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-harvest-history-card {
    height:auto !important;
    min-height:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .farmer-input-credit-ledger > .p-8,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .farmer-harvest-history-card > .p-8 {
    padding:18px 12px !important;
    min-height:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="input-credit"] .empty-state,
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="harvest"] .empty-state {
    width:100% !important;
    min-width:0 !important;
    min-height:0 !important;
    padding:8px 4px !important;
  }

  /* 6) Market history: keep the real table/data but present each record as a
     compact mobile market row with explicit labels and price hierarchy. */
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records tbody {
    gap:7px !important;
    padding:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records tr {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    column-gap:10px !important;
    row-gap:3px !important;
    align-items:center !important;
    padding:9px 10px !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records td {
    display:flex !important;
    align-items:baseline !important;
    justify-content:space-between !important;
    gap:6px !important;
    min-height:0 !important;
    padding:0 !important;
    border:0 !important;
    text-align:left !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records td::before {
    flex:0 0 auto !important;
    color:var(--fm13-text-3) !important;
    font-size:7.5px !important;
    font-weight:650 !important;
    letter-spacing:.08em !important;
    text-transform:uppercase !important;
  }
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records td:nth-child(1) {grid-column:1;grid-row:1;color:var(--fm13-text-2) !important;font-size:9.5px !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records td:nth-child(2) {grid-column:2;grid-row:1 / span 2;display:block !important;text-align:right !important;color:var(--fm13-text) !important;font-size:15px !important;font-weight:700 !important;font-variant-numeric:tabular-nums !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records td:nth-child(3) {grid-column:1;grid-row:2;color:var(--fm13-text-2) !important;font-size:9.5px !important;justify-content:flex-start !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records td:nth-child(4) {grid-column:1 / -1;grid-row:3;color:var(--fm13-text-3) !important;font-size:9px !important;justify-content:flex-start !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records td:nth-child(1)::before {content:"Date";}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records td:nth-child(2)::before {content:none !important;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records td:nth-child(3)::before {content:"Market";margin-right:5px;}
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="market"] .farmer-mobile-v13 table.mobile-record-table.farmer-market-records td:nth-child(4)::before {content:"Region";margin-right:5px;}

  /* 7) Text safety: full Farmer portal, including custom empty states. */
  body[data-ed-portal="farmer"] #farmer-main-content .farmer-mobile-v13 :where(h1,h2,h3,h4,h5,h6,p,span,strong,small,label,li,td,th) {
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
    hyphens:none !important;
  }

  /* 8) Floating assistant remains available but never covers the fixed nav. */
  body[data-ed-portal="farmer"] .farmer-dashboard-root .copilot-fab {
    right:12px !important;
    bottom:calc(84px + env(safe-area-inset-bottom,0px)) !important;
    z-index:39 !important;
  }
}

@media (max-width: 360px) {
  body[data-ed-portal="farmer"] #farmer-main-content[data-mobile-tab="product-scanner"] .farmer-product-scanner-form-card > .flex.gap-2 {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   v14.0 — FARMER MOBILE WORKSPACE DRAWER
   Premium, quiet off-canvas navigation for the complete 17-tab Farmer
   workspace. Mobile-scoped only; desktop sidebar geometry is untouched.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar {
    width:min(82vw,312px) !important;
    max-width:312px !important;
    height:100dvh !important;
    padding:0 !important;
    background:#0A0A0B !important;
    border-right:1px solid rgba(255,255,255,.07) !important;
    box-shadow:none !important;
    overflow:hidden !important;
    overscroll-behavior:contain !important;
    color:#FAFAFA !important;
    z-index:80 !important;
  }

  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 {
    min-height:72px !important;
    padding:calc(10px + env(safe-area-inset-top,0px)) 12px 10px !important;
    display:flex !important;
    align-items:center !important;
    gap:10px !important;
    background:#0A0A0B !important;
    border-bottom:1px solid rgba(255,255,255,.06) !important;
    flex:0 0 auto !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-collapse-btn {display:none !important;}
  body[data-ed-portal="farmer"] .ed-mobile-drawer-brand-mark {
    width:34px !important;
    height:34px !important;
    border-radius:50% !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    flex:0 0 34px !important;
    background:#F5A623 !important;
    color:#090909 !important;
    font:700 13px/1 Inter,system-ui,sans-serif !important;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.10) !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-header-text {
    min-width:0 !important;
    display:flex !important;
    flex-direction:column !important;
    justify-content:center !important;
    gap:2px !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-header-mobile-eyebrow {
    display:block !important;
    color:#6B6B70 !important;
    font:700 9px/1.15 Inter,system-ui,sans-serif !important;
    letter-spacing:.13em !important;
    text-transform:uppercase !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-header-title {
    color:#FAFAFA !important;
    font-size:13px !important;
    font-weight:650 !important;
    line-height:1.25 !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-header-desktop-subtitle {display:none !important;}
  body[data-ed-portal="farmer"] .ed-drawer-close {
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    min-height:44px !important;
    margin-left:auto !important;
    padding:0 !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    border:1px solid rgba(255,255,255,.06) !important;
    border-radius:10px !important;
    background:transparent !important;
    color:#A0A0A6 !important;
    cursor:pointer !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .ed-drawer-close:active {background:#141416 !important;color:#FAFAFA !important;}
  body[data-ed-portal="farmer"] .ed-drawer-close:focus-visible,
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item:focus-visible,
  body[data-ed-portal="farmer"] .ed-sidebar .ed-search-input:focus-visible,
  body[data-ed-portal="farmer"] .ed-sidebar .ed-mobile-logout:focus-visible {
    outline:2px solid #F5A623 !important;
    outline-offset:2px !important;
  }

  body[data-ed-portal="farmer"] .ed-sidebar .ed-search-wrap {
    padding:10px 12px 6px !important;
    flex:0 0 auto !important;
    background:#0A0A0B !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-search-input {
    width:100% !important;
    min-height:42px !important;
    padding:0 12px !important;
    border:1px solid rgba(255,255,255,.07) !important;
    border-radius:10px !important;
    background:#101012 !important;
    color:#FAFAFA !important;
    font:500 16px/1 Inter,system-ui,sans-serif !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-search-input::placeholder {color:#6B6B70 !important;}

  body[data-ed-portal="farmer"] .ed-sidebar .ed-sidebar-nav-v14 {
    flex:1 1 auto !important;
    min-height:0 !important;
    width:100% !important;
    padding:2px 10px 12px !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    overscroll-behavior:contain !important;
    scrollbar-width:thin !important;
    scrollbar-color:#2A2A2D transparent !important;
    -webkit-overflow-scrolling:touch !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-group {width:100% !important;min-width:0 !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-group + .ed-group {
    border-top:1px solid rgba(255,255,255,.04) !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-group-label {
    min-height:0 !important;
    padding:14px 10px 6px !important;
    margin:0 !important;
    display:block !important;
    color:#6B6B70 !important;
    font:700 9px/1.2 Inter,system-ui,sans-serif !important;
    letter-spacing:.13em !important;
    text-transform:uppercase !important;
    white-space:nowrap !important;
    cursor:default !important;
    pointer-events:none !important;
    user-select:none !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-group-label svg {display:none !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-group-items {
    max-height:none !important;
    overflow:visible !important;
    display:flex !important;
    flex-direction:column !important;
    gap:2px !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item {
    position:relative !important;
    width:100% !important;
    min-width:0 !important;
    min-height:46px !important;
    margin:0 !important;
    padding:0 11px 0 13px !important;
    display:flex !important;
    align-items:center !important;
    gap:11px !important;
    border-left:2px solid transparent !important;
    border-radius:9px !important;
    background:transparent !important;
    color:#A0A0A6 !important;
    font:550 13px/1.2 Inter,system-ui,sans-serif !important;
    letter-spacing:0 !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-align:left !important;
    box-shadow:none !important;
    cursor:pointer !important;
    transition:background-color .14s ease,color .14s ease,border-color .14s ease !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item::before {
    content:"";
    position:absolute;
    left:0;
    top:10px;
    bottom:10px;
    width:2px;
    border-radius:999px;
    background:transparent;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item .ed-nav-icon {
    width:20px !important;
    height:20px !important;
    flex:0 0 20px !important;
    color:#7F7F85 !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item .ed-nav-icon svg {
    width:20px !important;
    height:20px !important;
    stroke-width:1.5 !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item .ed-nav-text {
    min-width:0 !important;
    flex:1 1 auto !important;
    display:block !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    white-space:nowrap !important;
    word-break:normal !important;
    overflow-wrap:normal !important;
    writing-mode:horizontal-tb !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item .ed-nav-badge {
    margin-left:auto !important;
    min-width:20px !important;
    height:20px !important;
    padding:0 6px !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    border:1px solid rgba(255,255,255,.06) !important;
    border-radius:999px !important;
    background:#171719 !important;
    color:#A0A0A6 !important;
    font:700 10px/1 ui-monospace,SFMono-Regular,Menlo,monospace !important;
    font-variant-numeric:tabular-nums !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item[aria-current="page"] {
    background:rgba(245,166,35,.09) !important;
    border-left-color:#F5A623 !important;
    color:#FAFAFA !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item[aria-current="page"]::before {background:#F5A623 !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item[aria-current="page"] .ed-nav-icon {color:#F5A623 !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item:active {background:#151517 !important;color:#FAFAFA !important;}

  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 {
    flex:0 0 auto !important;
    width:100% !important;
    padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px)) !important;
    display:grid !important;
    grid-template-columns:34px minmax(0,1fr) !important;
    grid-template-rows:auto auto !important;
    column-gap:10px !important;
    row-gap:10px !important;
    align-items:center !important;
    border-top:1px solid rgba(255,255,255,.06) !important;
    background:#0C0C0E !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-footer-avatar {
    grid-column:1 !important;
    grid-row:1 !important;
    width:34px !important;
    height:34px !important;
    background:#151517 !important;
    color:#F5A623 !important;
    border:1px solid rgba(245,166,35,.18) !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-footer-text {
    grid-column:2 !important;
    grid-row:1 !important;
    min-width:0 !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-footer-text > div:first-child {
    color:#FAFAFA !important;
    font-size:12px !important;
    font-weight:600 !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-footer-text > div:last-child {
    color:#6B6B70 !important;
    font-size:9px !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-mobile-logout {
    grid-column:1 / -1 !important;
    grid-row:2 !important;
    width:100% !important;
    min-height:44px !important;
    padding:0 12px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:10px !important;
    border:1px solid rgba(255,255,255,.06) !important;
    border-radius:9px !important;
    background:transparent !important;
    color:#A0A0A6 !important;
    font-size:12px !important;
    font-weight:600 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-mobile-logout:active {background:#151517 !important;color:#FAFAFA !important;}

  body[data-ed-portal="farmer"] .ed-mobile-drawer-backdrop {
    background:rgba(5,5,6,.74) !important;
    z-index:79 !important;
    backdrop-filter:blur(2px) !important;
    -webkit-backdrop-filter:blur(2px) !important;
  }
  body[data-ed-portal="farmer"].ed-mobile-drawer-is-open {
    overflow:hidden !important;
    overscroll-behavior:none !important;
    touch-action:none !important;
  }
  body[data-ed-portal="farmer"].ed-mobile-drawer-is-open .farmer-dashboard-root .copilot-fab,
  body[data-ed-portal="farmer"].ed-mobile-drawer-is-open .farmer-dashboard-root .ent-copilot-mobile {
    pointer-events:none !important;
    visibility:hidden !important;
  }
  body[data-ed-portal="farmer"].ed-mobile-drawer-is-open .farmer-mobile-bottom-nav,
  body[data-ed-portal="farmer"].ed-mobile-drawer-is-open .ed-mobile-workspace-trigger {
    pointer-events:none !important;
  }

  /* The top trigger remains part of the app bar, not the drawer itself. */
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger {
    box-shadow:none !important;
    border-color:rgba(255,255,255,.06) !important;
  }
}

@media (max-width: 768px) and (max-height: 500px) {
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 {
    min-height:58px !important;
    padding-top:calc(6px + env(safe-area-inset-top,0px)) !important;
    padding-bottom:6px !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-search-wrap {padding-top:6px !important;padding-bottom:4px !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-group-label {padding-top:10px !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item {min-height:44px !important;}
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 {
    grid-template-columns:minmax(0,1fr) !important;
    grid-template-rows:auto !important;
    padding-top:6px !important;
    padding-bottom:calc(6px + env(safe-area-inset-bottom,0px)) !important;
  }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-footer-avatar,
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-footer-text {display:none !important;}
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-mobile-logout {grid-column:1 !important;grid-row:1 !important;}
}

@media (prefers-reduced-motion: reduce) {
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar {
    transition:none !important;
  }
}

@media (min-width: 769px) {
  body.ed-enterprise-shell .ed-sidebar .ed-mobile-drawer-brand-mark,
  body.ed-enterprise-shell .ed-sidebar .ed-drawer-close,
  body.ed-enterprise-shell .ed-sidebar .ed-header-mobile-eyebrow {display:none !important;}
}

/* v14.0.1 — drawer geometry/search hardening after runtime measurement. */
@media (max-width: 768px) {
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar[role="dialog"],
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar {
    box-sizing:border-box !important;
    height:100dvh !important;
    min-height:100dvh !important;
    max-height:100dvh !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="farmer"] .ed-drawer-close {flex:0 0 44px !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item.ed-filtered-out,
  body[data-ed-portal="farmer"] .ed-sidebar .ed-group.ed-filtered-out {display:none !important;}
}

/* v14.0.2 — allow independent drawer navigation scrolling while backdrop/body remain locked. */
@media (max-width: 768px) {
  body[data-ed-portal="farmer"].ed-mobile-drawer-is-open {touch-action:auto !important;}
  body[data-ed-portal="farmer"] .ed-sidebar .ed-sidebar-nav-v14 {touch-action:pan-y !important;}
}

/* ═══════════════════════════════════════════════════════════════════════
   v15 — FIELD AGENT PREMIUM MOBILE OPERATIONS SYSTEM
   Action-first, registration-first, field-operations-first. This block is
   mobile-only and intentionally leaves the desktop Agent rail untouched.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body[data-ed-portal="agent"] {
    --agent-mobile-bg:#0A0A0B;
    --agent-mobile-panel:#101012;
    --agent-mobile-panel-2:#0E0E10;
    --agent-mobile-line:rgba(255,255,255,.07);
    --agent-mobile-line-strong:rgba(255,255,255,.11);
    --agent-mobile-muted:#A0A0A6;
    --agent-mobile-tertiary:#6B6B70;
    --agent-mobile-accent:#F5A623;
    --agent-mobile-good:#10B981;
    background:var(--agent-mobile-bg) !important;
    overflow-x:hidden !important;
  }

  body[data-ed-portal="agent"] .agent-dashboard-root {
    background:var(--agent-mobile-bg) !important;
    color:#FAFAFA !important;
    padding-top:calc(56px + env(safe-area-inset-top,0px)) !important;
    padding-bottom:calc(74px + env(safe-area-inset-bottom,0px)) !important;
  }

  body[data-ed-portal="agent"] .agent-dashboard-root > header.topbar {
    height:calc(56px + env(safe-area-inset-top,0px)) !important;
    background:rgba(10,10,11,.96) !important;
    border-bottom:1px solid var(--agent-mobile-line) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-dashboard-root > header.topbar > div {
    padding:env(safe-area-inset-top,0px) 10px 0 194px !important;
  }
  body[data-ed-portal="agent"] .agent-dashboard-root > header.topbar button {
    width:40px !important;
    min-width:40px !important;
    height:40px !important;
    min-height:40px !important;
    border-radius:10px !important;
    box-shadow:none !important;
  }

  body[data-ed-portal="agent"] .ed-mobile-workspace-trigger {
    top:calc(7px + env(safe-area-inset-top,0px)) !important;
    left:12px !important;
    min-height:42px !important;
    max-width:178px !important;
    color:#FAFAFA !important;
  }

  body[data-ed-portal="agent"] #agent-main-content,
  body[data-ed-portal="agent"] #agent-main-content.ed-mobile-main-v8 {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin:0 !important;
    padding:12px 14px calc(88px + env(safe-area-inset-bottom,0px)) !important;
    overflow-x:hidden !important;
    touch-action:pan-y !important;
  }
  body[data-ed-portal="agent"] #agent-main-content > *,
  body[data-ed-portal="agent"] #agent-main-content .agent-tab-root,
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header,
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-main,
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-copy,
  body[data-ed-portal="agent"] #agent-main-content .section-title,
  body[data-ed-portal="agent"] #agent-main-content h1,
  body[data-ed-portal="agent"] #agent-main-content h2,
  body[data-ed-portal="agent"] #agent-main-content h3,
  body[data-ed-portal="agent"] #agent-main-content h4,
  body[data-ed-portal="agent"] #agent-main-content h5,
  body[data-ed-portal="agent"] #agent-main-content p,
  body[data-ed-portal="agent"] #agent-main-content span,
  body[data-ed-portal="agent"] #agent-main-content label {
    min-width:0 !important;
    max-width:100% !important;
    writing-mode:horizontal-tb !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-main {
    width:100% !important;
    display:flex !important;
    align-items:flex-start !important;
    gap:9px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-copy {
    flex:1 1 auto !important;
    width:auto !important;
  }

  /* Global KPI block belongs only to the Farmers command-center tab on mobile. */
  body[data-ed-portal="agent"] #agent-main-content:not([data-mobile-tab="farmers"]) .agent-kpi-grid {
    display:none !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-kpi-grid {
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:7px !important;
    margin:0 0 10px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-kpi-grid > * {
    min-height:70px !important;
    padding:8px 9px !important;
    border:1px solid var(--agent-mobile-line) !important;
    border-radius:12px !important;
    background:var(--agent-mobile-panel) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-kpi-grid > *:last-child {
    display:none !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-metric .ui-metric-label {
    color:var(--agent-mobile-tertiary) !important;
    font-size:8.5px !important;
    line-height:1.15 !important;
    letter-spacing:.09em !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-metric .ui-metric-value {
    color:#FAFAFA !important;
    font-size:17px !important;
    line-height:1.05 !important;
    font-variant-numeric:tabular-nums !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-metric .ui-metric-icon {
    width:26px !important;
    height:26px !important;
    min-width:26px !important;
    border-radius:8px !important;
  }

  /* Today / quick-action command area uses only existing workflows. */
  body[data-ed-portal="agent"] .agent-mobile-command {
    margin:0 0 10px !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-command-heading {
    display:flex !important;
    align-items:flex-end !important;
    justify-content:space-between !important;
    gap:10px !important;
    margin-bottom:7px !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-command-heading .section-eyebrow {
    margin:0 0 2px !important;
    color:var(--agent-mobile-tertiary) !important;
    font-size:8px !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-command-heading h2 {
    margin:0 !important;
    color:#FAFAFA !important;
    font-size:14px !important;
    line-height:1.15 !important;
    font-weight:650 !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-command-heading > span {
    color:var(--agent-mobile-muted) !important;
    font-size:9.5px !important;
    line-height:1.2 !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-command-grid {
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:7px !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-command-grid > button {
    appearance:none !important;
    min-width:0 !important;
    min-height:70px !important;
    padding:9px !important;
    border:1px solid var(--agent-mobile-line) !important;
    border-radius:12px !important;
    background:var(--agent-mobile-panel) !important;
    color:#FAFAFA !important;
    box-shadow:none !important;
    display:grid !important;
    grid-template-columns:30px minmax(0,1fr) !important;
    grid-template-rows:auto auto !important;
    column-gap:8px !important;
    row-gap:2px !important;
    text-align:left !important;
    align-items:center !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-command-grid > button:active {
    background:#151516 !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-command-grid > button > span {
    grid-row:1 / 3 !important;
    width:30px !important;
    height:30px !important;
    border-radius:9px !important;
    display:grid !important;
    place-items:center !important;
    color:var(--agent-mobile-accent) !important;
    background:rgba(245,166,35,.10) !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-command-grid svg { width:16px !important; height:16px !important; }
  body[data-ed-portal="agent"] .agent-mobile-command-grid strong {
    align-self:end !important;
    font-size:11.5px !important;
    line-height:1.15 !important;
    font-weight:650 !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-command-grid small {
    align-self:start !important;
    color:var(--agent-mobile-muted) !important;
    font-size:9px !important;
    line-height:1.15 !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }

  /* Search is useful for list/feed tabs only. */
  body[data-ed-portal="agent"] .agent-tab-search {
    margin-bottom:10px !important;
  }
  body[data-ed-portal="agent"] .agent-tab-search > div { width:100% !important; max-width:none !important; }
  body[data-ed-portal="agent"] .agent-tab-search input {
    width:100% !important;
    min-height:44px !important;
    font-size:16px !important;
    border-radius:11px !important;
    background:var(--agent-mobile-panel) !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="float"] .agent-tab-search,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="inputs"] .agent-tab-search,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-tab-search,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="register"] .agent-tab-search {
    display:none !important;
  }

  /* Shared tab surfaces: hairlines, no decorative shadows, compact rhythm. */
  body[data-ed-portal="agent"] #agent-main-content .card,
  body[data-ed-portal="agent"] #agent-main-content .surface-card,
  body[data-ed-portal="agent"] #agent-main-content .surface-inset {
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .card,
  body[data-ed-portal="agent"] #agent-main-content .surface-card {
    border-color:var(--agent-mobile-line) !important;
    border-radius:12px !important;
    background:var(--agent-mobile-panel) !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .surface-inset {
    border-color:var(--agent-mobile-line) !important;
    border-radius:10px !important;
    background:var(--agent-mobile-panel-2) !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .section-eyebrow {
    color:var(--agent-mobile-tertiary) !important;
    font-size:8.5px !important;
    letter-spacing:.10em !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .section-title,
  body[data-ed-portal="agent"] #agent-main-content .ui-section-title {
    color:#FAFAFA !important;
    font-size:14px !important;
    line-height:1.2 !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-subtitle {
    color:var(--agent-mobile-muted) !important;
    font-size:10px !important;
    line-height:1.35 !important;
  }

  /* Farmer directory is the command list: concise identity, status, facts, actions. */
  body[data-ed-portal="agent"] .agent-directory-card {
    border-radius:12px !important;
    background:var(--agent-mobile-panel) !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] .agent-directory-header {
    min-height:50px !important;
    padding:8px 10px !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-directory-header > span {
    color:var(--agent-mobile-muted) !important;
    font-size:10.5px !important;
  }
  body[data-ed-portal="agent"] .agent-directory-header .btn-primary {
    min-height:40px !important;
    padding:0 10px !important;
    border-radius:9px !important;
    background:var(--agent-mobile-accent) !important;
    color:#15110a !important;
    border:0 !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-list { background:transparent !important; }
  body[data-ed-portal="agent"] .agent-farmer-row {
    padding:10px !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-row h3 { font-size:13px !important; color:#FAFAFA !important; }
  body[data-ed-portal="agent"] .agent-farmer-row p { color:var(--agent-mobile-muted) !important; font-size:10px !important; }
  body[data-ed-portal="agent"] .agent-farmer-stats {
    margin-top:8px !important;
    border-top:1px solid var(--agent-mobile-line) !important;
    border-bottom:1px solid var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats > div {
    min-height:42px !important;
    padding:6px 5px !important;
    background:transparent !important;
    border:0 !important;
    border-radius:0 !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-stats > div + div { border-left:1px solid var(--agent-mobile-line) !important; }
  body[data-ed-portal="agent"] .agent-farmer-stats span { color:var(--agent-mobile-tertiary) !important; }
  body[data-ed-portal="agent"] .agent-farmer-stats strong { color:#FAFAFA !important; font-size:10.5px !important; }
  body[data-ed-portal="agent"] .agent-farmer-actions { margin-top:8px !important; gap:7px !important; }
  body[data-ed-portal="agent"] .agent-farmer-actions button {
    min-height:44px !important;
    border-radius:9px !important;
    box-shadow:none !important;
  }

  /* Tables become operational records. Primary identity is first, status/action remains visible. */
  body[data-ed-portal="agent"] table.mobile-record-table tbody { gap:7px !important; }
  body[data-ed-portal="agent"] table.mobile-record-table tr {
    padding:9px 10px !important;
    border:1px solid var(--agent-mobile-line) !important;
    border-radius:11px !important;
    background:var(--agent-mobile-panel) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] table.mobile-record-table td {
    padding:5px 0 !important;
    border-bottom:1px solid var(--agent-mobile-line) !important;
    color:#E7E7EA !important;
    font-size:10.5px !important;
    line-height:1.25 !important;
  }
  body[data-ed-portal="agent"] table.mobile-record-table td::before {
    color:var(--agent-mobile-tertiary) !important;
    font-size:7.5px !important;
    letter-spacing:.09em !important;
  }
  body[data-ed-portal="agent"] table.mobile-record-table td:last-child { border-bottom:0 !important; }
  body[data-ed-portal="agent"] table.mobile-record-table button { min-height:44px !important; }

  /* Harvest Alerts: action is unmistakable and the record reads urgency-first. */
  body[data-ed-portal="agent"] .agent-tab-harvest-alerts > div:first-child,
  body[data-ed-portal="agent"] .agent-tab-batches > div:first-child {
    padding:10px !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-harvest-alert-records td:last-child {
    padding-top:8px !important;
  }
  body[data-ed-portal="agent"] .agent-harvest-alert-records td:last-child button {
    width:100% !important;
    min-height:44px !important;
    border-radius:9px !important;
  }

  /* Float: money first, then compact history. */
  body[data-ed-portal="agent"] .agent-float-page { gap:10px !important; }
  body[data-ed-portal="agent"] .agent-float-page > .card:first-of-type {
    padding:12px !important;
    border:1px solid var(--agent-mobile-line-strong) !important;
    background:var(--agent-mobile-panel) !important;
  }
  body[data-ed-portal="agent"] .agent-float-page > .card:first-of-type .mt-4.grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:0 !important;
    margin-top:10px !important;
    border:1px solid var(--agent-mobile-line) !important;
    border-radius:10px !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] .agent-float-page > .card:first-of-type .mt-4.grid > div {
    min-height:60px !important;
    padding:8px !important;
    border-right:1px solid var(--agent-mobile-line) !important;
    border-bottom:1px solid var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-float-page > .card:first-of-type .mt-4.grid > div:nth-child(2n) { border-right:0 !important; }
  body[data-ed-portal="agent"] .agent-float-page > .card:first-of-type .mt-4.grid > div:nth-last-child(-n+2) { border-bottom:0 !important; }
  body[data-ed-portal="agent"] .agent-float-page [class*="text-lg"] { font-size:15px !important; font-variant-numeric:tabular-nums !important; }

  /* Input distribution: section header/action stack safely, forms stay one column. */
  body[data-ed-portal="agent"] .agent-inputs-page > .card > div:first-child {
    padding:10px !important;
    gap:8px !important;
    align-items:flex-start !important;
  }
  body[data-ed-portal="agent"] .agent-inputs-page > .card > div:first-child .ui-section-header { flex:1 1 auto !important; min-width:0 !important; }
  body[data-ed-portal="agent"] .agent-inputs-page > .card > div:first-child > button {
    flex:0 0 auto !important;
    min-height:40px !important;
    padding:0 9px !important;
    white-space:nowrap !important;
  }

  /* Advisory: feed rows, not a wall of article cards. */
  body[data-ed-portal="agent"] .agent-tab-advisory { padding:10px !important; }
  body[data-ed-portal="agent"] .agent-tab-advisory .grid {
    display:block !important;
  }
  body[data-ed-portal="agent"] .agent-tab-advisory .grid > .surface-inset {
    padding:10px 0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
  }
  body[data-ed-portal="agent"] .agent-tab-advisory .grid > .surface-inset + .surface-inset {
    border-top:1px solid var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-tab-advisory .surface-inset h3 { font-size:12.5px !important; }
  body[data-ed-portal="agent"] .agent-tab-advisory .surface-inset > p { font-size:10.5px !important; line-height:1.4 !important; }

  /* AI tools: one task at a time; fields/results use the whole content lane. */
  body[data-ed-portal="agent"] .agent-ai-page { gap:10px !important; }
  body[data-ed-portal="agent"] .agent-ai-page > .card { padding:11px !important; }
  body[data-ed-portal="agent"] .agent-ai-page [class*="grid-cols-2"],
  body[data-ed-portal="agent"] .agent-ai-page [class*="grid-cols-3"],
  body[data-ed-portal="agent"] .agent-ai-page [class*="grid-cols-4"] {
    grid-template-columns:minmax(0,1fr) !important;
    gap:9px !important;
  }
  body[data-ed-portal="agent"] .agent-ai-page textarea { min-height:96px !important; }

  /* Forms: iOS-safe font size, one-column geometry, predictable touch targets. */
  body[data-ed-portal="agent"] #agent-main-content input,
  body[data-ed-portal="agent"] #agent-main-content select,
  body[data-ed-portal="agent"] #agent-main-content textarea,
  body[data-ed-portal="agent"] .agent-register-modal input,
  body[data-ed-portal="agent"] .agent-register-modal select,
  body[data-ed-portal="agent"] .agent-register-modal textarea {
    min-width:0 !important;
    max-width:100% !important;
    min-height:44px !important;
    font-size:16px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content textarea,
  body[data-ed-portal="agent"] .agent-register-modal textarea { min-height:82px !important; }
  body[data-ed-portal="agent"] #agent-main-content form [class*="grid-cols-2"],
  body[data-ed-portal="agent"] .agent-register-modal form [class*="grid-cols-2"] {
    grid-template-columns:minmax(0,1fr) !important;
  }

  /* Guided registration is a true full-height mobile onboarding workspace. */
  body[data-ed-portal="agent"] .agent-register-modal {
    align-items:stretch !important;
    padding:0 !important;
  }
  body[data-ed-portal="agent"] .agent-register-panel {
    width:100% !important;
    max-width:none !important;
    height:100dvh !important;
    max-height:100dvh !important;
    min-height:100dvh !important;
    border:0 !important;
    border-radius:0 !important;
    background:var(--agent-mobile-bg) !important;
    overflow:hidden !important;
    box-shadow:none !important;
    display:flex !important;
    flex-direction:column !important;
  }
  body[data-ed-portal="agent"] .agent-register-panel > div:first-of-type {
    flex:0 0 auto !important;
    min-height:56px !important;
    padding:calc(8px + env(safe-area-inset-top,0px)) 14px 8px !important;
    background:rgba(10,10,11,.97) !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-register-panel > div:nth-of-type(2) {
    flex:1 1 auto !important;
    min-height:0 !important;
    padding:0 14px !important;
    overflow-y:auto !important;
    overscroll-behavior:contain !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard { min-height:100% !important; }
  body[data-ed-portal="agent"] .agent-register-wizard > div:first-child {
    top:0 !important;
    margin:0 -14px !important;
    padding:10px 14px !important;
    background:rgba(10,10,11,.98) !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > div:first-child h4 { font-size:15px !important; color:#FAFAFA !important; }
  body[data-ed-portal="agent"] .agent-register-wizard > div:first-child p { white-space:normal !important; overflow:visible !important; text-overflow:clip !important; }
  body[data-ed-portal="agent"] .agent-register-wizard > div:nth-child(2) { padding:12px 0 18px !important; }
  body[data-ed-portal="agent"] .agent-register-wizard > div:last-child {
    margin:0 -14px !important;
    padding:9px 14px calc(9px + env(safe-area-inset-bottom,0px)) !important;
    background:rgba(10,10,11,.98) !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > div:last-child button {
    min-height:46px !important;
    border-radius:10px !important;
  }
  body[data-ed-portal="agent"] .agent-register-close { min-height:44px !important; }

  /* Dedicated registration map owns the viewport and all controls remain reachable. */
  body[data-ed-portal="agent"] .agent-registration-map-workspace {
    width:100vw !important;
    height:100dvh !important;
    max-width:100vw !important;
    max-height:100dvh !important;
    background:var(--agent-mobile-bg) !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] .agent-registration-map-workspace header {
    min-height:56px !important;
    background:rgba(10,10,11,.97) !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-registration-map-workspace > div:nth-of-type(1) {
    padding:8px 12px !important;
    background:var(--agent-mobile-panel-2) !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-registration-map-workspace > div:nth-of-type(2) { padding:6px !important; }
  body[data-ed-portal="agent"] .agent-registration-map-workspace > div:nth-of-type(2) > div {
    min-height:0 !important;
    height:100% !important;
    border-radius:10px !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-registration-map-workspace .leaflet-container,
  body[data-ed-portal="agent"] .agent-registration-map-workspace [class*="leaflet"] {
    max-width:none;
  }
  body[data-ed-portal="agent"] .agent-registration-map-workspace img.leaflet-tile,
  body[data-ed-portal="agent"] .agent-registration-map-workspace img.leaflet-marker-icon,
  body[data-ed-portal="agent"] .agent-registration-map-workspace img.leaflet-marker-shadow {
    max-width:none !important;
  }
  body[data-ed-portal="agent"] .agent-registration-map-workspace footer {
    background:rgba(10,10,11,.98) !important;
    border-color:var(--agent-mobile-line) !important;
  }

  /* Bottom navigation is a regular five-tab control; Register is prominent by
     active color, not by a floating FAB that can collide with content. */
  body[data-ed-portal="agent"] .agent-mobile-bottom-nav {
    min-height:72px !important;
    padding:5px 6px calc(5px + env(safe-area-inset-bottom,0px)) !important;
    gap:0 !important;
    background:rgba(12,12,14,.98) !important;
    border-top:1px solid var(--agent-mobile-line) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-bottom-tab,
  body[data-ed-portal="agent"] .agent-mobile-bottom-primary {
    margin:0 !important;
    width:100% !important;
    max-width:none !important;
    min-height:52px !important;
    padding:4px 2px !important;
    border:0 !important;
    border-radius:9px !important;
    background:transparent !important;
    color:#8A8A90 !important;
    box-shadow:none !important;
    font-size:9.5px !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-bottom-tab.is-active,
  body[data-ed-portal="agent"] .agent-mobile-bottom-primary.is-active {
    color:var(--agent-mobile-accent) !important;
    background:rgba(245,166,35,.07) !important;
  }
  body[data-ed-portal="agent"] .agent-mobile-bottom-icon { width:23px !important; height:23px !important; }

  /* Premium Agent drawer: quiet hierarchy, independent scroll, persistent identity/logout. */
  body[data-ed-portal="agent"].ed-mobile-portal-active .ed-sidebar {
    width:min(82vw,312px) !important;
    max-width:312px !important;
    background:#0C0C0E !important;
    border-right:1px solid var(--agent-mobile-line) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-header-v14 {
    min-height:62px !important;
    padding:10px 12px !important;
    border-color:var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar .ed-collapse-btn { display:none !important; }
  body[data-ed-portal="agent"] .ed-sidebar .ed-mobile-drawer-brand-mark {
    width:32px !important;
    height:32px !important;
    border-radius:50% !important;
    background:rgba(245,166,35,.10) !important;
    color:var(--agent-mobile-accent) !important;
    border:1px solid rgba(245,166,35,.35) !important;
    display:grid !important;
    place-items:center !important;
    font-weight:700 !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar .ed-header-mobile-eyebrow {
    color:var(--agent-mobile-tertiary) !important;
    font-size:8.5px !important;
    letter-spacing:.12em !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar .ed-header-title { color:#FAFAFA !important; font-size:13.5px !important; }
  body[data-ed-portal="agent"] .ed-sidebar .ed-header-desktop-subtitle { display:none !important; }
  body[data-ed-portal="agent"] .ed-sidebar .ed-drawer-close {
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    border-radius:10px !important;
    color:var(--agent-mobile-muted) !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar .ed-search-wrap { padding:7px 12px !important; }
  body[data-ed-portal="agent"] .ed-sidebar .ed-search-input {
    min-height:42px !important;
    padding:8px 10px !important;
    border:1px solid var(--agent-mobile-line) !important;
    border-radius:9px !important;
    background:#111113 !important;
    color:#FAFAFA !important;
    font-size:16px !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-nav-v14 { padding:3px 8px 8px !important; }
  body[data-ed-portal="agent"] .ed-sidebar .ed-group-label {
    padding:12px 8px 4px !important;
    color:var(--agent-mobile-tertiary) !important;
    font-size:8.5px !important;
    letter-spacing:.13em !important;
    cursor:default !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar .ed-group-label svg { display:none !important; }
  body[data-ed-portal="agent"] .ed-sidebar .ed-nav-item {
    min-height:46px !important;
    margin:1px 0 !important;
    padding:8px 10px !important;
    gap:10px !important;
    border-radius:9px !important;
    font-size:12.5px !important;
    line-height:1 !important;
    box-shadow:none !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar .ed-nav-text {
    min-width:0 !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-footer-v8 {
    padding:9px 10px calc(9px + env(safe-area-inset-bottom,0px)) !important;
    border-color:var(--agent-mobile-line) !important;
    background:#0C0C0E !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-footer-v8 .ed-mobile-logout {
    min-height:44px !important;
    border-radius:9px !important;
  }
  body[data-ed-portal="agent"] .ed-mobile-drawer-backdrop { background:rgba(0,0,0,.72) !important; }

  /* Assistant never competes with modal/drawer/map interactions. */
  body[data-ed-portal="agent"].ed-mobile-drawer-is-open .copilot-fab,
  body[data-ed-portal="agent"]:has(.agent-register-modal) .copilot-fab,
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .copilot-fab {
    opacity:0 !important;
    pointer-events:none !important;
  }
  body[data-ed-portal="agent"] .agent-dashboard-root .copilot-fab {
    right:12px !important;
    bottom:calc(78px + env(safe-area-inset-bottom,0px)) !important;
    width:42px !important;
    height:42px !important;
    min-width:42px !important;
    min-height:42px !important;
    border-radius:11px !important;
    box-shadow:none !important;
  }

  /* Empty/loading states stay content-sized. */
  body[data-ed-portal="agent"] #agent-main-content [class*="p-8"]:has(.ui-empty-state),
  body[data-ed-portal="agent"] #agent-main-content [class*="p-8"]:has([class*="empty"]) {
    padding:16px 10px !important;
  }
}

@media (max-width: 360px) {
  body[data-ed-portal="agent"] #agent-main-content { padding-left:10px !important; padding-right:10px !important; }
  body[data-ed-portal="agent"] .agent-mobile-command-grid { grid-template-columns:minmax(0,1fr) !important; }
  body[data-ed-portal="agent"] .agent-mobile-command-grid > button { min-height:58px !important; }
  body[data-ed-portal="agent"] .agent-register-wizard > div:last-child .flex { gap:6px !important; }
  body[data-ed-portal="agent"] .agent-register-wizard > div:last-child button { padding-left:8px !important; padding-right:8px !important; font-size:11px !important; }
}

@media (max-width: 900px) and (max-height: 500px) {
  body[data-ed-portal="agent"] .agent-register-panel { height:100dvh !important; max-height:100dvh !important; }
  body[data-ed-portal="agent"] .agent-registration-map-workspace { height:100dvh !important; }
  body[data-ed-portal="agent"] .agent-registration-map-workspace > div:nth-of-type(1) { display:none !important; }
  body[data-ed-portal="agent"] .agent-mobile-bottom-nav { min-height:62px !important; padding-top:3px !important; padding-bottom:3px !important; }
  body[data-ed-portal="agent"] .agent-mobile-bottom-tab { min-height:46px !important; }
}

@media (prefers-reduced-motion: reduce) {
  body[data-ed-portal="agent"] .ed-sidebar,
  body[data-ed-portal="agent"] .ed-mobile-drawer-backdrop,
  body[data-ed-portal="agent"] * {
    scroll-behavior:auto !important;
  }
}

@media (max-width: 768px) {
  body[data-ed-portal="agent"] .agent-farmer-row-tools { align-items:center !important; }
  body[data-ed-portal="agent"] .agent-farmer-detail-trigger {
    appearance:none !important;
    min-height:44px !important;
    padding:0 8px !important;
    border:1px solid var(--agent-mobile-line) !important;
    border-radius:9px !important;
    background:transparent !important;
    color:var(--agent-mobile-muted) !important;
    font-size:9.5px !important;
    font-weight:650 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-detail-grid {
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    border:1px solid var(--agent-mobile-line) !important;
    border-radius:10px !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-detail-grid > div {
    min-height:58px !important;
    padding:8px !important;
    border-right:1px solid var(--agent-mobile-line) !important;
    border-bottom:1px solid var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-detail-grid > div:nth-child(2n) { border-right:0 !important; }
  body[data-ed-portal="agent"] .agent-farmer-detail-grid > div:nth-last-child(-n+2) { border-bottom:0 !important; }
  body[data-ed-portal="agent"] .agent-farmer-detail-grid span,
  body[data-ed-portal="agent"] .agent-farmer-detail-list span {
    display:block !important;
    color:var(--agent-mobile-tertiary) !important;
    font-size:8px !important;
    line-height:1.15 !important;
    letter-spacing:.08em !important;
    text-transform:uppercase !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-detail-grid strong {
    display:block !important;
    margin-top:3px !important;
    color:#FAFAFA !important;
    font-size:12px !important;
    line-height:1.2 !important;
    font-variant-numeric:tabular-nums !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-detail-list,
  body[data-ed-portal="agent"] .agent-farmer-detail-recent {
    border-top:1px solid var(--agent-mobile-line) !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-detail-list > div,
  body[data-ed-portal="agent"] .agent-farmer-detail-recent > div {
    min-height:44px !important;
    padding:8px 0 !important;
    border-bottom:1px solid var(--agent-mobile-line) !important;
    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:10px !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-detail-list strong,
  body[data-ed-portal="agent"] .agent-farmer-detail-recent strong {
    min-width:0 !important;
    color:#FAFAFA !important;
    font-size:10.5px !important;
    line-height:1.25 !important;
    text-align:right !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
  }
  body[data-ed-portal="agent"] .agent-farmer-detail-actions button { min-height:46px !important; }
}

/* ==========================================================================\n   AGENT MOBILE RUNTIME CLOSURE v11 — authenticated screenshot regression fix\n   Source of truth: real /field-agent runtime at 521x872. This block is the\n   final Agent mobile geometry contract and intentionally overrides earlier\n   exploratory Agent rules without changing business logic.\n   ========================================================================== */
@media (max-width: 768px) {
  /* 1) One authoritative horizontal text / flexible-width contract. */
  body[data-ed-portal="agent"] #agent-main-content,
  body[data-ed-portal="agent"] #agent-main-content .agent-tab-root,
  body[data-ed-portal="agent"] #agent-main-content .card,
  body[data-ed-portal="agent"] #agent-main-content .surface-card,
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header,
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-main,
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-copy,
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-copy > * {
    min-width:0 !important;
    max-width:100% !important;
    writing-mode:horizontal-tb !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header {
    display:flex !important;
    width:100% !important;
    align-items:flex-start !important;
    justify-content:space-between !important;
    gap:9px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-main {
    display:flex !important;
    flex:1 1 auto !important;
    width:auto !important;
    align-items:flex-start !important;
    gap:9px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-copy {
    display:block !important;
    flex:1 1 0% !important;
    width:100% !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-copy .section-title,
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-copy .section-eyebrow,
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-copy p {
    display:block !important;
    width:100% !important;
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
  }

  /* 2) Home KPI command-center: four shallow metrics, no nested-box geometry. */
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-kpi-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:7px !important;
    margin:0 0 10px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-kpi-grid > .ui-metric-tile {
    display:block !important;
    min-height:78px !important;
    height:auto !important;
    padding:9px 10px !important;
    border:1px solid var(--agent-mobile-line) !important;
    border-radius:12px !important;
    background:var(--agent-mobile-panel) !important;
    box-shadow:none !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-kpi-grid > .ui-metric-tile:last-child {
    display:none !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-mobile-metric .ui-metric-body {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) 26px !important;
    grid-template-rows:auto auto !important;
    align-items:center !important;
    gap:4px 7px !important;
    width:100% !important;
    min-height:58px !important;
    padding:0 !important;
    margin:0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-mobile-metric .ui-metric-copy {
    display:contents !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-mobile-metric .ui-metric-label {
    grid-column:1 !important;
    grid-row:1 !important;
    margin:0 !important;
    font-size:8.5px !important;
    line-height:1.15 !important;
    white-space:normal !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-mobile-metric .ui-metric-value {
    grid-column:1 !important;
    grid-row:2 !important;
    margin:0 !important;
    font-size:17px !important;
    line-height:1 !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-mobile-metric .ui-metric-icon {
    grid-column:2 !important;
    grid-row:1 / 3 !important;
    align-self:center !important;
    margin:0 !important;
    width:26px !important;
    height:26px !important;
    min-width:26px !important;
    padding:0 !important;
    border:1px solid var(--agent-mobile-line) !important;
    border-radius:8px !important;
    background:var(--agent-mobile-panel-2) !important;
    box-shadow:none !important;
  }

  /* 3) Farmers: exactly one mobile representation. Desktop record table stays hidden. */
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmer-list {
    display:block !important;
    width:100% !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmers-desktop-records,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmers-desktop-records *,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .overflow-x-auto:has(> .agent-farmers-desktop-records) {
    display:none !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmer-actions {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:7px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-farmer-actions button {
    width:100% !important;
    min-width:0 !important;
    white-space:nowrap !important;
  }
  /* Pagination is now source-gated when total <= page size. Keep any remaining pager compact. */
  body[data-ed-portal="agent"] #agent-main-content .ui-pagination,
  body[data-ed-portal="agent"] #agent-main-content [class*="pagination"] {
    max-width:100% !important;
  }

  /* 4) Harvest Alerts: full-lane heading and compact action-first empty/record state. */
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-tab-harvest-alerts {
    width:100% !important;
    min-width:0 !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-tab-harvest-alerts > div:first-child {
    display:block !important;
    width:100% !important;
    padding:10px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-tab-harvest-alerts .ui-section-header,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-tab-harvest-alerts .ui-section-header-main,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-tab-harvest-alerts .ui-section-header-copy {
    width:100% !important;
    max-width:none !important;
    flex:1 1 100% !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-tab-harvest-alerts > .p-8 {
    padding:16px 10px !important;
    min-height:0 !important;
  }

  /* 5) AI Tools / More: no intrinsic-width columns; every task owns the lane. */
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-tab-ai-tools,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-ai-page,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-ai-page > .card {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-ai-page > .card {
    padding:11px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-ai-page .ui-section-header-main,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-ai-page .ui-section-header-copy {
    width:100% !important;
    flex:1 1 100% !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-ai-page [class*="grid-cols-"] {
    grid-template-columns:minmax(0,1fr) !important;
  }

  /* 6) Registration owns the viewport. Global nav/copilot are not part of the flow. */
  body[data-ed-portal="agent"]:has(.agent-register-modal) .agent-mobile-bottom-nav,
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .agent-mobile-bottom-nav,
  body[data-ed-portal="agent"]:has(.agent-register-modal) .ed-mobile-workspace-trigger,
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .ed-mobile-workspace-trigger,
  body[data-ed-portal="agent"]:has(.agent-register-modal) .copilot-fab,
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .copilot-fab {
    display:none !important;
  }
  body[data-ed-portal="agent"] .agent-register-modal {
    width:100vw !important;
    height:100dvh !important;
    inset:0 !important;
    padding:0 !important;
    align-items:stretch !important;
  }
  body[data-ed-portal="agent"] .agent-register-panel {
    width:100vw !important;
    height:100dvh !important;
    max-width:none !important;
    max-height:100dvh !important;
    border:0 !important;
    border-radius:0 !important;
  }
  body[data-ed-portal="agent"] .agent-register-panel > div:first-of-type {
    min-height:56px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:10px !important;
  }
  body[data-ed-portal="agent"] .agent-register-close {
    display:inline-flex !important;
    flex:0 0 auto !important;
    width:auto !important;
    max-width:max-content !important;
    min-width:76px !important;
    height:44px !important;
    min-height:44px !important;
    padding:0 12px !important;
    margin:0 !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard [aria-label="Registration progress"] {
    display:grid !important;
    grid-template-columns:repeat(5,minmax(0,1fr)) !important;
    gap:5px !important;
    width:100% !important;
  }
  body[data-ed-portal="agent"] .agent-register-progress-step {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    height:6px !important;
    min-height:6px !important;
    max-height:6px !important;
    padding:0 !important;
    margin:0 !important;
    border:0 !important;
    border-radius:999px !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > div:nth-child(2) {
    width:100% !important;
    min-width:0 !important;
    padding:12px 0 18px !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > div:nth-child(2) > section,
  body[data-ed-portal="agent"] .agent-register-wizard > div:nth-child(2) > section > * {
    width:100% !important;
    min-width:0 !important;
  }

  /* 7) Empty states must size to content, not reserve a desktop panel height. */
  body[data-ed-portal="agent"] #agent-main-content .ui-empty-state {
    min-height:0 !important;
    padding:14px 10px !important;
  }

  /* 8) Keep the mobile document lane strict and prevent accidental horizontal drift. */
  body[data-ed-portal="agent"],
  body[data-ed-portal="agent"] .agent-dashboard-root,
  body[data-ed-portal="agent"] #agent-main-content {
    max-width:100vw !important;
    overflow-x:hidden !important;
  }
}

@media (max-width: 768px) {
  /* v11 KPI descendant reset: the legacy global selector [class*="metric"]
     matches ui-metric-label/value/body/copy/icon as well as the tile. Reset all
     descendants, then reapply only the icon geometry. */
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-mobile-metric :where(.ui-metric-body,.ui-metric-copy,.ui-metric-label,.ui-metric-value,.ui-metric-hint,.ui-metric-icon) {
    min-height:0 !important;
    height:auto !important;
    padding:0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="farmers"] .agent-mobile-metric .ui-metric-icon {
    width:26px !important;
    height:26px !important;
    min-width:26px !important;
    min-height:26px !important;
    border:1px solid var(--agent-mobile-line) !important;
    border-radius:8px !important;
    background:var(--agent-mobile-panel-2) !important;
    display:grid !important;
    place-items:center !important;
  }
}

/* ==========================================================================\n   AGENT MOBILE RUNTIME CLOSURE v12 — live-authenticated final repair\n   Source of truth: user-captured /field-agent runtime at 521x872.\n   Goals: eliminate SectionHeader icon expansion/text rails, keep registration\n   footer permanently reachable, and make the mobile drawer flush to viewport.\n   ========================================================================== */
@media (max-width: 768px) {
  /* A. SectionHeader hard geometry. The icon must never consume the text lane. */
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header {
    display:flex !important;
    flex-direction:row !important;
    align-items:flex-start !important;
    justify-content:space-between !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    gap:9px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-main {
    display:flex !important;
    flex-direction:row !important;
    align-items:flex-start !important;
    flex:1 1 0% !important;
    width:auto !important;
    min-width:0 !important;
    max-width:100% !important;
    gap:9px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-main > .ui-section-header-icon {
    display:grid !important;
    place-items:center !important;
    flex:0 0 32px !important;
    width:32px !important;
    min-width:32px !important;
    max-width:32px !important;
    height:32px !important;
    min-height:32px !important;
    max-height:32px !important;
    padding:0 !important;
    margin:0 !important;
    border-radius:9px !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-main > .ui-section-header-copy {
    display:block !important;
    flex:1 1 0% !important;
    width:auto !important;
    min-width:0 !important;
    max-width:100% !important;
    writing-mode:horizontal-tb !important;
  }
  body[data-ed-portal="agent"] #agent-main-content .ui-section-header-copy > :where(.section-eyebrow,.section-title,p) {
    display:block !important;
    width:auto !important;
    min-width:0 !important;
    max-width:100% !important;
    white-space:normal !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
    writing-mode:horizontal-tb !important;
    overflow:visible !important;
    text-overflow:clip !important;
  }

  /* B. Harvest Alerts + AI Tools must occupy the complete mobile lane. */
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-tab-harvest-alerts,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-tab-harvest-alerts > div,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-tab-ai-tools,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-ai-page,
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-ai-page > .surface-card {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="harvest-alerts"] .agent-tab-harvest-alerts > div:first-child {
    display:block !important;
  }
  body[data-ed-portal="agent"] #agent-main-content[data-mobile-tab="ai-tools"] .agent-ai-page > .surface-card {
    display:block !important;
  }

  /* C. Guided registration is a four-region shell: app header, step header,\n     independently scrollable form body, and always-visible footer. */
  body[data-ed-portal="agent"] .agent-register-modal {
    position:fixed !important;
    inset:0 !important;
    width:100vw !important;
    height:100dvh !important;
    min-height:100dvh !important;
    max-height:100dvh !important;
    padding:0 !important;
    margin:0 !important;
    overflow:hidden !important;
    align-items:stretch !important;
    justify-content:stretch !important;
    background:#0A0A0B !important;
    isolation:isolate !important;
    z-index:200 !important;
  }
  body[data-ed-portal="agent"] .agent-register-modal > div.absolute.inset-0 {
    display:none !important;
  }
  body[data-ed-portal="agent"] .agent-register-panel {
    position:relative !important;
    flex:1 1 auto !important;
    display:flex !important;
    flex-direction:column !important;
    width:100vw !important;
    height:100dvh !important;
    min-height:100dvh !important;
    max-height:100dvh !important;
    max-width:none !important;
    margin:0 !important;
    border:0 !important;
    border-radius:0 !important;
    overflow:hidden !important;
    background:#0A0A0B !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-register-panel > div:first-of-type {
    position:relative !important;
    top:auto !important;
    flex:0 0 auto !important;
    width:100% !important;
    min-height:56px !important;
  }
  body[data-ed-portal="agent"] .agent-register-panel > div:nth-of-type(2) {
    display:flex !important;
    flex-direction:column !important;
    flex:1 1 auto !important;
    width:100% !important;
    min-height:0 !important;
    padding:0 14px !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard {
    display:flex !important;
    flex-direction:column !important;
    flex:1 1 auto !important;
    width:100% !important;
    min-height:0 !important;
    height:100% !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > div:first-child {
    position:relative !important;
    top:auto !important;
    flex:0 0 auto !important;
    width:auto !important;
    margin:0 -14px !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > div:nth-child(2) {
    position:relative !important;
    flex:1 1 auto !important;
    width:100% !important;
    min-height:0 !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    overscroll-behavior:contain !important;
    -webkit-overflow-scrolling:touch !important;
    padding:12px 0 18px !important;
    scroll-padding-bottom:20px !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > div:last-child {
    position:relative !important;
    inset:auto !important;
    flex:0 0 auto !important;
    width:auto !important;
    margin:0 -14px !important;
    padding:9px 14px calc(9px + env(safe-area-inset-bottom,0px)) !important;
    background:#0C0C0E !important;
    border-top:1px solid var(--agent-mobile-line) !important;
    z-index:30 !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > div:last-child > .flex {
    display:flex !important;
    width:100% !important;
    gap:8px !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > div:last-child button {
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    min-height:48px !important;
  }

  /* D. The injected Agent drawer is viewport-attached, edge-to-edge vertically. */
  body[data-ed-portal="agent"].ed-mobile-portal-active .ed-sidebar {
    position:fixed !important;
    inset:0 auto 0 0 !important;
    top:0 !important;
    right:auto !important;
    bottom:0 !important;
    left:0 !important;
    width:min(82vw,312px) !important;
    max-width:312px !important;
    height:auto !important;
    min-height:100dvh !important;
    max-height:none !important;
    padding-top:env(safe-area-inset-top,0px) !important;
    padding-bottom:0 !important;
    margin:0 !important;
    border-radius:0 !important;
    overflow:hidden !important;
    display:flex !important;
    flex-direction:column !important;
    box-sizing:border-box !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-header-v14,
  body[data-ed-portal="agent"] .ed-search-wrap,
  body[data-ed-portal="agent"] .ed-sidebar-footer-v8 {
    flex:0 0 auto !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-nav-v14 {
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-footer-v8 {
    margin-top:auto !important;
    margin-bottom:0 !important;
    padding-bottom:calc(10px + env(safe-area-inset-bottom,0px)) !important;
    border-radius:0 !important;
    background:#0C0C0E !important;
  }

  /* E. App chrome stays out of exclusive registration/map workspaces. */
  body[data-ed-portal="agent"]:has(.agent-register-modal) .agent-mobile-bottom-nav,
  body[data-ed-portal="agent"]:has(.agent-register-modal) .ed-mobile-workspace-trigger,
  body[data-ed-portal="agent"]:has(.agent-register-modal) .copilot-fab,
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .agent-mobile-bottom-nav,
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .ed-mobile-workspace-trigger,
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .copilot-fab {
    display:none !important;
    pointer-events:none !important;
  }
}

@media (max-width: 768px) {
  /* v12.1 semantic registration regions: avoid positional-selector drift. */
  body[data-ed-portal="agent"]:has(.agent-register-modal) { overflow:hidden !important; }
  body[data-ed-portal="agent"] .agent-register-wizard > .agent-register-step-header {
    position:relative !important;
    top:auto !important;
    flex:0 0 auto !important;
    width:auto !important;
    margin:0 -14px !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > .agent-register-step-body {
    position:relative !important;
    flex:1 1 auto !important;
    width:100% !important;
    min-height:0 !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    overscroll-behavior:contain !important;
    -webkit-overflow-scrolling:touch !important;
    padding:12px 0 18px !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard > .agent-register-footer {
    position:relative !important;
    flex:0 0 auto !important;
    width:auto !important;
    margin:0 -14px !important;
    padding:9px 14px calc(9px + env(safe-area-inset-bottom,0px)) !important;
    background:#0C0C0E !important;
    border-top:1px solid var(--agent-mobile-line) !important;
    z-index:30 !important;
  }
}

/* ========================================================================== 
   v11.4 — AGENT REGISTRATION MAP-FIRST ENTERPRISE GEOSPATIAL WORKSPACE
   Scope: Field Agent registration + dedicated registration map only.
   ========================================================================== */
@media (max-width: 768px), (max-width: 900px) and (max-height: 500px) {
  body[data-ed-portal="agent"] .agent-map-first-step {
    min-width: 0 !important;
    width: 100% !important;
  }

  body[data-ed-portal="agent"] .agent-map-first-card {
    width: 100% !important;
    min-width: 0 !important;
    background: #0A0A0B !important;
    padding: 0 !important;
    border-color: rgba(255,255,255,.08) !important;
    border-radius: 14px !important;
  }

  body[data-ed-portal="agent"] .agent-map-commandbar {
    min-height: 52px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    background: #0E0E10;
  }

  body[data-ed-portal="agent"] .agent-map-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 9px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.10);
    background: #101012;
    color: #A0A0A6;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
  }
  body[data-ed-portal="agent"] .agent-map-status.is-progress { color:#F5A623; border-color:rgba(245,166,35,.28); background:rgba(245,166,35,.08); }
  body[data-ed-portal="agent"] .agent-map-status.is-ready { color:#10B981; border-color:rgba(16,185,129,.28); background:rgba(16,185,129,.08); }
  body[data-ed-portal="agent"] .agent-map-status.is-error { color:#EF4444; border-color:rgba(239,68,68,.28); background:rgba(239,68,68,.08); }

  body[data-ed-portal="agent"] .agent-map-button {
    min-height: 44px;
    border-radius: 10px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-shadow: none !important;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease;
  }
  body[data-ed-portal="agent"] .agent-map-button-primary {
    background:#F5A623;
    border:1px solid #F5A623;
    color:#09090A;
  }
  body[data-ed-portal="agent"] .agent-map-button-secondary {
    background:#151517;
    border:1px solid rgba(255,255,255,.12);
    color:#FAFAFA;
  }
  body[data-ed-portal="agent"] .agent-map-button-tertiary {
    background:transparent;
    border:1px solid rgba(255,255,255,.10);
    color:#B8B8BD;
  }

  body[data-ed-portal="agent"] .agent-map-summary-grid {
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:6px;
    width:100%;
  }
  body[data-ed-portal="agent"] .agent-map-summary-grid > div {
    min-width:0;
    min-height:58px;
    padding:8px 9px;
    border:1px solid rgba(255,255,255,.07);
    border-radius:10px;
    background:#101012;
  }
  body[data-ed-portal="agent"] .agent-map-summary-grid span,
  body[data-ed-portal="agent"] .agent-map-footer-stats span {
    display:block;
    color:#6B6B70;
    font-size:8px;
    font-weight:700;
    letter-spacing:.06em;
    text-transform:uppercase;
    white-space:nowrap;
  }
  body[data-ed-portal="agent"] .agent-map-summary-grid strong,
  body[data-ed-portal="agent"] .agent-map-footer-stats strong {
    display:block;
    margin-top:3px;
    color:#FAFAFA;
    font-size:12px;
    font-weight:700;
    font-variant-numeric:tabular-nums;
    white-space:nowrap;
  }

  body[data-ed-portal="agent"] .agent-map-advanced {
    overflow:hidden;
    background:#0E0E10;
    border-color:rgba(255,255,255,.07) !important;
  }
  body[data-ed-portal="agent"] .agent-map-advanced > summary {
    cursor:pointer;
    list-style:none;
    min-height:42px;
    padding:0 12px;
    display:flex;
    align-items:center;
    color:#A0A0A6;
    font-size:11px;
    font-weight:700;
  }
  body[data-ed-portal="agent"] .agent-map-advanced > summary::-webkit-details-marker { display:none; }

  /* One authoritative map geometry contract. */
  body[data-ed-portal="agent"] .agent-map-first-card .polygon-capture-map,
  body[data-ed-portal="agent"] .agent-registration-map-workspace .polygon-capture-map {
    width:100% !important;
    min-width:0 !important;
    overflow:hidden !important;
    background:#0A0A0B !important;
  }
  body[data-ed-portal="agent"] .agent-map-first-card .polygon-capture-map > div:first-child,
  body[data-ed-portal="agent"] .agent-registration-map-workspace .polygon-capture-map > div:first-child,
  body[data-ed-portal="agent"] .agent-map-first-card .leaflet-container,
  body[data-ed-portal="agent"] .agent-registration-map-workspace .leaflet-container {
    width:100% !important;
    height:100% !important;
    min-height:0 !important;
    max-width:none !important;
  }

  /* Leaflet owns tile/marker pixel geometry. Never pass them through responsive-image rules. */
  body[data-ed-portal="agent"] .agent-enterprise-map img.leaflet-tile,
  body[data-ed-portal="agent"] .agent-enterprise-map img.leaflet-marker-icon,
  body[data-ed-portal="agent"] .agent-enterprise-map img.leaflet-marker-shadow,
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-pane img {
    max-width:none !important;
    max-height:none !important;
  }

  /* Quiet enterprise map chrome: hairlines, no floating-card shadows, no toy circles. */
  body[data-ed-portal="agent"] .agent-enterprise-map [class*="shadow-e"] { box-shadow:none !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map button {
    box-shadow:none !important;
    border:1px solid rgba(255,255,255,.11) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map button.rounded-full { border-radius:10px !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .brand-surface-agrarian {
    background:#F5A623 !important;
    color:#09090A !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .animate-pulse { animation:none !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-bar a {
    background:#101012 !important;
    color:#FAFAFA !important;
    border-color:rgba(255,255,255,.09) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-control-attribution {
    background:rgba(10,10,11,.82) !important;
    color:#8A8A90 !important;
    font-size:8px !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-control-scale-line {
    background:rgba(10,10,11,.82) !important;
    color:#FAFAFA !important;
    border-color:rgba(255,255,255,.5) !important;
  }

  body[data-ed-portal="agent"] .agent-registration-map-workspace {
    inset:0 !important;
    width:100vw !important;
    height:100dvh !important;
    max-width:none !important;
    background:#09090A !important;
  }
  body[data-ed-portal="agent"] .agent-registration-map-workspace > div.flex-1 {
    padding:0 !important;
  }
  body[data-ed-portal="agent"] .agent-registration-map-workspace > div.flex-1 > div {
    border-radius:0 !important;
    border-left:0 !important;
    border-right:0 !important;
    border-color:rgba(255,255,255,.08) !important;
  }
  body[data-ed-portal="agent"] .agent-registration-map-workspace footer {
    min-height:72px !important;
    padding:8px 10px max(8px,env(safe-area-inset-bottom)) !important;
    border-color:rgba(255,255,255,.08) !important;
    background:#0C0C0E !important;
  }
  body[data-ed-portal="agent"] .agent-map-footer-stats {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px;
  }

  body[data-ed-portal="agent"] .agent-map-first-step,
  body[data-ed-portal="agent"] .agent-map-first-step * {
    writing-mode:horizontal-tb !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
  }
}

@media (max-width: 390px) {
  body[data-ed-portal="agent"] .agent-map-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body[data-ed-portal="agent"] .agent-map-commandbar { align-items:flex-start; }
  body[data-ed-portal="agent"] .agent-map-button { padding-left:10px; padding-right:10px; }
}

/* ============================================================================
   v10.20 — AGENT REGISTRATION FULL-MAP ENTERPRISE WORKSPACE
   Root-portaled top layer + restrained 0.1% geospatial chrome.
   ========================================================================== */
@media (max-width: 900px) {
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) {
    overflow:hidden !important;
  }

  body[data-ed-portal="agent"] .agent-registration-map-workspace.agent-map-top-layer {
    position:fixed !important;
    inset:0 !important;
    width:100vw !important;
    height:100dvh !important;
    max-width:none !important;
    z-index:10000 !important;
    isolation:isolate !important;
    display:grid !important;
    grid-template-rows:auto minmax(0,1fr) auto !important;
    background:#0A0A0B !important;
    color:#FAFAFA !important;
    overflow:hidden !important;
  }

  body[data-ed-portal="agent"] .agent-map-workspace-topbar {
    min-height:60px !important;
    padding:max(8px,env(safe-area-inset-top)) 12px 8px !important;
    display:flex !important;
    align-items:center !important;
    gap:10px !important;
    border-bottom:1px solid rgba(255,255,255,.07) !important;
    background:rgba(10,10,11,.97) !important;
    backdrop-filter:blur(14px) !important;
    z-index:3 !important;
  }

  body[data-ed-portal="agent"] .agent-map-icon-control {
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    border:1px solid rgba(255,255,255,.09) !important;
    border-radius:10px !important;
    background:#101012 !important;
    color:#FAFAFA !important;
    box-shadow:none !important;
  }

  body[data-ed-portal="agent"] .agent-map-eyebrow {
    margin:0 !important;
    color:#7A7A80 !important;
    font-size:8px !important;
    font-weight:700 !important;
    letter-spacing:.13em !important;
    line-height:1.2 !important;
  }

  body[data-ed-portal="agent"] .agent-map-workspace-title {
    margin:2px 0 0 !important;
    color:#FAFAFA !important;
    font-size:15px !important;
    line-height:1.2 !important;
    font-weight:700 !important;
    white-space:nowrap !important;
  }

  body[data-ed-portal="agent"] .agent-map-workspace-state {
    min-height:28px !important;
    padding:0 9px !important;
    display:inline-flex !important;
    align-items:center !important;
    border:1px solid rgba(255,255,255,.09) !important;
    border-radius:8px !important;
    background:#101012 !important;
    color:#A0A0A6 !important;
    font-size:8px !important;
    font-weight:750 !important;
    letter-spacing:.08em !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="agent"] .agent-map-workspace-state.is-ready { color:#10B981 !important; border-color:rgba(16,185,129,.26) !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-state.is-error { color:#EF4444 !important; border-color:rgba(239,68,68,.26) !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-state.is-progress { color:#F5A623 !important; border-color:rgba(245,166,35,.24) !important; }

  body[data-ed-portal="agent"] .agent-map-workspace-canvas {
    position:relative !important;
    min-width:0 !important;
    min-height:0 !important;
    overflow:hidden !important;
    background:#0A0A0B !important;
  }
  body[data-ed-portal="agent"] .agent-map-workspace-canvas > .polygon-capture-map,
  body[data-ed-portal="agent"] .agent-map-workspace-canvas .leaflet-container {
    position:absolute !important;
    inset:0 !important;
    width:100% !important;
    height:100% !important;
    min-height:0 !important;
    border:0 !important;
    border-radius:0 !important;
  }

  /* Map control language: one restrained dark system, amber active only. */
  body[data-ed-portal="agent"] .agent-enterprise-map-full [class*="shadow-e"] {
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map-full button {
    min-height:44px !important;
    min-width:44px !important;
    border:1px solid rgba(255,255,255,.09) !important;
    border-radius:10px !important;
    background:rgba(16,16,18,.94) !important;
    color:#D7D7DB !important;
    box-shadow:none !important;
    backdrop-filter:blur(10px) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map-full button[aria-pressed="true"] {
    border-color:rgba(245,166,35,.34) !important;
    background:rgba(245,166,35,.12) !important;
    color:#F5A623 !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map-full .brand-surface-agrarian {
    background:#F5A623 !important;
    border-color:#F5A623 !important;
    color:#09090A !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map-full .bg-success-600,
  body[data-ed-portal="agent"] .agent-enterprise-map-full .bg-success-500 {
    background:#101012 !important;
    color:#10B981 !important;
    border-color:rgba(16,185,129,.24) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map-full .bg-warning-500 {
    background:#101012 !important;
    color:#F5A623 !important;
    border:1px solid rgba(245,166,35,.24) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map-full .bg-danger-600,
  body[data-ed-portal="agent"] .agent-enterprise-map-full .bg-danger-500 {
    background:#101012 !important;
    color:#EF4444 !important;
    border-color:rgba(239,68,68,.24) !important;
  }

  /* Precision geometry markers. Visuals stay small; Leaflet hit target remains usable. */
  body[data-ed-portal="agent"] .agent-enterprise-map .enterprise-map-marker-host {
    background:transparent !important;
    border:0 !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .enterprise-vertex {
    width:10px !important;
    height:10px !important;
    margin:5px !important;
    border-radius:50% !important;
    background:#0A0A0B !important;
    border:2px solid #F5A623 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .enterprise-vertex-start {
    width:12px !important;
    height:12px !important;
    margin:4px !important;
    box-shadow:0 0 0 2px #0A0A0B,0 0 0 3px rgba(245,166,35,.75) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .enterprise-gps-marker {
    position:relative !important;
    width:18px !important;
    height:18px !important;
    margin:5px !important;
    border-radius:50% !important;
    background:#0A0A0B !important;
    border:1px solid rgba(255,255,255,.8) !important;
    box-shadow:0 0 0 2px var(--gps-tone) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .enterprise-gps-marker-core {
    position:absolute !important;
    inset:5px !important;
    border-radius:50% !important;
    background:var(--gps-tone) !important;
  }

  /* Map labels/popups: compact technical annotations, no speech-bubble styling. */
  body[data-ed-portal="agent"] .agent-enterprise-map .distance-label {
    margin:0 !important;
    padding:3px 6px !important;
    border:1px solid rgba(255,255,255,.10) !important;
    border-radius:6px !important;
    background:rgba(10,10,11,.90) !important;
    color:#D7D7DB !important;
    box-shadow:none !important;
    font-family:Inter,Geist,system-ui,sans-serif !important;
    font-size:9px !important;
    font-weight:700 !important;
    letter-spacing:.02em !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .distance-label::before { display:none !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-popup-content-wrapper {
    border:1px solid rgba(255,255,255,.10) !important;
    border-radius:10px !important;
    background:#101012 !important;
    color:#FAFAFA !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-popup-tip {
    background:#101012 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-popup-content {
    margin:10px 12px !important;
    color:#A0A0A6 !important;
    font-size:10px !important;
    line-height:1.5 !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-popup-content strong { color:#FAFAFA !important; font-size:10px !important; letter-spacing:.04em !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-popup-close-button { color:#A0A0A6 !important; }

  /* Leaflet native control cleanup. */
  body[data-ed-portal="agent"] .agent-enterprise-map-full .leaflet-control-zoom {
    border:1px solid rgba(255,255,255,.09) !important;
    border-radius:10px !important;
    overflow:hidden !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map-full .leaflet-control-zoom a {
    width:44px !important;
    height:44px !important;
    line-height:42px !important;
    background:#101012 !important;
    color:#FAFAFA !important;
    border-color:rgba(255,255,255,.07) !important;
    font-size:18px !important;
    font-weight:400 !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map-full .leaflet-control-attribution {
    padding:2px 5px !important;
    border-radius:5px 0 0 0 !important;
    background:rgba(10,10,11,.78) !important;
    color:#6B6B70 !important;
    font-size:7px !important;
  }

  body[data-ed-portal="agent"] .agent-map-workspace-tray {
    min-height:88px !important;
    padding:8px 10px max(8px,env(safe-area-inset-bottom)) !important;
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto !important;
    gap:10px !important;
    align-items:center !important;
    border-top:1px solid rgba(255,255,255,.07) !important;
    background:rgba(12,12,14,.98) !important;
    backdrop-filter:blur(14px) !important;
    z-index:3 !important;
  }
  body[data-ed-portal="agent"] .agent-map-review-copy { min-width:0 !important; }
  body[data-ed-portal="agent"] .agent-map-review-status {
    display:block !important;
    margin:0 0 6px !important;
    color:#A0A0A6 !important;
    font-size:9px !important;
    font-weight:700 !important;
    letter-spacing:.02em !important;
  }
  body[data-ed-portal="agent"] .agent-map-review-status.is-ready { color:#10B981 !important; }
  body[data-ed-portal="agent"] .agent-map-review-status.is-error { color:#EF4444 !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-tray .agent-map-footer-stats {
    display:grid !important;
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:6px !important;
  }
  body[data-ed-portal="agent"] .agent-map-workspace-tray .agent-map-footer-stats > div {
    min-width:0 !important;
    padding-right:6px !important;
    border-right:1px solid rgba(255,255,255,.06) !important;
  }
  body[data-ed-portal="agent"] .agent-map-workspace-tray .agent-map-footer-stats > div:last-child { border-right:0 !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-tray .agent-map-footer-stats span { display:block !important; color:#6B6B70 !important; font-size:7px !important; font-weight:700 !important; letter-spacing:.08em !important; text-transform:uppercase !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-tray .agent-map-footer-stats strong { display:block !important; margin-top:2px !important; color:#FAFAFA !important; font-size:12px !important; font-weight:700 !important; font-variant-numeric:tabular-nums !important; white-space:nowrap !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-actions { display:flex !important; gap:7px !important; align-items:center !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-actions .agent-map-button { min-height:46px !important; padding:0 13px !important; }

  /* Never show lower portal chrome while root-portaled map owns the viewport. */
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .agent-register-modal,
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .agent-mobile-bottom-nav,
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .ed-mobile-workspace-trigger,
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .copilot-fab {
    visibility:hidden !important;
    pointer-events:none !important;
  }
  body[data-ed-portal="agent"]:has(.agent-registration-map-workspace) .agent-registration-map-workspace {
    visibility:visible !important;
    pointer-events:auto !important;
  }
}

@media (max-width: 390px) {
  body[data-ed-portal="agent"] .agent-map-workspace-state { display:none !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-tray { grid-template-columns:1fr !important; gap:7px !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-actions { width:100% !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-actions .agent-map-button { flex:1 1 0 !important; }
}

@media (max-width: 900px) and (max-height: 500px) {
  body[data-ed-portal="agent"] .agent-map-workspace-topbar { min-height:52px !important; padding-top:4px !important; padding-bottom:4px !important; }
  body[data-ed-portal="agent"] .agent-map-workspace-tray { min-height:66px !important; padding-top:5px !important; padding-bottom:max(5px,env(safe-area-inset-bottom)) !important; }
  body[data-ed-portal="agent"] .agent-map-review-status { display:none !important; }
}

/* ========================================================================
   v11.4 — AGENT MAPPING: FINAL ENTERPRISE CONTROL + GPS DENSITY SYSTEM
   ======================================================================== */
@media (max-width: 900px) {
  body[data-ed-portal="agent"] .agent-enterprise-map {
    --map-bg:#0A0A0B;
    --map-surface:rgba(16,16,18,.94);
    --map-surface-strong:rgba(10,10,11,.97);
    --map-border:rgba(255,255,255,.09);
    --map-border-strong:rgba(255,255,255,.14);
    --map-text:#FAFAFA;
    --map-muted:#A0A0A6;
    --map-tertiary:#6B6B70;
    --map-amber:#F5A623;
    --map-green:#10B981;
    --map-red:#EF4444;
  }

  /* One quiet, authoritative GPS status surface. */
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-gps-status {
    position:absolute !important;
    top:12px !important;
    left:12px !important;
    z-index:510 !important;
    display:flex !important;
    align-items:center !important;
    gap:8px !important;
    min-height:44px !important;
    max-width:min(220px,calc(100% - 142px)) !important;
    padding:6px 10px !important;
    border:1px solid var(--map-border) !important;
    border-radius:10px !important;
    background:var(--map-surface-strong) !important;
    color:var(--map-muted) !important;
    box-shadow:none !important;
    backdrop-filter:blur(12px) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-gps-status > svg {
    width:17px !important;
    height:17px !important;
    flex:0 0 17px !important;
    color:var(--map-tertiary) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-gps-status[data-tone="success"] > svg { color:var(--map-green) !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-gps-status[data-tone="warning"] > svg { color:var(--map-amber) !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-gps-copy {
    min-width:0 !important;
    display:flex !important;
    flex-direction:column !important;
    gap:1px !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-gps-copy strong {
    color:var(--map-text) !important;
    font:700 10px/1.2 Inter,Geist,system-ui,sans-serif !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-gps-copy span {
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    color:var(--map-muted) !important;
    font:500 9px/1.2 Inter,Geist,system-ui,sans-serif !important;
    white-space:nowrap !important;
  }

  /* Unified map control language: dark neutral, amber selected, no white faces. */
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-toolbar {
    position:absolute !important;
    top:12px !important;
    right:12px !important;
    z-index:510 !important;
    display:flex !important;
    align-items:center !important;
    gap:6px !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-control-group {
    display:flex !important;
    gap:2px !important;
    padding:2px !important;
    border:1px solid var(--map-border) !important;
    border-radius:12px !important;
    background:var(--map-surface-strong) !important;
    backdrop-filter:blur(12px) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-control {
    position:relative !important;
    display:inline-flex !important;
    width:44px !important;
    min-width:44px !important;
    height:44px !important;
    min-height:44px !important;
    align-items:center !important;
    justify-content:center !important;
    padding:0 !important;
    border:1px solid transparent !important;
    border-radius:10px !important;
    background:transparent !important;
    color:var(--map-muted) !important;
    box-shadow:none !important;
    transition:background .14s ease,border-color .14s ease,color .14s ease !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-control:hover,
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-control:focus-visible {
    background:rgba(255,255,255,.045) !important;
    color:var(--map-text) !important;
    outline:none !important;
    border-color:var(--map-border-strong) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-control[data-active="true"] {
    background:rgba(245,166,35,.11) !important;
    border-color:rgba(245,166,35,.42) !important;
    color:var(--map-amber) !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-control:disabled { opacity:.38 !important; cursor:not-allowed !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-control > svg { width:19px !important; height:19px !important; }

  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-side-tools {
    position:absolute !important;
    top:68px !important;
    right:12px !important;
    z-index:510 !important;
    display:flex !important;
    flex-direction:column !important;
    gap:6px !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-side-tools .agent-map-control {
    border-color:var(--map-border) !important;
    background:var(--map-surface-strong) !important;
    backdrop-filter:blur(12px) !important;
  }

  /* Small guidance strip instead of a large center card over imagery. */
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-context-hint {
    position:absolute !important;
    left:12px !important;
    bottom:82px !important;
    z-index:505 !important;
    max-width:calc(100% - 82px) !important;
    padding:7px 10px !important;
    border:1px solid var(--map-border) !important;
    border-radius:8px !important;
    background:rgba(10,10,11,.90) !important;
    color:var(--map-muted) !important;
    box-shadow:none !important;
    font:600 10px/1.35 Inter,Geist,system-ui,sans-serif !important;
    pointer-events:none !important;
  }

  /* Single contextual dock: status + only the actions relevant now. */
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-action-dock {
    position:absolute !important;
    left:12px !important;
    right:12px !important;
    bottom:12px !important;
    z-index:520 !important;
    display:flex !important;
    flex-direction:column !important;
    gap:6px !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-inline-status {
    display:grid !important;
    grid-template-columns:auto minmax(0,1fr) !important;
    gap:8px !important;
    align-items:center !important;
    padding:7px 9px !important;
    border:1px solid var(--map-border) !important;
    border-radius:8px !important;
    background:rgba(10,10,11,.93) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-inline-status strong {
    color:var(--map-text) !important;
    font:700 9px/1.2 Inter,Geist,system-ui,sans-serif !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-inline-status span {
    min-width:0 !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    color:var(--map-muted) !important;
    font:500 9px/1.2 Inter,Geist,system-ui,sans-serif !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-inline-status[data-tone="warning"] { border-color:rgba(245,166,35,.24) !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-inline-status.is-error { border-color:rgba(239,68,68,.30) !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-inline-status.is-error strong { color:var(--map-red) !important; }

  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-save-state {
    align-self:flex-start !important;
    padding:4px 7px !important;
    border:1px solid rgba(16,185,129,.18) !important;
    border-radius:6px !important;
    background:rgba(10,10,11,.88) !important;
    color:#6FD8B2 !important;
    font:600 8px/1 Inter,Geist,system-ui,sans-serif !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-context-actions {
    display:flex !important;
    align-items:center !important;
    gap:6px !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-context-button {
    min-height:44px !important;
    padding:0 12px !important;
    border:1px solid var(--map-border) !important;
    border-radius:10px !important;
    background:var(--map-surface-strong) !important;
    color:var(--map-text) !important;
    box-shadow:none !important;
    font:700 10px/1 Inter,Geist,system-ui,sans-serif !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-context-button.is-primary {
    flex:1 1 auto !important;
    border-color:var(--map-amber) !important;
    background:var(--map-amber) !important;
    color:#0A0A0B !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-context-button.is-secondary { flex:1 1 auto !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-context-button.is-tertiary {
    flex:0 0 auto !important;
    color:var(--map-muted) !important;
  }

  /* Accuracy circle/marker: calm technical signal, never a decorative alarm. */
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-interactive[stroke="#F5A623"] { opacity:.70 !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .enterprise-gps-marker {
    border-color:rgba(250,250,250,.72) !important;
    box-shadow:0 0 0 2px color-mix(in srgb,var(--gps-tone) 72%,transparent) !important;
  }

  /* Native Leaflet controls are visually absorbed into the same product system. */
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-control-zoom {
    margin:0 !important;
    border:1px solid var(--map-border) !important;
    border-radius:10px !important;
    overflow:hidden !important;
    background:var(--map-surface-strong) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-control-zoom a {
    width:44px !important;
    height:44px !important;
    line-height:42px !important;
    border-color:var(--map-border) !important;
    background:transparent !important;
    color:var(--map-muted) !important;
    box-shadow:none !important;
    font-size:17px !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-control-zoom a:hover { background:rgba(255,255,255,.045) !important; color:var(--map-text) !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-control-scale-line {
    border-color:rgba(250,250,250,.40) !important;
    border-top:0 !important;
    background:rgba(10,10,11,.72) !important;
    color:#C7C7CB !important;
    box-shadow:none !important;
    font:600 8px/1.25 Inter,Geist,system-ui,sans-serif !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-control-attribution {
    max-width:72% !important;
    padding:2px 5px !important;
    background:rgba(10,10,11,.72) !important;
    color:#707077 !important;
    font:500 6.5px/1.2 Inter,Geist,system-ui,sans-serif !important;
  }

  /* Technical annotation language; no cartoon callouts. */
  body[data-ed-portal="agent"] .agent-enterprise-map .distance-label,
  body[data-ed-portal="agent"] .agent-enterprise-map .leaflet-tooltip {
    border:1px solid var(--map-border) !important;
    border-radius:6px !important;
    background:rgba(10,10,11,.90) !important;
    color:#D6D6DA !important;
    box-shadow:none !important;
    font:700 8.5px/1.25 Inter,Geist,system-ui,sans-serif !important;
    letter-spacing:.035em !important;
  }

  /* Map-first inline preview: controls fit the smaller workspace. */
  body[data-ed-portal="agent"] .agent-register-map-inline .agent-map-gps-status { max-width:150px !important; }
  body[data-ed-portal="agent"] .agent-register-map-inline .agent-map-toolbar { gap:4px !important; }
  body[data-ed-portal="agent"] .agent-register-map-inline .agent-map-control-group { gap:0 !important; }
  body[data-ed-portal="agent"] .agent-register-map-inline .agent-map-control { width:40px !important; min-width:40px !important; height:40px !important; min-height:40px !important; }
  body[data-ed-portal="agent"] .agent-register-map-inline .agent-map-side-tools { top:60px !important; gap:4px !important; }
  body[data-ed-portal="agent"] .agent-register-map-inline .agent-map-context-hint { bottom:70px !important; }
  body[data-ed-portal="agent"] .agent-register-map-inline .agent-map-context-button { min-height:42px !important; }
}

@media (max-width: 360px) {
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-gps-status { max-width:138px !important; padding-inline:8px !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-control { width:40px !important; min-width:40px !important; height:40px !important; min-height:40px !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-toolbar { gap:4px !important; right:8px !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-side-tools { right:8px !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-action-dock { left:8px !important; right:8px !important; bottom:8px !important; }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-context-button { padding-inline:9px !important; font-size:9px !important; }
}

/* ═══════════════════════════════════════════════════════════════
   AGENT MAP v10.16 — PROVIDER-AWARE DETAIL + ACCURACY-AWARE ZOOM
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px), (max-width: 900px) and (max-height: 500px) {
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-detail-notice {
    position:absolute !important;
    top:64px !important;
    left:12px !important;
    z-index:515 !important;
    display:flex !important;
    align-items:center !important;
    gap:8px !important;
    min-height:36px !important;
    max-width:min(300px,calc(100% - 82px)) !important;
    padding:5px 6px 5px 9px !important;
    border:1px solid rgba(255,255,255,.09) !important;
    border-radius:9px !important;
    background:rgba(10,10,11,.92) !important;
    color:#A0A0A6 !important;
    box-shadow:none !important;
    backdrop-filter:blur(12px) !important;
    font:600 8.5px/1.2 Inter,Geist,system-ui,sans-serif !important;
    letter-spacing:.015em !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-detail-notice[data-tone="warning"] {
    border-color:rgba(245,166,35,.26) !important;
    color:#D8C09A !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-detail-notice > span {
    min-width:0 !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-detail-notice > button {
    flex:0 0 auto !important;
    min-width:44px !important;
    min-height:44px !important;
    padding:0 9px !important;
    border:1px solid rgba(245,166,35,.32) !important;
    border-radius:8px !important;
    background:rgba(245,166,35,.10) !important;
    color:#F5A623 !important;
    box-shadow:none !important;
    font:700 8px/1 Inter,Geist,system-ui,sans-serif !important;
  }

  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-context-button:disabled,
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-button:disabled {
    opacity:.44 !important;
    cursor:not-allowed !important;
  }

  /* The detail notice occupies the first side-tool row when present. */
  body[data-ed-portal="agent"] .agent-enterprise-map:has(.agent-map-detail-notice) .agent-map-side-tools {
    top:112px !important;
  }

  /* Inline registration map stays compact even when overzoom/detail notice appears. */
  body[data-ed-portal="agent"] .agent-register-map-inline .agent-map-detail-notice {
    top:58px !important;
    left:8px !important;
    max-width:calc(100% - 64px) !important;
    min-height:32px !important;
    padding:4px 7px !important;
  }
  body[data-ed-portal="agent"] .agent-register-map-inline:has(.agent-map-detail-notice) .agent-map-side-tools {
    top:100px !important;
  }
}

@media (max-width: 360px) {
  body[data-ed-portal="agent"] .agent-enterprise-map .agent-map-detail-notice {
    left:8px !important;
    max-width:calc(100% - 64px) !important;
  }
}

/* ============================================================================
   v12.0 — DRIVER / TRUCK MOBILE OPERATIONS CONTRACT
   Runtime-driven correction for TruckPortal. Mobile only; desktop preserved.
   Goals: no narrow text rails, compact telemetry/KPIs, scanner-first bags,
   navigation-first live map, contextual GPS, full-height clean drawer.
   ============================================================================ */
@media (max-width: 768px) {
  body[data-ed-portal="truck"] {
    --drv-bg:#080A0E;
    --drv-surface:#0F1116;
    --drv-surface-2:#12151B;
    --drv-line:rgba(255,255,255,.075);
    --drv-text:#FAFAFA;
    --drv-muted:#9A9DA5;
    --drv-faint:#666A73;
    --drv-amber:#F5A623;
    background:var(--drv-bg) !important;
  }

  /* One authoritative mobile content lane. */
  body[data-ed-portal="truck"] #truck-main-content,
  body[data-ed-portal="truck"] #truck-main-content.ed-mobile-main-v8,
  body[data-ed-portal="truck"] #truck-main-content .truck-tab-root,
  body[data-ed-portal="truck"] #truck-main-content .truck-tab-root > * {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }
  body[data-ed-portal="truck"] #truck-main-content {
    padding:10px 10px calc(86px + env(safe-area-inset-bottom)) !important;
    overflow-x:hidden !important;
  }

  /* Strong horizontal-writing and intrinsic-width safety contract. */
  body[data-ed-portal="truck"] #truck-main-content :where(h1,h2,h3,h4,h5,h6,p,span,label,small,strong,div),
  body[data-ed-portal="truck"] .ed-sidebar :where(span,p,strong) {
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
  }
  body[data-ed-portal="truck"] #truck-main-content :where(.flex,.grid) > * { min-width:0 !important; }

  /* Shared SectionHeader root fix: icon may never consume the text lane. */
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header,
  body[data-ed-portal="truck"] #truck-main-content .truck-section-header {
    display:grid !important;
    grid-template-columns:32px minmax(0,1fr) !important;
    align-items:start !important;
    gap:9px !important;
    width:100% !important;
    min-width:0 !important;
    margin-bottom:8px !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-icon,
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header > :first-child:not(.ui-section-copy) {
    width:32px !important;
    min-width:32px !important;
    max-width:32px !important;
    height:32px !important;
    min-height:32px !important;
    padding:0 !important;
    display:grid !important;
    place-items:center !important;
    border-radius:9px !important;
    background:#13161C !important;
    border:1px solid var(--drv-line) !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-icon svg,
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header > :first-child svg {
    width:15px !important; height:15px !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-copy,
  body[data-ed-portal="truck"] #truck-main-content .ui-section-copy > * {
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
    padding:0 !important;
    min-height:0 !important;
    background:transparent !important;
    border:0 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-title { font-size:14px !important; line-height:1.25 !important; }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-subtitle { font-size:10.5px !important; line-height:1.4 !important; margin-top:2px !important; color:var(--drv-muted) !important; }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-eyebrow,
  body[data-ed-portal="truck"] #truck-main-content .section-eyebrow { font-size:8px !important; line-height:1.15 !important; letter-spacing:.12em !important; color:var(--drv-faint) !important; }

  /* Header + telemetry: four primary mobile metrics; Delivered remains desktop-only. */
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar {
    background:rgba(8,10,14,.97) !important;
    border-bottom:1px solid var(--drv-line) !important;
  }
  body[data-ed-portal="truck"] .truck-status-strip {
    display:grid !important;
    grid-template-columns:repeat(4,minmax(0,1fr)) !important;
    gap:6px !important;
    padding:0 10px 9px !important;
    overflow:visible !important;
  }
  body[data-ed-portal="truck"] .truck-status-strip > :nth-child(5) { display:none !important; }
  body[data-ed-portal="truck"] .truck-status-chip {
    min-width:0 !important;
    min-height:42px !important;
    padding:6px 7px !important;
    gap:5px !important;
    border-radius:9px !important;
    background:var(--drv-surface) !important;
    border-color:var(--drv-line) !important;
  }
  body[data-ed-portal="truck"] .truck-status-chip > span:first-child {
    width:22px !important; height:22px !important; min-width:22px !important;
    background:#15181E !important;
  }
  body[data-ed-portal="truck"] .truck-status-chip > div { min-width:0 !important; }
  body[data-ed-portal="truck"] .truck-status-chip p:first-child { font-size:6.5px !important; line-height:1.05 !important; }
  body[data-ed-portal="truck"] .truck-status-chip p:nth-child(2) { font-size:10px !important; line-height:1.15 !important; white-space:nowrap !important; overflow:hidden !important; text-overflow:ellipsis !important; }

  /* GPS is contextual and compact instead of a permanent full-width banner. */
  body[data-ed-portal="truck"] .truck-mobile-gps {
    display:flex !important;
    justify-content:flex-end !important;
    padding:8px 10px 0 !important;
    min-height:0 !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps > button {
    width:auto !important;
    min-width:0 !important;
    max-width:210px !important;
    min-height:38px !important;
    padding:7px 10px !important;
    border-radius:9px !important;
    font-size:10.5px !important;
    background:#111723 !important;
    border:1px solid #202A40 !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps > button > span:first-child { gap:6px !important; }

  /* Trips command center. */
  body[data-ed-portal="truck"] .truck-tab-dispatches { gap:10px !important; }
  body[data-ed-portal="truck"] .truck-quick-actions {
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:6px !important;
    margin:0 0 8px !important;
  }
  body[data-ed-portal="truck"] .truck-quick-actions button {
    min-height:42px !important;
    padding:8px 10px !important;
    border:1px solid var(--drv-line) !important;
    border-radius:10px !important;
    background:#0F1115 !important;
    color:var(--drv-text) !important;
    display:flex !important;
    align-items:center !important;
    gap:7px !important;
    font-size:10.5px !important;
    font-weight:650 !important;
    text-align:left !important;
  }
  body[data-ed-portal="truck"] .truck-quick-actions svg { color:var(--drv-amber) !important; flex:0 0 auto !important; }
  body[data-ed-portal="truck"] .truck-empty-state-card {
    padding:12px !important;
    min-height:0 !important;
    background:#11100F !important;
    border-color:var(--drv-line) !important;
  }
  body[data-ed-portal="truck"] .truck-empty-state-card [class*="py-"] { padding-top:10px !important; padding-bottom:10px !important; }
  body[data-ed-portal="truck"] .truck-empty-state-card [class*="w-16"],
  body[data-ed-portal="truck"] .truck-empty-state-card [class*="h-16"] { width:38px !important; height:38px !important; }

  /* Bags: workflow first, no desktop card geometry or side-rail prose. */
  body[data-ed-portal="truck"] .truck-bag-workspace {
    padding:12px !important;
    min-height:0 !important;
    background:var(--drv-surface) !important;
    border-color:var(--drv-line) !important;
  }
  body[data-ed-portal="truck"] .truck-tab-bags .ui-section-header { margin-bottom:10px !important; }
  body[data-ed-portal="truck"] .truck-tab-bags .label { font-size:8px !important; letter-spacing:.08em !important; }
  body[data-ed-portal="truck"] .truck-tab-bags .input {
    width:100% !important;
    min-height:44px !important;
    font-size:16px !important;
    border-radius:9px !important;
  }
  body[data-ed-portal="truck"] .truck-tab-bags [class*="grid-cols-4"],
  body[data-ed-portal="truck"] .truck-tab-bags [class*="md:grid-cols-6"] {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:7px !important;
  }
  body[data-ed-portal="truck"] .truck-tab-bags .btn-primary { min-height:46px !important; border-radius:10px !important; }

  /* Performance: one metric = one shallow surface; remove nested 100px descendants. */
  body[data-ed-portal="truck"] .truck-tab-stats > .grid:first-child {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:7px !important;
  }
  body[data-ed-portal="truck"] .truck-performance-metric,
  body[data-ed-portal="truck"] .truck-performance-metric.card,
  body[data-ed-portal="truck"] .truck-performance-metric.ui-metric-tile {
    min-height:72px !important;
    height:auto !important;
    padding:9px !important;
    border-radius:10px !important;
    background:var(--drv-surface) !important;
    border:1px solid var(--drv-line) !important;
  }
  body[data-ed-portal="truck"] .truck-performance-metric :where(.ui-metric-body,.ui-metric-copy,.ui-metric-label,.ui-metric-value,.ui-metric-hint,.ui-metric-icon),
  body[data-ed-portal="truck"] .truck-performance-metric [class*="metric"] {
    min-height:0 !important;
    height:auto !important;
    padding:0 !important;
    background:transparent !important;
    border:0 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="truck"] .truck-performance-metric .ui-metric-body {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) 24px !important;
    gap:6px !important;
    align-items:center !important;
  }
  body[data-ed-portal="truck"] .truck-performance-metric .ui-metric-label { font-size:7.5px !important; }
  body[data-ed-portal="truck"] .truck-performance-metric .ui-metric-value { font-size:18px !important; line-height:1.1 !important; }
  body[data-ed-portal="truck"] .truck-performance-metric .ui-metric-icon { width:24px !important; height:24px !important; min-width:24px !important; }
  body[data-ed-portal="truck"] .truck-tab-stats > .grid:nth-child(2) {
    grid-template-columns:minmax(0,1fr) !important;
    gap:8px !important;
  }
  body[data-ed-portal="truck"] .truck-performance-detail { padding:11px !important; border-radius:10px !important; min-height:0 !important; }
  body[data-ed-portal="truck"] .truck-performance-detail [class*="text-4xl"] { font-size:25px !important; }

  /* Maintenance / Route Assist compactness. */
  body[data-ed-portal="truck"] .truck-tab-maintenance .card,
  body[data-ed-portal="truck"] .truck-route-assist .card { border-radius:10px !important; }
  body[data-ed-portal="truck"] .truck-maintenance-empty { max-height:180px !important; }
  body[data-ed-portal="truck"] .truck-route-assist-intro { padding:12px !important; }
  body[data-ed-portal="truck"] .truck-route-assist-intro h3 { font-size:14px !important; }
  body[data-ed-portal="truck"] .truck-route-assist-intro p:not(.section-eyebrow) { font-size:10.5px !important; line-height:1.4 !important; }

  /* Driver Live Map: map-first, no continent-scale default UI, no cartoony controls. */
  body[data-ed-portal="truck"] .truck-tab-map { gap:8px !important; }
  body[data-ed-portal="truck"] .truck-tab-map > .card:first-child:not(.truck-live-map-card) { max-height:190px !important; overflow:auto !important; }
  body[data-ed-portal="truck"] .truck-live-map-card {
    border-radius:10px !important;
    background:var(--drv-surface) !important;
    border-color:var(--drv-line) !important;
  }
  body[data-ed-portal="truck"] .truck-live-map-header { padding:9px 10px !important; }
  body[data-ed-portal="truck"] .truck-live-map-header p { font-size:9.5px !important; line-height:1.35 !important; }
  body[data-ed-portal="truck"] .truck-live-map-card > [class*="h-[60vh]"] {
    height:calc(100dvh - 255px) !important;
    min-height:390px !important;
  }
  body[data-ed-portal="truck"] .truck-map-shell,
  body[data-ed-portal="truck"] .truck-map-canvas,
  body[data-ed-portal="truck"] .leaflet-container {
    width:100% !important;
    min-width:0 !important;
    height:100% !important;
    min-height:100% !important;
  }
  body[data-ed-portal="truck"] .truck-map-shell { overflow:hidden !important; background:#0A0A0B !important; }
  body[data-ed-portal="truck"] .truck-map-controls {
    position:absolute !important;
    top:10px !important; right:10px !important;
    z-index:600 !important;
    display:grid !important;
    grid-template-columns:repeat(2,auto) !important;
    gap:3px !important;
    padding:3px !important;
    background:rgba(10,10,11,.92) !important;
    border:1px solid rgba(255,255,255,.09) !important;
    border-radius:10px !important;
    backdrop-filter:blur(10px) !important;
  }
  body[data-ed-portal="truck"] .truck-map-controls button {
    min-width:58px !important;
    min-height:40px !important;
    padding:0 10px !important;
    border:0 !important;
    border-radius:7px !important;
    background:transparent !important;
    color:#9A9DA5 !important;
    font-size:9.5px !important;
    font-weight:650 !important;
  }
  body[data-ed-portal="truck"] .truck-map-controls button[aria-pressed="true"] {
    color:var(--drv-amber) !important;
    background:rgba(245,166,35,.10) !important;
    box-shadow:inset 0 0 0 1px rgba(245,166,35,.42) !important;
  }
  body[data-ed-portal="truck"] .truck-map-recenter {
    position:absolute !important;
    right:10px !important; top:62px !important;
    z-index:600 !important;
    width:42px !important; height:42px !important;
    min-width:42px !important; min-height:42px !important;
    padding:0 !important;
    display:grid !important; place-items:center !important;
    border-radius:10px !important;
    background:rgba(10,10,11,.92) !important;
    border:1px solid rgba(255,255,255,.09) !important;
    color:#D5D6DA !important;
  }
  body[data-ed-portal="truck"] .truck-map-recenter svg { width:17px !important; height:17px !important; }
  body[data-ed-portal="truck"] .truck-map-gps-state {
    position:absolute !important;
    left:10px !important; top:10px !important;
    z-index:600 !important;
    min-height:32px !important;
    max-width:180px !important;
    padding:7px 9px !important;
    display:flex !important; align-items:center !important; gap:6px !important;
    border-radius:9px !important;
    background:rgba(10,10,11,.92) !important;
    border:1px solid rgba(255,255,255,.09) !important;
    color:#B0B3BA !important;
    font-size:9.5px !important;
    font-weight:650 !important;
  }
  body[data-ed-portal="truck"] .truck-map-gps-dot { width:6px !important; height:6px !important; border-radius:50% !important; background:#73767D !important; flex:0 0 auto !important; }
  body[data-ed-portal="truck"] .truck-map-gps-state.is-active .truck-map-gps-dot { background:var(--drv-amber) !important; }

  /* Technical map markers / labels. */
  body[data-ed-portal="truck"] .truck-map-div-icon { background:transparent !important; border:0 !important; }
  body[data-ed-portal="truck"] .truck-map-vehicle-marker {
    width:30px !important; height:30px !important;
    display:grid !important; place-items:center !important;
    border-radius:50% !important;
    background:#0A0A0B !important;
    color:var(--drv-amber) !important;
    border:2px solid var(--drv-amber) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="truck"] .truck-map-vehicle-marker svg { width:15px !important; height:15px !important; }
  body[data-ed-portal="truck"] .truck-map-destination-marker {
    width:24px !important; height:24px !important;
    border-radius:50% !important;
    background:#0A0A0B !important;
    border:1.5px solid #D3D5DA !important;
    display:grid !important; place-items:center !important;
  }
  body[data-ed-portal="truck"] .truck-map-destination-marker span { width:6px !important; height:6px !important; border-radius:50% !important; background:var(--drv-amber) !important; }
  body[data-ed-portal="truck"] .truck-map-route-label {
    display:inline-flex !important; align-items:center !important; gap:5px !important;
    padding:4px 7px !important;
    border-radius:7px !important;
    background:rgba(10,10,11,.90) !important;
    border:1px solid rgba(255,255,255,.09) !important;
    color:#FAFAFA !important;
    white-space:nowrap !important;
    font:600 9px/1.15 Inter,system-ui,sans-serif !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="truck"] .truck-map-route-label span { color:#A0A0A6 !important; }
  body[data-ed-portal="truck"] .truck-map-popup { min-width:150px !important; display:grid !important; gap:3px !important; }
  body[data-ed-portal="truck"] .truck-map-popup strong { font-size:10px !important; letter-spacing:.08em !important; color:var(--drv-amber) !important; }
  body[data-ed-portal="truck"] .truck-map-popup span, body[data-ed-portal="truck"] .truck-map-popup small { font-size:9px !important; color:#777B84 !important; }

  /* Leaflet visual integration and image protection. */
  body[data-ed-portal="truck"] .leaflet-pane img,
  body[data-ed-portal="truck"] .leaflet-tile,
  body[data-ed-portal="truck"] .leaflet-marker-icon,
  body[data-ed-portal="truck"] .leaflet-marker-shadow {
    max-width:none !important;
    max-height:none !important;
  }
  body[data-ed-portal="truck"] .leaflet-control-zoom {
    border:1px solid rgba(255,255,255,.09) !important;
    border-radius:9px !important;
    overflow:hidden !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="truck"] .leaflet-control-zoom a {
    width:40px !important; height:40px !important; line-height:40px !important;
    background:rgba(10,10,11,.92) !important;
    color:#C5C7CC !important;
    border-color:rgba(255,255,255,.07) !important;
  }
  body[data-ed-portal="truck"] .leaflet-control-attribution {
    background:rgba(10,10,11,.70) !important;
    color:#777B84 !important;
    font-size:7px !important;
    padding:2px 4px !important;
  }
  body[data-ed-portal="truck"] .leaflet-control-attribution a { color:#A0A0A6 !important; }

  /* Drawer: true viewport sheet and no map-control bleed-through. */
  body[data-ed-portal="truck"].ed-mobile-portal-active .ed-sidebar {
    position:fixed !important;
    top:0 !important; bottom:0 !important; left:0 !important;
    height:auto !important;
    min-height:100dvh !important;
    max-height:100dvh !important;
    width:min(82vw,312px) !important;
    display:flex !important;
    flex-direction:column !important;
    border-radius:0 !important;
    overflow:hidden !important;
    z-index:5000 !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar-nav-v8 { flex:1 1 auto !important; min-height:0 !important; overflow-y:auto !important; }
  body[data-ed-portal="truck"] .ed-sidebar-footer-v8 { margin-top:auto !important; padding-bottom:max(10px,env(safe-area-inset-bottom)) !important; flex:0 0 auto !important; }
  body[data-ed-portal="truck"].ed-mobile-drawer-is-open .truck-map-controls,
  body[data-ed-portal="truck"].ed-mobile-drawer-is-open .truck-map-recenter,
  body[data-ed-portal="truck"].ed-mobile-drawer-is-open .truck-map-gps-state,
  body[data-ed-portal="truck"].ed-mobile-drawer-is-open .leaflet-control-container,
  body[data-ed-portal="truck"].ed-mobile-drawer-is-open .copilot-fab {
    visibility:hidden !important;
    pointer-events:none !important;
  }

  /* Bottom navigation stays authoritative. */
  body[data-ed-portal="truck"] .truck-mobile-bottom-nav { z-index:60 !important; background:rgba(8,10,14,.98) !important; border-top-color:var(--drv-line) !important; }
  body[data-ed-portal="truck"] .truck-mobile-bottom-tab { min-height:52px !important; color:#81858E !important; }
  body[data-ed-portal="truck"] .truck-mobile-bottom-tab.is-active { color:var(--drv-amber) !important; background:rgba(245,166,35,.07) !important; }

  /* Hide assistant on live map so map controls and route actions stay unobstructed. */
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="map"] ~ .copilot-fab,
  body[data-ed-portal="truck"] .truck-dashboard-root:has(#truck-main-content[data-mobile-tab="map"]) .copilot-fab { display:none !important; }
}

@media (max-width: 390px) {
  body[data-ed-portal="truck"] .truck-status-strip { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  body[data-ed-portal="truck"] .truck-status-chip { min-height:38px !important; }
  body[data-ed-portal="truck"] .truck-quick-actions { grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important; }
}

@media (max-width: 340px) {
  body[data-ed-portal="truck"] #truck-main-content { padding-left:8px !important; padding-right:8px !important; }
  body[data-ed-portal="truck"] .truck-map-controls button { min-width:52px !important; padding:0 7px !important; }
}

/* v12.0.1 — win over the legacy header auto-column rule on real TruckPortal DOM. */
@media (max-width:768px) {
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar > div:nth-child(2).truck-status-strip {
    display:grid !important;
    grid-auto-flow:row !important;
    grid-auto-columns:auto !important;
    grid-template-columns:repeat(4,minmax(0,1fr)) !important;
    overflow:visible !important;
  }
}
@media (max-width:390px) {
  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar > div:nth-child(2).truck-status-strip {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
}

/* ============================================================================
   v12.1 — DRIVER MOBILE ACCEPTANCE PASS
   UI-only corrections. Keeps TruckPortal handlers, API contracts, auth and
   operational workflows untouched while fixing the real SectionHeader DOM,
   GPS placement, map-first ordering and mobile acceptance constraints.
   ============================================================================ */
@media (max-width:768px), (min-width:769px) and (max-width:900px) and (max-height:500px) and (orientation:landscape) {
  body[data-ed-portal="truck"] {
    --drv-bg:#080A0E;
    --drv-surface:#0F1116;
    --drv-surface-2:#12151B;
    --drv-line:rgba(255,255,255,.075);
    --drv-text:#FAFAFA;
    --drv-muted:#9A9DA5;
    --drv-faint:#666A73;
    --drv-amber:#F5A623;
  }
  body[data-ed-portal="truck"] .truck-dashboard-root {
    overflow-x:hidden !important;
    padding-bottom:calc(76px + env(safe-area-inset-bottom)) !important;
  }
  body[data-ed-portal="truck"] .truck-status-strip {
    display:grid !important;
    grid-template-columns:repeat(4,minmax(0,1fr)) !important;
    gap:6px !important;
    overflow:visible !important;
  }
  body[data-ed-portal="truck"] .truck-status-strip > :nth-child(5) { display:none !important; }
  body[data-ed-portal="truck"] .truck-mobile-bottom-nav {
    position:fixed !important;
    left:0 !important; right:0 !important; bottom:0 !important;
    z-index:60 !important;
    display:grid !important;
    grid-template-columns:repeat(5,minmax(0,1fr)) !important;
    padding:6px 6px calc(6px + env(safe-area-inset-bottom)) !important;
    background:rgba(8,10,14,.98) !important;
    border-top:1px solid var(--drv-line) !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-bottom-tab {
    min-width:0 !important;
    min-height:52px !important;
    display:flex !important;
    flex-direction:column !important;
    align-items:center !important;
    justify-content:center !important;
    gap:2px !important;
  }
  body[data-ed-portal="truck"] .truck-desktop-tabs { display:none !important; }

  /* Fixed header clearance. The legacy GPS spacer used to provide this offset;
     GPS now lives inside the content lane, so main owns the clearance. */
  body[data-ed-portal="truck"] #truck-main-content {
    padding-top:118px !important;
  }

  /* Actual SectionHeader DOM contract (src/components/ui/index.tsx).
     This deliberately overrides the obsolete .ui-section-copy/.ui-section-icon
     selectors that were collapsing .ui-section-header-main to 32px. */
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header {
    display:flex !important;
    align-items:flex-start !important;
    justify-content:space-between !important;
    gap:9px !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header > .ui-section-header-main:first-child:not(.ui-section-copy) {
    flex:1 1 auto !important;
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
    height:auto !important;
    min-height:0 !important;
    padding:0 !important;
    display:flex !important;
    align-items:flex-start !important;
    gap:9px !important;
    background:transparent !important;
    border:0 !important;
    border-radius:0 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header-icon {
    flex:0 0 32px !important;
    width:32px !important;
    min-width:32px !important;
    max-width:32px !important;
    height:32px !important;
    min-height:32px !important;
    padding:0 !important;
    display:grid !important;
    place-items:center !important;
    border-radius:9px !important;
    background:#13161C !important;
    border:1px solid var(--drv-line) !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header-icon svg {
    width:15px !important;
    height:15px !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header-copy {
    flex:1 1 auto !important;
    width:auto !important;
    min-width:0 !important;
    max-width:none !important;
    padding:0 !important;
    background:transparent !important;
    border:0 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header-actions {
    flex:0 0 auto !important;
    min-width:0 !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header-copy .section-title {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    font-size:14px !important;
    line-height:1.25 !important;
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .ui-section-header-copy > p:not(.section-eyebrow) {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    white-space:normal !important;
  }

  /* One authoritative text-safety contract for every Driver tab. */
  body[data-ed-portal="truck"] #truck-main-content .truck-tab-root,
  body[data-ed-portal="truck"] #truck-main-content .truck-tab-root :where(section,article,header,footer,div,p,h1,h2,h3,h4,h5,h6,span,label,strong,small) {
    min-width:0 !important;
  }
  body[data-ed-portal="truck"] #truck-main-content .truck-tab-root :where(p,h1,h2,h3,h4,h5,h6,span,label,strong,small) {
    writing-mode:horizontal-tb !important;
    text-orientation:mixed !important;
    word-break:normal !important;
    overflow-wrap:break-word !important;
  }

  /* GPS: integrated into the main content lane; same existing start/stop handlers. */
  body[data-ed-portal="truck"] .truck-mobile-gps {
    width:100% !important;
    min-width:0 !important;
    min-height:44px !important;
    margin:0 0 10px !important;
    padding:7px 8px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:8px !important;
    border:1px solid var(--drv-line) !important;
    border-radius:10px !important;
    background:var(--drv-surface) !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps-state {
    flex:1 1 auto !important;
    min-width:0 !important;
    display:flex !important;
    align-items:center !important;
    gap:7px !important;
    color:#C8CBD1 !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps-state > svg {
    flex:0 0 auto !important;
    color:var(--drv-amber) !important;
    stroke-width:1.7 !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps-dot {
    width:7px !important;
    height:7px !important;
    flex:0 0 7px !important;
    border-radius:50% !important;
    background:#666A73 !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps-dot.is-live {
    background:#22C55E !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps-copy {
    min-width:0 !important;
    display:flex !important;
    flex-direction:column !important;
    gap:1px !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps-copy strong {
    color:var(--drv-text) !important;
    font-size:10.5px !important;
    line-height:1.15 !important;
    font-weight:650 !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps-copy small {
    color:var(--drv-muted) !important;
    font-size:9px !important;
    line-height:1.2 !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps-toggle {
    flex:0 0 auto !important;
    min-width:70px !important;
    min-height:44px !important;
    padding:0 11px !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    border:1px solid rgba(245,166,35,.34) !important;
    border-radius:9px !important;
    background:rgba(245,166,35,.08) !important;
    color:var(--drv-amber) !important;
    font-size:10px !important;
    font-weight:700 !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps.is-tracking .truck-mobile-gps-toggle {
    border-color:rgba(255,255,255,.10) !important;
    background:#15181E !important;
    color:#C9CBD1 !important;
  }

  /* Trips / quick actions: 44px touch contract and equal geometry. */
  body[data-ed-portal="truck"] .truck-quick-actions button {
    min-height:44px !important;
    height:44px !important;
  }
  body[data-ed-portal="truck"] .truck-quick-actions button svg,
  body[data-ed-portal="truck"] .truck-mobile-bottom-tab svg {
    stroke-width:1.7 !important;
  }

  /* Bags: shallow scanner/load-first workspace without dead middle canvas. */
  body[data-ed-portal="truck"] .truck-bag-workspace {
    width:100% !important;
    min-height:0 !important;
    height:auto !important;
  }
  body[data-ed-portal="truck"] .truck-tab-bags .truck-bag-workspace > .mt-4 {
    margin-top:8px !important;
  }
  body[data-ed-portal="truck"] .truck-tab-bags .truck-bag-workspace .space-y-3 {
    gap:8px !important;
  }
  body[data-ed-portal="truck"] .truck-tab-bags .btn-primary {
    width:100% !important;
    min-height:46px !important;
  }

  /* Map-first mobile order. DOM and route logic remain unchanged. */
  body[data-ed-portal="truck"] .truck-tab-map {
    display:flex !important;
    flex-direction:column !important;
    gap:8px !important;
  }
  body[data-ed-portal="truck"] .truck-tab-map .truck-live-map-card {
    order:1 !important;
    width:100% !important;
    min-height:0 !important;
  }
  body[data-ed-portal="truck"] .truck-tab-map .truck-map-destinations {
    order:2 !important;
    width:100% !important;
    max-height:180px !important;
    overflow:auto !important;
  }
  body[data-ed-portal="truck"] .truck-live-map-card > [class*="h-[60vh]"] {
    height:calc(100dvh - 250px) !important;
    min-height:430px !important;
  }
  body[data-ed-portal="truck"] .truck-map-controls button,
  body[data-ed-portal="truck"] .truck-map-recenter {
    min-height:44px !important;
  }
  body[data-ed-portal="truck"] .truck-map-controls button {
    height:44px !important;
    min-width:60px !important;
  }
  body[data-ed-portal="truck"] .truck-map-recenter {
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
  }
  body[data-ed-portal="truck"] .truck-map-gps-state {
    width:auto !important;
    min-width:0 !important;
    max-width:min(190px,calc(100% - 150px)) !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }

  /* Stats: flatten the lower two surfaces and guarantee full text lanes. */
  body[data-ed-portal="truck"] .truck-performance-details-grid {
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
    gap:8px !important;
  }
  body[data-ed-portal="truck"] .truck-performance-detail {
    min-width:0 !important;
    min-height:0 !important;
    padding:11px !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="truck"] .truck-performance-detail .ui-section-header-main,
  body[data-ed-portal="truck"] .truck-performance-detail .ui-section-header-copy {
    min-width:0 !important;
    width:100% !important;
  }
  body[data-ed-portal="truck"] .truck-performance-detail .ui-section-header-copy .section-title,
  body[data-ed-portal="truck"] .truck-performance-detail .ui-section-header-copy p {
    white-space:normal !important;
  }
  body[data-ed-portal="truck"] .truck-performance-detail .nums,
  body[data-ed-portal="truck"] .truck-performance-metric .ui-metric-value,
  body[data-ed-portal="truck"] .truck-status-chip p:nth-child(2) {
    font-variant-numeric:tabular-nums !important;
  }

  /* Route Assist long model output must wrap inside the mobile lane. */
  body[data-ed-portal="truck"] .truck-route-assist :where(p,pre,code) {
    max-width:100% !important;
    overflow-wrap:anywhere !important;
  }

  /* Drawer polish: v14 nav is the current DOM; footer stays pinned and group
     chevrons are hidden on Driver mobile to remove stray visual characters. */
  body[data-ed-portal="truck"] .ed-sidebar-nav-v14 {
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow-y:auto !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-group-label > svg {
    display:none !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar-footer-v8 {
    margin-top:auto !important;
    flex:0 0 auto !important;
    padding-bottom:max(10px,env(safe-area-inset-bottom)) !important;
  }

  /* Keep the assistant clear of map and bag-loading primary controls. */
  body[data-ed-portal="truck"] .truck-dashboard-root:has(#truck-main-content[data-mobile-tab="bags"]) .copilot-fab,
  body[data-ed-portal="truck"] .truck-dashboard-root:has(#truck-main-content[data-mobile-tab="map"]) .copilot-fab {
    display:none !important;
  }
}

@media (min-width:769px) and (max-width:900px) and (max-height:500px) and (orientation:landscape) {
  body[data-ed-portal="truck"] #truck-main-content {
    padding-top:10px !important;
    padding-left:10px !important;
    padding-right:10px !important;
    padding-bottom:calc(76px + env(safe-area-inset-bottom)) !important;
  }
  body[data-ed-portal="truck"] .truck-live-map-card > [class*="h-[60vh]"] {
    height:calc(100dvh - 150px) !important;
    min-height:230px !important;
  }
  body[data-ed-portal="truck"] .truck-performance-details-grid {
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
  }
}

@media (max-width:390px) {
  body[data-ed-portal="truck"] #truck-main-content {
    padding-top:160px !important;
  }
  body[data-ed-portal="truck"] .truck-performance-details-grid {
    grid-template-columns:minmax(0,1fr) !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps-copy small {
    max-width:145px !important;
  }
  body[data-ed-portal="truck"] .truck-live-map-card > [class*="h-[60vh]"] {
    min-height:400px !important;
  }
}

@media (max-width:340px) {
  body[data-ed-portal="truck"] .truck-mobile-gps-toggle {
    min-width:64px !important;
    padding-left:8px !important;
    padding-right:8px !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-gps-copy small {
    max-width:120px !important;
  }
}

/* v12.1.1 — final touch-target specificity win over legacy GPS child rule. */
@media (max-width:768px), (min-width:769px) and (max-width:900px) and (max-height:500px) and (orientation:landscape) {
  body[data-ed-portal="truck"] .truck-mobile-gps > button.truck-mobile-gps-toggle {
    min-height:44px !important;
    height:44px !important;
  }
}

/* ============================================================================
   v12.2 — DRIVER MOBILE SCREENSHOT ACCEPTANCE CORRECTION
   Presentation/interaction only. The fixed Driver header owns the top viewport;
   React now resets document scroll on destination changes, so these rules define
   one deterministic clearance and keep GPS/drawer/navigation visible and safe.
   ============================================================================ */
@media (max-width:768px), (min-width:769px) and (max-width:900px) and (max-height:500px) and (orientation:landscape) {
  /* Fixed top stack = 56px workspace row + ~51px telemetry row. Keep a small
     breathing gap; do not use per-tab offsets. */
  body[data-ed-portal="truck"] #truck-main-content {
    padding-top:116px !important;
    scroll-margin-top:0 !important;
  }

  /* GPS is the first actionable item in the content lane on every Driver tab. */
  body[data-ed-portal="truck"] #truck-main-content > .truck-mobile-gps {
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;
    position:relative !important;
    inset:auto !important;
    margin:0 0 10px !important;
    padding:7px 8px !important;
    z-index:1 !important;
  }
  body[data-ed-portal="truck"] #truck-main-content > .truck-mobile-gps .truck-mobile-gps-toggle {
    display:inline-flex !important;
    visibility:visible !important;
    min-height:44px !important;
    height:44px !important;
  }

  /* No first section/KPI may slide under the fixed header after a tab change. */
  body[data-ed-portal="truck"] #truck-main-content > .truck-tab-root {
    position:relative !important;
    top:auto !important;
    margin-top:0 !important;
  }

  /* More is a drawer trigger, never a pseudo destination. Its active treatment
     is supplied only while enterprise-layout reports the drawer as open. */
  body[data-ed-portal="truck"] .truck-mobile-bottom-tab[aria-expanded="false"] {
    color:#81858E !important;
    background:transparent !important;
  }
  body[data-ed-portal="truck"] .truck-mobile-bottom-tab[aria-expanded="true"] {
    color:var(--drv-amber) !important;
    background:rgba(245,166,35,.07) !important;
  }

  /* Keep content above the fixed navigation and floating assistant. */
  body[data-ed-portal="truck"] #truck-main-content {
    padding-bottom:calc(86px + env(safe-area-inset-bottom)) !important;
  }
  body[data-ed-portal="truck"] .copilot-fab {
    right:10px !important;
    bottom:calc(78px + env(safe-area-inset-bottom)) !important;
  }
  body[data-ed-portal="truck"].ed-mobile-drawer-is-open .copilot-fab {
    display:none !important;
  }

  /* Empty operational pages end naturally; do not manufacture giant card shells. */
  body[data-ed-portal="truck"] .truck-tab-bags,
  body[data-ed-portal="truck"] .truck-tab-maintenance,
  body[data-ed-portal="truck"] .truck-tab-route-ai {
    min-height:0 !important;
  }
}

/* On narrow portrait phones telemetry becomes 2 rows, so only the shared top
   clearance changes; tab content itself still uses the same contract. */
@media (max-width:390px) {
  body[data-ed-portal="truck"] #truck-main-content {
    padding-top:158px !important;
  }
}

/* ============================================================================
   v12.3 — DRIVER MOBILE FIXED-SHELL / CONTENT-ORIGIN CORRECTION
   UI-only. The fixed header/telemetry stack and fixed bottom navigation bound one
   authoritative scroll container (#truck-main-content). This removes dependence
   on document scroll position and guarantees every tab begins below the top stack.
   ============================================================================ */
@media (max-width:768px), (min-width:769px) and (max-width:900px) and (max-height:500px) and (orientation:landscape) {
  body[data-ed-portal="truck"] {
    --driver-mobile-top-stack:114px;
    --driver-mobile-bottom-stack:62px;
    overflow:hidden !important;
  }

  body[data-ed-portal="truck"] .truck-dashboard-root {
    height:100dvh !important;
    min-height:100dvh !important;
    max-height:100dvh !important;
    overflow:hidden !important;
    padding-bottom:0 !important;
  }

  body[data-ed-portal="truck"] .truck-dashboard-root > header.topbar {
    position:fixed !important;
    inset:0 0 auto 0 !important;
    height:var(--driver-mobile-top-stack) !important;
    max-height:var(--driver-mobile-top-stack) !important;
    overflow:hidden !important;
  }

  body[data-ed-portal="truck"] #truck-main-content {
    position:fixed !important;
    top:var(--driver-mobile-top-stack) !important;
    right:0 !important;
    bottom:calc(var(--driver-mobile-bottom-stack) + env(safe-area-inset-bottom)) !important;
    left:0 !important;
    width:100% !important;
    max-width:100% !important;
    height:auto !important;
    margin:0 !important;
    padding:10px 8px 18px !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    overscroll-behavior-y:contain !important;
    -webkit-overflow-scrolling:touch !important;
    scroll-padding-top:0 !important;
    scroll-margin-top:0 !important;
    touch-action:pan-y !important;
    z-index:1 !important;
  }

  body[data-ed-portal="truck"] #truck-main-content > .truck-mobile-gps {
    margin:0 0 10px !important;
    padding:7px 8px !important;
    flex:0 0 auto !important;
  }

  body[data-ed-portal="truck"] #truck-main-content > .truck-tab-root {
    position:relative !important;
    inset:auto !important;
    transform:none !important;
    margin-top:0 !important;
    min-width:0 !important;
  }

  body[data-ed-portal="truck"] .truck-mobile-bottom-nav {
    height:calc(var(--driver-mobile-bottom-stack) + env(safe-area-inset-bottom)) !important;
    min-height:calc(var(--driver-mobile-bottom-stack) + env(safe-area-inset-bottom)) !important;
  }

  /* With main bounded to the real viewport, map height is derived from the
     available content pane rather than from the full document viewport. */
  body[data-ed-portal="truck"] .truck-live-map-card > [class*="h-[60vh]"],
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="map"] .leaflet-container {
    height:calc(100dvh - var(--driver-mobile-top-stack) - var(--driver-mobile-bottom-stack) - 92px) !important;
    min-height:360px !important;
  }
}

@media (max-width:390px) {
  body[data-ed-portal="truck"] {
    --driver-mobile-top-stack:170px;
  }
  body[data-ed-portal="truck"] #truck-main-content {
    padding-top:10px !important;
  }
  body[data-ed-portal="truck"] .truck-live-map-card > [class*="h-[60vh]"],
  body[data-ed-portal="truck"] #truck-main-content[data-mobile-tab="map"] .leaflet-container {
    min-height:320px !important;
  }
}


/* v12.0.4 — Driver drawer header/footer enterprise polish.
   Presentation only: preserves drawer/search/navigation/logout handlers. */
@media (max-width:768px) {
  body[data-ed-portal="truck"] .ed-sidebar .ed-sidebar-header-v14 {
    min-height:68px !important;
    height:auto !important;
    padding:10px 14px !important;
    gap:10px !important;
    display:grid !important;
    grid-template-columns:36px minmax(0,1fr) 44px !important;
    align-items:center !important;
    border-bottom:1px solid rgba(255,255,255,.07) !important;
    background:#0E1220 !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-collapse-btn {
    width:32px !important;
    height:32px !important;
    justify-self:start !important;
    cursor:default !important;
    pointer-events:none !important;
    border-width:2px !important;
  }
  /* The desktop role-initial brand mark remains available on desktop but is
     intentionally removed from the mobile Driver drawer hierarchy. */
  body[data-ed-portal="truck"] .ed-sidebar .ed-mobile-drawer-brand-mark {
    display:none !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-header-text {
    display:grid !important;
    grid-template-rows:auto auto !important;
    gap:3px !important;
    min-width:0 !important;
    overflow:visible !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-header-mobile-eyebrow {
    display:block !important;
    margin:0 !important;
    color:#E7E9EE !important;
    font:700 13px/1.15 Inter,system-ui,sans-serif !important;
    letter-spacing:.015em !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-header-title {
    display:none !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-header-desktop-subtitle {
    display:block !important;
    margin:0 !important;
    color:#777F91 !important;
    font:600 10px/1.15 Inter,system-ui,sans-serif !important;
    letter-spacing:.08em !important;
    text-transform:uppercase !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-drawer-close {
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    min-height:44px !important;
    padding:0 !important;
    margin:0 !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    justify-self:end !important;
    border:0 !important;
    border-radius:10px !important;
    background:transparent !important;
    color:#A9AFBC !important;
    cursor:pointer !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-drawer-close:hover,
  body[data-ed-portal="truck"] .ed-sidebar .ed-drawer-close:focus-visible {
    background:rgba(255,255,255,.06) !important;
    color:#F2F3F5 !important;
    outline:2px solid rgba(245,166,35,.55) !important;
    outline-offset:-2px !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-search-wrap {
    padding:10px 14px 8px !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-search-input {
    min-height:44px !important;
    border-radius:9px !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-sidebar-nav-v14 {
    padding-left:14px !important;
    padding-right:14px !important;
    padding-bottom:12px !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-group-label {
    padding-left:6px !important;
    padding-right:6px !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-nav-item {
    min-height:44px !important;
    padding-left:9px !important;
    padding-right:9px !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-sidebar-footer-v8 {
    margin-top:auto !important;
    flex:0 0 auto !important;
    display:block !important;
    padding:9px 14px calc(10px + env(safe-area-inset-bottom,0px)) !important;
    border-top:1px solid rgba(255,255,255,.07) !important;
    background:#0E1220 !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-footer-avatar,
  body[data-ed-portal="truck"] .ed-sidebar .ed-footer-text {
    display:none !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-mobile-logout {
    width:100% !important;
    min-width:0 !important;
    height:48px !important;
    min-height:48px !important;
    margin:0 !important;
    padding:0 14px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    gap:9px !important;
    border:1px solid rgba(239,92,104,.32) !important;
    border-radius:10px !important;
    background:rgba(136,36,48,.10) !important;
    color:#EFA1A8 !important;
    font:600 13px/1 Inter,system-ui,sans-serif !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="truck"] .ed-sidebar .ed-mobile-logout:hover,
  body[data-ed-portal="truck"] .ed-sidebar .ed-mobile-logout:focus-visible {
    background:rgba(136,36,48,.16) !important;
    border-color:rgba(239,92,104,.48) !important;
    outline:2px solid rgba(239,92,104,.32) !important;
    outline-offset:-2px !important;
  }
}

/* ============================================================================
   v12.4 — DRIVER MOBILE PROFILE SHEET
   Presentation/modal-layer only. Profile API, auth, assigned-truck and password
   workflows remain owned by ProfileButton.tsx handlers.
   ============================================================================ */
.profile-sheet-overlay {
  position:fixed;
  inset:0;
  z-index:9000;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  background:rgba(4,6,10,.96);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  overscroll-behavior:contain;
  touch-action:auto;
}
.profile-sheet-panel {
  position:relative;
  z-index:9001;
  width:100%;
  max-height:92dvh;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  background:var(--color-ink-0,#fff);
  border-radius:18px 18px 0 0;
  box-shadow:0 -24px 70px rgba(0,0,0,.35);
  touch-action:auto;
}
.dark .profile-sheet-panel { background:var(--color-ink-900,#111318); }
.profile-sheet-header {
  position:sticky;
  top:0;
  z-index:2;
  flex:0 0 auto;
  min-height:64px;
  padding:12px 16px;
  padding-top:max(12px,env(safe-area-inset-top));
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid rgba(127,127,127,.16);
  background:inherit;
}
.profile-sheet-eyebrow,.profile-section-eyebrow {
  margin:0;
  font-size:10px;
  line-height:1.2;
  font-weight:700;
  letter-spacing:.11em;
  text-transform:uppercase;
  color:#858A95;
}
.profile-sheet-title { margin:2px 0 0; font-size:18px; line-height:1.2; font-weight:700; color:inherit; }
.profile-sheet-brand { margin:2px 0 0; font-size:10px; line-height:1.2; letter-spacing:.12em; font-weight:700; color:#F5A623; }
.profile-sheet-close {
  width:44px;
  height:44px;
  min-width:44px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:11px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:#A7ABB4;
  background:rgba(255,255,255,.035);
}
.profile-sheet-body {
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  padding:16px;
  padding-bottom:max(18px,calc(12px + env(safe-area-inset-bottom)));
  display:flex;
  flex-direction:column;
  gap:16px;
}
.profile-identity { display:flex; align-items:center; gap:14px; min-width:0; }
.profile-identity-copy { min-width:0; flex:1 1 auto; }
.profile-identity-name { margin:0; font-size:20px; line-height:1.2; font-weight:700; overflow-wrap:break-word; }
.profile-identity-email { margin:3px 0 0; font-size:13px; color:#8C919B; overflow-wrap:anywhere; }
.profile-identity-meta { margin-top:8px; display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.profile-password-date { font-size:10px; color:#777D88; }
.profile-section { border-top:1px solid rgba(127,127,127,.14); padding-top:15px; }
.profile-section-heading { margin-bottom:10px; }
.profile-section-helper { margin:3px 0 0; font-size:12px; color:#818690; }
.profile-form-grid,.profile-password-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.profile-field-wide { grid-column:1 / -1; }
.profile-bio { min-height:82px; resize:vertical; }
.profile-primary-action,.profile-secondary-action { margin-top:12px; min-height:46px; display:inline-flex; align-items:center; justify-content:center; gap:8px; }
.profile-advanced { border:1px solid rgba(127,127,127,.15); border-radius:10px; overflow:hidden; }
.profile-advanced summary { min-height:44px; padding:0 12px; display:flex; align-items:center; cursor:pointer; font-size:12px; font-weight:600; color:#9297A1; }
.profile-advanced-body { padding:0 12px 12px; }
.profile-security-trigger { width:100%; min-height:48px; display:flex; align-items:center; justify-content:space-between; gap:12px; text-align:left; }
.profile-security-trigger span { display:flex; flex-direction:column; min-width:0; }
.profile-security-trigger strong { font-size:13px; line-height:1.3; }
.profile-security-trigger small { margin-top:2px; font-size:11px; line-height:1.3; font-weight:400; color:#858A94; }
.profile-security-trigger svg { width:18px; height:18px; flex:0 0 auto; transition:transform .18s ease; }
.profile-security-trigger svg.is-open { transform:rotate(90deg); }
.profile-security-body { padding-top:10px; }

@media (min-width:769px) {
  .profile-sheet-overlay { align-items:center; padding:24px; touch-action:auto; }
  .profile-sheet-panel { max-width:672px; max-height:88vh; border-radius:18px; }
  .profile-sheet-header { padding:14px 20px; }
  .profile-sheet-body { padding:20px; }
}

@media (max-width:768px), (min-width:769px) and (max-width:900px) and (max-height:500px) and (orientation:landscape) {
  body[data-ed-portal="truck"].profile-sheet-open .truck-dashboard-root,
  body[data-ed-portal="truck"].profile-sheet-open .truck-mobile-bottom-nav,
  body[data-ed-portal="truck"].profile-sheet-open .copilot-fab,
  body[data-ed-portal="truck"].profile-sheet-open .ed-sidebar { pointer-events:none !important; }
  body[data-ed-portal="truck"].profile-sheet-open .truck-mobile-bottom-nav,
  body[data-ed-portal="truck"].profile-sheet-open .copilot-fab { visibility:hidden !important; }
  body[data-ed-portal="truck"] .profile-sheet-overlay--cargo {
    position:fixed !important;
    inset:0 !important;
    top:0 !important;
    right:0 !important;
    bottom:0 !important;
    left:0 !important;
    width:auto !important;
    height:auto !important;
    max-height:none !important;
    border-radius:0 !important;
    box-shadow:none !important;
    z-index:10000 !important;
  }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver {
    position:relative !important;
    inset:auto !important;
    top:auto !important;
    right:auto !important;
    bottom:auto !important;
    left:auto !important;
    width:100% !important;
    height:auto !important;
    z-index:10001 !important;
    height:96dvh !important;
    min-height:0 !important;
    max-height:96dvh !important;
    background:#0B0E13;
    color:#F7F8FA;
    border:1px solid rgba(255,255,255,.08);
    border-bottom:0;
    box-shadow:0 -28px 80px rgba(0,0,0,.62);
  }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-sheet-header {
    position:sticky !important;
    top:0 !important;
    right:auto !important;
    bottom:auto !important;
    left:auto !important;
    width:auto !important;
    height:auto !important;
    max-height:none !important;
    border-radius:0 !important;
    box-shadow:none !important;
    background:#0B0E13;
    border-bottom-color:rgba(255,255,255,.075);
  }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-sheet-title { font-size:17px !important; line-height:1.2 !important; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-sheet-brand { font-size:10px !important; line-height:1.2 !important; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-sheet-body {
    position:relative !important;
    inset:auto !important;
    top:auto !important;
    right:auto !important;
    bottom:auto !important;
    left:auto !important;
    width:auto !important;
    height:auto !important;
    max-height:none !important;
    border-radius:0 !important;
    box-shadow:none !important;
    padding:14px;
    padding-bottom:max(18px,calc(12px + env(safe-area-inset-bottom)));
    gap:14px;
  }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-identity--driver {
    align-items:flex-start;
    padding:13px;
    border:1px solid rgba(255,255,255,.075);
    border-radius:13px;
    background:#101319;
  }
  body[data-ed-portal="truck"] .profile-driver-role {
    display:inline-flex;
    align-items:center;
    min-height:22px;
    padding:0 8px;
    border-radius:999px;
    border:1px solid rgba(245,166,35,.25);
    background:rgba(245,166,35,.08);
    color:#F5A623;
    font-size:10px;
    line-height:1;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:.08em;
  }
  body[data-ed-portal="truck"] .profile-assigned-vehicle {
    margin-top:10px;
    padding-top:9px;
    border-top:1px solid rgba(255,255,255,.07);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
  }
  body[data-ed-portal="truck"] .profile-assigned-vehicle span { font-size:10px; text-transform:uppercase; letter-spacing:.08em; color:#747A85; }
  body[data-ed-portal="truck"] .profile-assigned-vehicle strong { min-width:0; font-size:12px; color:#F5A623; overflow-wrap:anywhere; text-align:right; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-form-grid,
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-password-grid { grid-template-columns:1fr; gap:10px; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-field-wide { grid-column:auto; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .input { min-height:44px; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-primary-action,
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-secondary-action { width:100%; min-height:48px; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-primary-action {
    background:#F5A623 !important;
    border-color:#F5A623 !important;
    color:#090B0F !important;
  }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-secondary-action { border-color:rgba(255,255,255,.12) !important; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-security-trigger {
    border:1px solid rgba(255,255,255,.08);
    border-radius:11px;
    padding:10px 12px;
    background:#101319;
    color:#F7F8FA;
  }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-security-trigger small { color:#858A94 !important; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-sheet-close {
    position:relative !important;
    inset:auto !important;
    top:auto !important;
    right:auto !important;
    bottom:auto !important;
    left:auto !important;
    max-height:none !important;
    box-shadow:none !important;
    flex:0 0 44px;
  }
}

@media (max-width:340px) {
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-sheet-header { padding-left:12px; padding-right:12px; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-sheet-body { padding-left:12px; padding-right:12px; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-identity--driver { gap:10px; padding:11px; }
  body[data-ed-portal="truck"] .profile-sheet-panel--driver .profile-identity-name { font-size:18px; }
}

/* ============================================================================
   v12.7 — DRIVER COCONNECT COPILOT MOBILE OPERATIONS UI
   Presentation only. AI/voice/knowledge endpoints and agent routing are unchanged.
   ============================================================================ */
@media (max-width:768px), (min-width:769px) and (max-width:900px) and (max-height:500px) and (orientation:landscape) {
  body[data-ed-portal="truck"] .copilot-fab--driver {
    width:48px !important; min-width:48px !important; max-width:48px !important;
    height:48px !important; min-height:48px !important; max-height:48px !important;
    right:10px !important; bottom:calc(78px + env(safe-area-inset-bottom,0px)) !important;
    border-radius:12px !important; background:#F5A623 !important; color:#111318 !important;
    border:1px solid rgba(245,166,35,.42) !important; box-shadow:0 10px 28px rgba(0,0,0,.32) !important;
    transform:none !important;
  }
  body[data-ed-portal="truck"] .copilot-fab--driver:hover { transform:none !important; background:#FFB22C !important; }

  body[data-ed-portal="truck"].copilot-sheet-open { overflow:hidden !important; }
  body[data-ed-portal="truck"].copilot-sheet-open .truck-dashboard-root,
  body[data-ed-portal="truck"].copilot-sheet-open .truck-mobile-bottom-nav,
  body[data-ed-portal="truck"].copilot-sheet-open .ed-sidebar { pointer-events:none !important; }
  body[data-ed-portal="truck"].copilot-sheet-open .truck-mobile-bottom-nav,
  body[data-ed-portal="truck"].copilot-sheet-open .copilot-fab { visibility:hidden !important; }

  body[data-ed-portal="truck"] .ent-copilot-driver-overlay {
    position:fixed !important; inset:0 !important; z-index:9000 !important;
    width:100vw !important; height:100dvh !important; max-width:none !important; max-height:none !important;
    display:flex !important; align-items:stretch !important; justify-content:stretch !important;
    background:rgba(3,5,8,.82) !important; backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
    color-scheme:dark; overflow:hidden !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-panel {
    position:relative !important; inset:auto !important; width:100% !important; height:100dvh !important;
    max-width:none !important; max-height:none !important; min-height:0 !important;
    margin:0 !important; border:0 !important; border-radius:0 !important; box-shadow:none !important;
    background:#090C11 !important; color:#F6F7F9 !important;
    display:grid !important; grid-template-rows:auto auto minmax(0,1fr) auto auto !important;
    overflow:hidden !important; z-index:9001 !important;
    padding-top:env(safe-area-inset-top,0px) !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-header {
    min-height:64px; padding:8px 10px 8px 12px; display:flex; align-items:center; justify-content:space-between; gap:10px;
    border-bottom:1px solid rgba(255,255,255,.07); background:#0B0E14;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-brand { min-width:0; display:flex; align-items:center; gap:10px; }
  body[data-ed-portal="truck"] .ent-copilot-driver-brand-icon { width:36px; height:36px; flex:0 0 36px; display:grid; place-items:center; border-radius:10px; color:#F5A623; background:rgba(245,166,35,.09); border:1px solid rgba(245,166,35,.18); }
  body[data-ed-portal="truck"] .ent-copilot-driver-brand > div { min-width:0; }
  body[data-ed-portal="truck"] .ent-copilot-driver-brand strong { display:block; color:#F8F8FA; font-size:13px; line-height:1.25; font-weight:750; letter-spacing:.04em; white-space:nowrap; }
  body[data-ed-portal="truck"] .ent-copilot-driver-brand small { display:block; margin-top:2px; color:#838995; font-size:10.5px; line-height:1.25; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  body[data-ed-portal="truck"] .ent-copilot-driver-close { width:44px; height:44px; min-width:44px; display:grid; place-items:center; border:0; border-radius:10px; color:#A7ABB4; background:transparent; }
  body[data-ed-portal="truck"] .ent-copilot-driver-close:hover { color:#F4F5F7; background:rgba(255,255,255,.06); }

  body[data-ed-portal="truck"] .ent-copilot-driver-agents {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; padding:8px 10px; background:#0B0E14; border-bottom:1px solid rgba(255,255,255,.07);
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-agents button {
    min-width:0; min-height:44px; display:flex; align-items:center; justify-content:center; gap:7px; border-radius:10px;
    border:1px solid rgba(255,255,255,.07); background:#10141B; color:#9399A5; font-size:12px; font-weight:650;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-agents button.is-active { color:#F5A623; border-color:rgba(245,166,35,.32); background:rgba(245,166,35,.08); }

  body[data-ed-portal="truck"] .ent-copilot-driver-messages {
    min-height:0; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
    padding:14px 12px 20px; background:#090C11; scroll-padding-bottom:20px;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-welcome { max-width:430px; margin:7vh auto 0; text-align:center; }
  body[data-ed-portal="truck"] .ent-copilot-driver-welcome-icon { width:44px; height:44px; margin:0 auto 12px; display:grid; place-items:center; border-radius:12px; color:#F5A623; background:#11161E; border:1px solid rgba(255,255,255,.07); }
  body[data-ed-portal="truck"] .ent-copilot-driver-welcome h3 { margin:0; color:#F3F4F6; font-size:17px; line-height:1.3; font-weight:720; }
  body[data-ed-portal="truck"] .ent-copilot-driver-welcome p { margin:7px auto 0; max-width:340px; color:#7D8490; font-size:12px; line-height:1.5; }
  body[data-ed-portal="truck"] .ent-copilot-driver-prompts { display:grid; gap:7px; margin-top:18px; }
  body[data-ed-portal="truck"] .ent-copilot-driver-prompts button { min-height:44px; width:100%; padding:9px 12px; border-radius:10px; border:1px solid rgba(255,255,255,.07); background:#0F131A; color:#C7CBD2; text-align:left; font-size:12px; line-height:1.35; }
  body[data-ed-portal="truck"] .ent-copilot-driver-prompts button:hover { border-color:rgba(245,166,35,.22); color:#F0F1F3; }

  body[data-ed-portal="truck"] .ent-copilot-driver-message-row { display:flex; margin:0 0 10px; min-width:0; }
  body[data-ed-portal="truck"] .ent-copilot-driver-message-row.is-user { justify-content:flex-end; }
  body[data-ed-portal="truck"] .ent-copilot-driver-message-row.is-assistant { justify-content:flex-start; }
  body[data-ed-portal="truck"] .ent-copilot-driver-message-row.is-status { justify-content:center; }
  body[data-ed-portal="truck"] .ent-copilot-driver-bubble { max-width:min(88%,560px); min-width:0; padding:9px 11px; border-radius:12px; font-size:13px; line-height:1.48; overflow-wrap:anywhere; word-break:normal; }
  body[data-ed-portal="truck"] .ent-copilot-driver-bubble.is-user { color:#17130B; background:#F5A623; border:1px solid #F5A623; }
  body[data-ed-portal="truck"] .ent-copilot-driver-bubble.is-assistant { color:#D9DCE1; background:#10141B; border:1px solid rgba(255,255,255,.075); }
  body[data-ed-portal="truck"] .ent-copilot-driver-message-meta { min-height:24px; margin:-2px 0 5px; display:flex; align-items:center; justify-content:space-between; gap:8px; color:#777E8B; font-size:9.5px; font-weight:700; letter-spacing:.08em; }
  body[data-ed-portal="truck"] .ent-copilot-driver-message-meta button { width:44px; height:44px; display:grid; place-items:center; border:0; border-radius:8px; color:#8C929E; background:transparent; }
  body[data-ed-portal="truck"] .ent-copilot-driver-message-content { white-space:pre-wrap; overflow-wrap:anywhere; word-break:normal; }
  body[data-ed-portal="truck"] .ent-copilot-driver-evidence { margin-top:6px; color:#737986; font-size:10px; }
  body[data-ed-portal="truck"] .ent-copilot-driver-status { min-height:34px; padding:6px 10px; display:inline-flex; align-items:center; gap:7px; border-radius:999px; background:#11161E; border:1px solid rgba(255,255,255,.07); color:#9096A1; font-size:11px; }
  body[data-ed-portal="truck"] .ent-copilot-driver-spinner { width:12px; height:12px; flex:0 0 12px; border:1.5px solid rgba(245,166,35,.25); border-top-color:#F5A623; border-radius:50%; animation:driver-copilot-spin .8s linear infinite; }
  @keyframes driver-copilot-spin { to { transform:rotate(360deg); } }

  body[data-ed-portal="truck"] .ent-copilot-driver-knowledge { max-height:150px; overflow-y:auto; padding:9px 12px; background:#0D1117; border-top:1px solid rgba(255,255,255,.07); color:#A5AAB4; }
  body[data-ed-portal="truck"] .ent-copilot-driver-knowledge > div { display:flex; align-items:center; gap:7px; font-size:11px; }
  body[data-ed-portal="truck"] .ent-copilot-driver-knowledge > div span { margin-left:auto; color:#747B87; }
  body[data-ed-portal="truck"] .ent-copilot-driver-knowledge p { margin:7px 0 0; padding-top:7px; border-top:1px solid rgba(255,255,255,.05); font-size:10.5px; line-height:1.4; }
  body[data-ed-portal="truck"] .ent-copilot-driver-knowledge > button { min-height:36px; margin-top:6px; border:0; background:transparent; color:#F5A623; font-size:11px; }

  body[data-ed-portal="truck"] .ent-copilot-driver-secondary-toolbar { min-height:54px; padding:5px 10px; display:flex; align-items:center; justify-content:space-between; gap:8px; background:#0B0E14; border-top:1px solid rgba(255,255,255,.07); }
  body[data-ed-portal="truck"] .ent-copilot-driver-language { position:relative; min-width:0; height:44px; display:flex; align-items:center; gap:6px; padding:0 7px 0 9px; border:1px solid rgba(255,255,255,.07); border-radius:9px; color:#858C98; background:#10141B; }
  body[data-ed-portal="truck"] .ent-copilot-driver-language select { min-width:92px; height:42px; padding:0 20px 0 0 !important; border:0; outline:0; appearance:none; background:none !important; color:#AEB3BC; font-size:11px; }
  body[data-ed-portal="truck"] .ent-copilot-driver-language > svg:last-child { position:absolute; right:5px; pointer-events:none; }
  body[data-ed-portal="truck"] .ent-copilot-driver-knowledge-button { min-height:44px; padding:0 10px; display:inline-flex; align-items:center; gap:6px; border:1px solid rgba(255,255,255,.07); border-radius:9px; color:#8E949F; background:#10141B; font-size:11px; }
  body[data-ed-portal="truck"] .ent-copilot-driver-knowledge-button:disabled { opacity:.4; }

  body[data-ed-portal="truck"] .ent-copilot-driver-composer {
    min-height:64px; padding:7px 10px max(7px,env(safe-area-inset-bottom,0px)); display:grid; grid-template-columns:44px minmax(0,1fr) 44px; align-items:center; gap:7px;
    background:#0B0E14; border-top:1px solid rgba(255,255,255,.07);
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-composer button { width:44px; height:44px; display:grid; place-items:center; border-radius:10px; border:1px solid rgba(255,255,255,.07); background:#11161E; color:#9299A5; }
  body[data-ed-portal="truck"] .ent-copilot-driver-composer button.is-listening { color:#F87171; border-color:rgba(248,113,113,.35); background:rgba(248,113,113,.08); }
  body[data-ed-portal="truck"] .ent-copilot-driver-composer button.is-send { color:#17130B; border-color:#F5A623; background:#F5A623; }
  body[data-ed-portal="truck"] .ent-copilot-driver-composer button:disabled { opacity:.42; }
  body[data-ed-portal="truck"] .ent-copilot-driver-composer input { width:100%; min-width:0; height:44px; padding:0 12px; border:1px solid rgba(255,255,255,.08); border-radius:10px; outline:0; background:#10141B; color:#E8EAED; font-size:13px; }
  body[data-ed-portal="truck"] .ent-copilot-driver-composer input:focus { border-color:rgba(245,166,35,.48); box-shadow:0 0 0 2px rgba(245,166,35,.08); }

  body[data-ed-portal="truck"] .ent-copilot-driver-panel button:focus-visible,
  body[data-ed-portal="truck"] .ent-copilot-driver-panel select:focus-visible,
  body[data-ed-portal="truck"] .ent-copilot-driver-panel input:focus-visible { outline:2px solid #F5A623; outline-offset:2px; }
}

@media (min-width:769px) and (min-height:501px) {
  body[data-ed-portal="truck"] .copilot-fab--driver { border-radius:12px !important; }
}


/* ==========================================================================\n   DRIVER COPILOT FINAL MOBILE CONTRACT — PASS 8\n   Presentation only. Hardens the Driver-only Copilot hierarchy against broad\n   legacy/global mobile selectors and matches authenticated 521x872 runtime.\n   ========================================================================== */
@media (max-width: 768px), (max-height: 500px) and (pointer: coarse) {
  body[data-ed-portal="truck"] .ent-copilot-driver-panel {
    grid-template-rows:auto auto minmax(0,1fr) auto auto !important;
  }

  /* The two real Driver agents must always remain visible. */
  body[data-ed-portal="truck"] .ent-copilot-driver-panel > .ent-copilot-driver-agents {
    display:grid !important;
    visibility:visible !important;
    opacity:1 !important;
    position:relative !important;
    inset:auto !important;
    transform:none !important;
    width:auto !important;
    height:auto !important;
    min-height:60px !important;
    max-height:none !important;
    margin:0 !important;
    padding:8px 10px !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:6px !important;
    align-items:center !important;
    overflow:visible !important;
    z-index:2 !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-agents > button {
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;
    min-width:0 !important;
    width:100% !important;
    min-height:44px !important;
    height:44px !important;
    margin:0 !important;
    padding:0 12px !important;
    position:relative !important;
    inset:auto !important;
    transform:none !important;
  }

  /* Empty conversation: compact, top-weighted, no duplicated assistant mark. */
  body[data-ed-portal="truck"] .ent-copilot-driver-messages {
    display:flex !important;
    flex-direction:column !important;
    justify-content:flex-start !important;
    min-height:0 !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-welcome {
    width:100% !important;
    max-width:430px !important;
    margin:18px auto 0 !important;
    padding:0 !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-welcome-icon { display:none !important; }
  body[data-ed-portal="truck"] .ent-copilot-driver-welcome h3 {
    font-size:16px !important;
    line-height:1.3 !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-prompts {
    margin-top:14px !important;
    gap:7px !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-prompts button {
    min-height:44px !important;
    display:flex !important;
    align-items:center !important;
  }

  /* One deliberate utility strip directly above the composer. */
  body[data-ed-portal="truck"] .ent-copilot-driver-secondary-toolbar {
    display:flex !important;
    visibility:visible !important;
    align-items:center !important;
    justify-content:space-between !important;
    min-height:56px !important;
    height:56px !important;
    padding:6px 10px !important;
    gap:8px !important;
    margin:0 !important;
    position:relative !important;
    inset:auto !important;
    transform:none !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-language,
  body[data-ed-portal="truck"] .ent-copilot-driver-knowledge-button {
    height:44px !important;
    min-height:44px !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-knowledge-button:not(:disabled) {
    color:#B7BCC5 !important;
    border-color:rgba(255,255,255,.10) !important;
    background:#11161E !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-knowledge-button:disabled {
    opacity:.58 !important;
    color:#6F7682 !important;
    cursor:not-allowed !important;
  }

  /* Optical clarity without increasing the touch footprint. */
  body[data-ed-portal="truck"] .ent-copilot-driver-close svg {
    width:18px !important;
    height:18px !important;
  }
  body[data-ed-portal="truck"] .ent-copilot-driver-composer button.is-send svg {
    width:18px !important;
    height:18px !important;
  }

  /* Never let the welcome/utility/composer layers overlap one another. */
  body[data-ed-portal="truck"] .ent-copilot-driver-messages,
  body[data-ed-portal="truck"] .ent-copilot-driver-secondary-toolbar,
  body[data-ed-portal="truck"] .ent-copilot-driver-composer {
    position:relative !important;
    inset:auto !important;
    transform:none !important;
  }
}


/* ═══════════════════════════════════════════════════════════════════════
   FIELD AGENT MOBILE FINAL POLISH — Copilot / Drawer / Guided Onboarding
   Presentation only. Existing React handlers, APIs and role permissions remain authoritative.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px), (max-width: 900px) and (max-height: 480px) {
  /* Drawer header: one workspace identity + COCONNECT, no duplicated title. */
  body[data-ed-portal="agent"] .ed-sidebar .ed-sidebar-header-v14 {
    min-height:68px !important;
    padding:8px 10px 8px 12px !important;
    gap:9px !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar .ed-header-text { min-width:0 !important; }
  body[data-ed-portal="agent"] .ed-sidebar .ed-header-mobile-eyebrow {
    display:block !important;
    color:#F5F5F6 !important;
    font-size:11px !important;
    line-height:1.15 !important;
    font-weight:750 !important;
    letter-spacing:.055em !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar .ed-header-title { display:none !important; }
  body[data-ed-portal="agent"] .ed-sidebar .ed-header-desktop-subtitle {
    display:block !important;
    margin-top:3px !important;
    color:#747780 !important;
    font-size:9px !important;
    line-height:1.15 !important;
    letter-spacing:.11em !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar .ed-drawer-close {
    display:grid !important;
    place-items:center !important;
    flex:0 0 44px !important;
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    min-height:44px !important;
    margin-left:auto !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-footer-v8 {
    display:grid !important;
    grid-template-columns:36px minmax(0,1fr) !important;
    grid-template-rows:auto 48px !important;
    gap:8px 9px !important;
    align-items:center !important;
    padding:9px 10px calc(10px + env(safe-area-inset-bottom,0px)) !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-footer-v8 .ed-footer-avatar { grid-column:1; grid-row:1; }
  body[data-ed-portal="agent"] .ed-sidebar-footer-v8 .ed-footer-text { grid-column:2; grid-row:1; min-width:0 !important; }
  body[data-ed-portal="agent"] .ed-sidebar-footer-v8 .ed-mobile-logout {
    grid-column:1 / -1 !important;
    grid-row:2 !important;
    width:100% !important;
    min-width:0 !important;
    min-height:48px !important;
    height:48px !important;
    margin:0 !important;
    justify-content:center !important;
    border:1px solid rgba(248,113,113,.28) !important;
    background:rgba(248,113,113,.055) !important;
    color:#E8A0A0 !important;
  }

  /* Guided registration owns the viewport and has exactly one internal scroll lane. */
  body[data-ed-portal="agent"]:has(.agent-register-modal) { overflow:hidden !important; }
  body[data-ed-portal="agent"] .agent-register-modal { z-index:120 !important; }
  body[data-ed-portal="agent"] .agent-register-panel {
    display:flex !important;
    flex-direction:column !important;
    overflow:hidden !important;
    height:100dvh !important;
    min-height:100dvh !important;
    max-height:100dvh !important;
    padding-top:env(safe-area-inset-top,0px) !important;
  }
  body[data-ed-portal="agent"] .agent-register-panel > div:first-of-type {
    position:relative !important;
    top:auto !important;
    flex:0 0 auto !important;
    min-height:58px !important;
    padding:7px 12px !important;
  }
  body[data-ed-portal="agent"] .agent-register-panel > div:nth-of-type(2) {
    display:flex !important;
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow:hidden !important;
    padding:0 12px !important;
  }
  body[data-ed-portal="agent"] .agent-register-wizard {
    width:100% !important;
    height:100% !important;
    min-height:0 !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] .agent-register-step-header {
    position:relative !important;
    top:auto !important;
    flex:0 0 auto !important;
    padding:8px 0 9px !important;
    margin:0 !important;
  }
  body[data-ed-portal="agent"] .agent-register-step-header h4,
  body[data-ed-portal="agent"] .agent-register-step-header p {
    white-space:normal !important;
    overflow:visible !important;
    text-overflow:clip !important;
  }
  body[data-ed-portal="agent"] .agent-register-step-body {
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    overscroll-behavior:contain !important;
    padding:10px 0 14px !important;
    scrollbar-width:thin !important;
  }
  body[data-ed-portal="agent"] .agent-register-footer {
    position:relative !important;
    bottom:auto !important;
    flex:0 0 auto !important;
    margin:0 -12px !important;
    padding:8px 12px max(8px,env(safe-area-inset-bottom,0px)) !important;
  }
  body[data-ed-portal="agent"] .agent-register-footer button { min-height:48px !important; }

  /* Field Agent Copilot: top-level, operations-specific and mobile-safe. */
  body[data-ed-portal="agent"].copilot-sheet-open { overflow:hidden !important; }
  body[data-ed-portal="agent"].copilot-sheet-open .agent-mobile-bottom-nav,
  body[data-ed-portal="agent"].copilot-sheet-open .ed-mobile-workspace-trigger,
  body[data-ed-portal="agent"].copilot-sheet-open .copilot-fab,
  body[data-ed-portal="agent"].copilot-sheet-open .topbar {
    visibility:hidden !important;
    pointer-events:none !important;
  }
  body[data-ed-portal="agent"] .ent-copilot-agent-overlay {
    position:fixed !important;
    inset:0 !important;
    z-index:150 !important;
    width:100vw !important;
    height:100dvh !important;
    display:block !important;
    background:#080B10 !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="agent"] .ent-copilot-agent-panel {
    position:relative !important;
    inset:auto !important;
    width:100vw !important;
    height:100dvh !important;
    min-height:100dvh !important;
    max-width:none !important;
    max-height:none !important;
    margin:0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:#080B10 !important;
    color:#E8EAED !important;
    display:grid !important;
    grid-template-rows:auto auto minmax(0,1fr) auto auto !important;
    overflow:hidden !important;
    box-shadow:none !important;
    padding:env(safe-area-inset-top,0px) 0 0 !important;
  }
  body[data-ed-portal="agent"] .ent-copilot-agent-header {
    min-height:62px !important;
    padding:7px 10px 7px 12px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:10px !important;
    border-bottom:1px solid rgba(255,255,255,.07) !important;
    background:#090C11 !important;
  }
  body[data-ed-portal="agent"] .ent-copilot-agent-brand { display:flex !important; align-items:center !important; gap:9px !important; min-width:0 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-brand-icon {
    width:36px !important; height:36px !important; flex:0 0 36px !important; display:grid !important; place-items:center !important;
    border-radius:10px !important; color:#F5A623 !important; background:rgba(245,166,35,.09) !important; border:1px solid rgba(245,166,35,.20) !important;
  }
  body[data-ed-portal="agent"] .ent-copilot-agent-brand > div { min-width:0 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-brand strong { display:block !important; color:#F8F8FA !important; font-size:13px !important; line-height:1.2 !important; font-weight:760 !important; letter-spacing:.045em !important; white-space:nowrap !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-brand small { display:block !important; margin-top:2px !important; color:#858B96 !important; font-size:10.5px !important; line-height:1.2 !important; white-space:nowrap !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-close {
    width:44px !important; height:44px !important; min-width:44px !important; display:grid !important; place-items:center !important; border:0 !important; border-radius:10px !important; background:transparent !important; color:#A2A8B3 !important;
  }
  body[data-ed-portal="agent"] .ent-copilot-agent-selector {
    min-height:58px !important; padding:7px 10px !important; display:grid !important; grid-template-columns:auto minmax(0,1fr) !important; align-items:center !important; gap:9px !important; border-bottom:1px solid rgba(255,255,255,.07) !important; background:#0B0E14 !important;
  }
  body[data-ed-portal="agent"] .ent-copilot-agent-selector > label { color:#717885 !important; font-size:9px !important; font-weight:750 !important; letter-spacing:.10em !important; text-transform:uppercase !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-select-wrap {
    position:relative !important; min-width:0 !important; height:44px !important; display:grid !important; grid-template-columns:20px minmax(0,1fr) 18px !important; align-items:center !important; gap:6px !important; padding:0 9px !important; border:1px solid rgba(255,255,255,.08) !important; border-radius:10px !important; background:#10141B !important; color:#F5A623 !important;
  }
  body[data-ed-portal="agent"] .ent-copilot-agent-select-wrap select { width:100% !important; min-width:0 !important; height:42px !important; border:0 !important; outline:0 !important; appearance:none !important; background:transparent !important; color:#D7DAE0 !important; font-size:12px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-messages {
    min-height:0 !important; overflow-y:auto !important; overflow-x:hidden !important; overscroll-behavior:contain !important; padding:12px 10px 16px !important; background:#080B10 !important;
  }
  body[data-ed-portal="agent"] .ent-copilot-agent-welcome { max-width:430px !important; margin:18px auto 0 !important; text-align:center !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-welcome h3 { margin:0 !important; color:#F1F3F5 !important; font-size:16px !important; line-height:1.3 !important; font-weight:730 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-welcome p { margin:7px auto 0 !important; max-width:360px !important; color:#7E8591 !important; font-size:11.5px !important; line-height:1.45 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-prompts { display:grid !important; gap:7px !important; margin-top:16px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-prompts button {
    width:100% !important; min-height:44px !important; padding:9px 12px !important; border:1px solid rgba(255,255,255,.075) !important; border-radius:10px !important; background:#10141B !important; color:#C8CCD3 !important; text-align:left !important; font-size:12px !important; line-height:1.35 !important;
  }
  body[data-ed-portal="agent"] .ent-copilot-agent-message-row { display:flex !important; margin:0 0 10px !important; min-width:0 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-message-row.is-user { justify-content:flex-end !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-message-row.is-assistant { justify-content:flex-start !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-message-row.is-status { justify-content:center !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-bubble { max-width:min(88%,580px) !important; min-width:0 !important; padding:9px 11px !important; border-radius:12px !important; font-size:13px !important; line-height:1.48 !important; overflow-wrap:anywhere !important; word-break:normal !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-bubble.is-user { color:#17130B !important; background:#F5A623 !important; border:1px solid #F5A623 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-bubble.is-assistant { color:#D9DCE1 !important; background:#10141B !important; border:1px solid rgba(255,255,255,.075) !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-message-meta { min-height:30px !important; margin:-2px 0 4px !important; display:flex !important; align-items:center !important; justify-content:space-between !important; gap:8px !important; color:#777E8B !important; font-size:9.5px !important; font-weight:700 !important; letter-spacing:.08em !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-message-meta button { width:44px !important; height:44px !important; display:grid !important; place-items:center !important; border:0 !important; border-radius:8px !important; color:#8C929E !important; background:transparent !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-message-content { white-space:pre-wrap !important; overflow-wrap:anywhere !important; word-break:normal !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-evidence { margin-top:6px !important; color:#737986 !important; font-size:10px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-status { min-height:34px !important; padding:6px 10px !important; display:inline-flex !important; align-items:center !important; gap:7px !important; border-radius:999px !important; background:#11161E !important; border:1px solid rgba(255,255,255,.07) !important; color:#9096A1 !important; font-size:11px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-spinner { width:12px !important; height:12px !important; flex:0 0 12px !important; border:1.5px solid rgba(245,166,35,.25) !important; border-top-color:#F5A623 !important; border-radius:50% !important; animation:agent-copilot-spin .8s linear infinite !important; }
  @keyframes agent-copilot-spin { to { transform:rotate(360deg); } }
  body[data-ed-portal="agent"] .ent-copilot-agent-knowledge { max-height:150px !important; overflow-y:auto !important; padding:9px 12px !important; background:#0D1117 !important; border-top:1px solid rgba(255,255,255,.07) !important; color:#A5AAB4 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-knowledge > div { display:flex !important; align-items:center !important; gap:7px !important; font-size:11px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-knowledge > div span { margin-left:auto !important; color:#747B87 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-knowledge p { margin:7px 0 0 !important; padding-top:7px !important; border-top:1px solid rgba(255,255,255,.05) !important; font-size:10.5px !important; line-height:1.4 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-knowledge > button { min-height:36px !important; margin-top:6px !important; border:0 !important; background:transparent !important; color:#F5A623 !important; font-size:11px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-secondary-toolbar { min-height:54px !important; padding:5px 10px !important; display:flex !important; align-items:center !important; justify-content:space-between !important; gap:8px !important; border-top:1px solid rgba(255,255,255,.07) !important; background:#0B0E14 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-language { position:relative !important; min-width:0 !important; height:44px !important; display:flex !important; align-items:center !important; gap:6px !important; padding:0 7px 0 9px !important; border:1px solid rgba(255,255,255,.07) !important; border-radius:9px !important; color:#858C98 !important; background:#10141B !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-language select { min-width:92px !important; height:42px !important; padding:0 20px 0 0 !important; border:0 !important; outline:0 !important; appearance:none !important; background:transparent !important; color:#AEB3BC !important; font-size:11px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-language > svg:last-child { position:absolute !important; right:5px !important; pointer-events:none !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-knowledge-button { min-height:44px !important; padding:0 10px !important; display:inline-flex !important; align-items:center !important; gap:6px !important; border:1px solid rgba(255,255,255,.07) !important; border-radius:9px !important; color:#8E949F !important; background:#10141B !important; font-size:11px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-knowledge-button:disabled { opacity:.42 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-composer { min-height:58px !important; padding:7px 10px max(7px,env(safe-area-inset-bottom,0px)) !important; display:grid !important; grid-template-columns:44px minmax(0,1fr) 44px !important; align-items:center !important; gap:7px !important; border-top:1px solid rgba(255,255,255,.07) !important; background:#090C11 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-composer button { width:44px !important; height:44px !important; min-width:44px !important; display:grid !important; place-items:center !important; border-radius:10px !important; border:1px solid rgba(255,255,255,.07) !important; background:#11161E !important; color:#9299A5 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-composer button.is-listening { color:#F87171 !important; border-color:rgba(248,113,113,.35) !important; background:rgba(248,113,113,.08) !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-composer button.is-send { color:#17130B !important; border-color:#F5A623 !important; background:#F5A623 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-composer button:disabled { opacity:.42 !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-composer input { width:100% !important; min-width:0 !important; height:44px !important; padding:0 12px !important; border:1px solid rgba(255,255,255,.08) !important; border-radius:10px !important; outline:0 !important; background:#10141B !important; color:#E8EAED !important; font-size:13px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-panel button:focus-visible,
  body[data-ed-portal="agent"] .ent-copilot-agent-panel select:focus-visible,
  body[data-ed-portal="agent"] .ent-copilot-agent-panel input:focus-visible { outline:2px solid #F5A623 !important; outline-offset:2px !important; }
  body[data-ed-portal="agent"] .copilot-fab--agent {
    width:44px !important; height:44px !important; min-width:44px !important; min-height:44px !important; border-radius:12px !important; background:#F5A623 !important; color:#17130B !important; box-shadow:0 4px 14px rgba(0,0,0,.24) !important;
  }
}

@media (max-width: 360px) {
  body[data-ed-portal="agent"] .ent-copilot-agent-selector { grid-template-columns:1fr !important; gap:4px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-selector > label { display:none !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-brand small { max-width:210px !important; overflow:hidden !important; text-overflow:ellipsis !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-secondary-toolbar { gap:6px !important; }
  body[data-ed-portal="agent"] .ent-copilot-agent-language select { min-width:78px !important; }
}

/* Field Agent compact-landscape hardening for modal/drawer targets. */
@media (max-width: 900px) and (max-height: 480px) {
  body[data-ed-portal="agent"].ed-mobile-portal-active .ed-sidebar {
    position:fixed !important;
    inset:0 auto 0 0 !important;
    width:min(82vw,312px) !important;
    max-width:312px !important;
    height:100dvh !important;
    min-height:100dvh !important;
    max-height:100dvh !important;
    display:flex !important;
    flex-direction:column !important;
    overflow:hidden !important;
    padding-top:env(safe-area-inset-top,0px) !important;
  }
  body[data-ed-portal="agent"] .ed-sidebar-nav-v14 { flex:1 1 auto !important; min-height:0 !important; overflow-y:auto !important; }
  body[data-ed-portal="agent"] .agent-register-close { min-width:76px !important; height:44px !important; min-height:44px !important; padding:0 12px !important; }
  body[data-ed-portal="agent"] .agent-register-wizard { display:flex !important; flex-direction:column !important; height:100% !important; min-height:0 !important; }
  body[data-ed-portal="agent"] .agent-register-step-body { flex:1 1 0% !important; min-height:0 !important; overflow-y:auto !important; }
  body[data-ed-portal="agent"] .agent-register-footer { flex:0 0 auto !important; }
}
@media (max-width: 768px), (max-width: 900px) and (max-height: 480px) {
  body[data-ed-portal="agent"] .agent-register-panel > div:first-of-type p,
  body[data-ed-portal="agent"] .agent-register-panel > div:first-of-type h3,
  body[data-ed-portal="agent"] .agent-register-step-header p,
  body[data-ed-portal="agent"] .agent-register-step-header h4 { margin:0 !important; }
}

/* ============================================================================
   v15.0 — FARMER MOBILE COPILOT + DRAWER + PROFILE PRESENTATION
   Farmer business/API logic remains in existing React handlers.
   ============================================================================ */
@media (max-width: 768px) {
  /* Farmer Copilot: top-level, operations-specific and mobile-safe. */
  body[data-ed-portal="farmer"].copilot-sheet-open { overflow:hidden !important; }
  body[data-ed-portal="farmer"].copilot-sheet-open .farmer-mobile-bottom-nav,
  body[data-ed-portal="farmer"].copilot-sheet-open .ed-mobile-workspace-trigger,
  body[data-ed-portal="farmer"].copilot-sheet-open .copilot-fab,
  body[data-ed-portal="farmer"].copilot-sheet-open .topbar {
    visibility:hidden !important;
    pointer-events:none !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-overlay {
    position:fixed !important;
    inset:0 !important;
    z-index:150 !important;
    width:100vw !important;
    height:100dvh !important;
    display:block !important;
    background:#080B10 !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-panel {
    position:relative !important;
    inset:auto !important;
    width:100vw !important;
    height:100dvh !important;
    min-height:100dvh !important;
    max-width:none !important;
    max-height:none !important;
    margin:0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:#080B10 !important;
    color:#E8EAED !important;
    display:grid !important;
    grid-template-rows:auto auto minmax(0,1fr) auto auto !important;
    overflow:hidden !important;
    box-shadow:none !important;
    padding:env(safe-area-inset-top,0px) 0 0 !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-header {
    min-height:62px !important;
    padding:7px 10px 7px 12px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:space-between !important;
    gap:10px !important;
    border-bottom:1px solid rgba(255,255,255,.07) !important;
    background:#090C11 !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-brand { display:flex !important; align-items:center !important; gap:9px !important; min-width:0 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-brand-icon {
    width:36px !important; height:36px !important; flex:0 0 36px !important; display:grid !important; place-items:center !important;
    border-radius:10px !important; color:#F5A623 !important; background:rgba(245,166,35,.09) !important; border:1px solid rgba(245,166,35,.20) !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-brand > div { min-width:0 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-brand strong { display:block !important; color:#F8F8FA !important; font-size:13px !important; line-height:1.2 !important; font-weight:760 !important; letter-spacing:.045em !important; white-space:nowrap !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-brand small { display:block !important; margin-top:2px !important; color:#858B96 !important; font-size:10.5px !important; line-height:1.2 !important; white-space:nowrap !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-close {
    width:44px !important; height:44px !important; min-width:44px !important; display:grid !important; place-items:center !important; border:0 !important; border-radius:10px !important; background:transparent !important; color:#A2A8B3 !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-selector {
    min-height:58px !important; padding:7px 10px !important; display:grid !important; grid-template-columns:auto minmax(0,1fr) !important; align-items:center !important; gap:9px !important; border-bottom:1px solid rgba(255,255,255,.07) !important; background:#0B0E14 !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-selector > label { color:#717885 !important; font-size:9px !important; font-weight:750 !important; letter-spacing:.10em !important; text-transform:uppercase !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-select-wrap {
    position:relative !important; min-width:0 !important; height:44px !important; display:grid !important; grid-template-columns:20px minmax(0,1fr) 18px !important; align-items:center !important; gap:6px !important; padding:0 9px !important; border:1px solid rgba(255,255,255,.08) !important; border-radius:10px !important; background:#10141B !important; color:#F5A623 !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-select-wrap select { width:100% !important; min-width:0 !important; height:42px !important; border:0 !important; outline:0 !important; appearance:none !important; background:transparent !important; color:#D7DAE0 !important; font-size:12px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-messages {
    min-height:0 !important; overflow-y:auto !important; overflow-x:hidden !important; overscroll-behavior:contain !important; padding:12px 10px 16px !important; background:#080B10 !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-welcome { max-width:430px !important; margin:18px auto 0 !important; text-align:center !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-welcome h3 { margin:0 !important; color:#F1F3F5 !important; font-size:16px !important; line-height:1.3 !important; font-weight:730 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-welcome p { margin:7px auto 0 !important; max-width:360px !important; color:#7E8591 !important; font-size:11.5px !important; line-height:1.45 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-prompts { display:grid !important; gap:7px !important; margin-top:16px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-prompts button {
    width:100% !important; min-height:44px !important; padding:9px 12px !important; border:1px solid rgba(255,255,255,.075) !important; border-radius:10px !important; background:#10141B !important; color:#C8CCD3 !important; text-align:left !important; font-size:12px !important; line-height:1.35 !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-message-row { display:flex !important; margin:0 0 10px !important; min-width:0 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-message-row.is-user { justify-content:flex-end !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-message-row.is-assistant { justify-content:flex-start !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-message-row.is-status { justify-content:center !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-bubble { max-width:min(88%,580px) !important; min-width:0 !important; padding:9px 11px !important; border-radius:12px !important; font-size:13px !important; line-height:1.48 !important; overflow-wrap:anywhere !important; word-break:normal !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-bubble.is-user { color:#17130B !important; background:#F5A623 !important; border:1px solid #F5A623 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-bubble.is-assistant { color:#D9DCE1 !important; background:#10141B !important; border:1px solid rgba(255,255,255,.075) !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-message-meta { min-height:30px !important; margin:-2px 0 4px !important; display:flex !important; align-items:center !important; justify-content:space-between !important; gap:8px !important; color:#777E8B !important; font-size:9.5px !important; font-weight:700 !important; letter-spacing:.08em !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-message-meta button { width:44px !important; height:44px !important; display:grid !important; place-items:center !important; border:0 !important; border-radius:8px !important; color:#8C929E !important; background:transparent !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-message-content { white-space:pre-wrap !important; overflow-wrap:anywhere !important; word-break:normal !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-evidence { margin-top:6px !important; color:#737986 !important; font-size:10px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-status { min-height:34px !important; padding:6px 10px !important; display:inline-flex !important; align-items:center !important; gap:7px !important; border-radius:999px !important; background:#11161E !important; border:1px solid rgba(255,255,255,.07) !important; color:#9096A1 !important; font-size:11px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-spinner { width:12px !important; height:12px !important; flex:0 0 12px !important; border:1.5px solid rgba(245,166,35,.25) !important; border-top-color:#F5A623 !important; border-radius:50% !important; animation:agent-copilot-spin .8s linear infinite !important; }
  @keyframes agent-copilot-spin { to { transform:rotate(360deg); } }
  body[data-ed-portal="farmer"] .ent-copilot-agent-knowledge { max-height:150px !important; overflow-y:auto !important; padding:9px 12px !important; background:#0D1117 !important; border-top:1px solid rgba(255,255,255,.07) !important; color:#A5AAB4 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-knowledge > div { display:flex !important; align-items:center !important; gap:7px !important; font-size:11px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-knowledge > div span { margin-left:auto !important; color:#747B87 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-knowledge p { margin:7px 0 0 !important; padding-top:7px !important; border-top:1px solid rgba(255,255,255,.05) !important; font-size:10.5px !important; line-height:1.4 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-knowledge > button { min-height:36px !important; margin-top:6px !important; border:0 !important; background:transparent !important; color:#F5A623 !important; font-size:11px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-secondary-toolbar { min-height:54px !important; padding:5px 10px !important; display:flex !important; align-items:center !important; justify-content:space-between !important; gap:8px !important; border-top:1px solid rgba(255,255,255,.07) !important; background:#0B0E14 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-language { position:relative !important; min-width:0 !important; height:44px !important; display:flex !important; align-items:center !important; gap:6px !important; padding:0 7px 0 9px !important; border:1px solid rgba(255,255,255,.07) !important; border-radius:9px !important; color:#858C98 !important; background:#10141B !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-language select { min-width:92px !important; height:42px !important; padding:0 20px 0 0 !important; border:0 !important; outline:0 !important; appearance:none !important; background:transparent !important; color:#AEB3BC !important; font-size:11px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-language > svg:last-child { position:absolute !important; right:5px !important; pointer-events:none !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-knowledge-button { min-height:44px !important; padding:0 10px !important; display:inline-flex !important; align-items:center !important; gap:6px !important; border:1px solid rgba(255,255,255,.07) !important; border-radius:9px !important; color:#8E949F !important; background:#10141B !important; font-size:11px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-knowledge-button:disabled { opacity:.42 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-composer { min-height:58px !important; padding:7px 10px max(7px,env(safe-area-inset-bottom,0px)) !important; display:grid !important; grid-template-columns:44px minmax(0,1fr) 44px !important; align-items:center !important; gap:7px !important; border-top:1px solid rgba(255,255,255,.07) !important; background:#090C11 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-composer button { width:44px !important; height:44px !important; min-width:44px !important; display:grid !important; place-items:center !important; border-radius:10px !important; border:1px solid rgba(255,255,255,.07) !important; background:#11161E !important; color:#9299A5 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-composer button.is-listening { color:#F87171 !important; border-color:rgba(248,113,113,.35) !important; background:rgba(248,113,113,.08) !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-composer button.is-send { color:#17130B !important; border-color:#F5A623 !important; background:#F5A623 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-composer button:disabled { opacity:.42 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-composer input { width:100% !important; min-width:0 !important; height:44px !important; padding:0 12px !important; border:1px solid rgba(255,255,255,.08) !important; border-radius:10px !important; outline:0 !important; background:#10141B !important; color:#E8EAED !important; font-size:13px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-panel button:focus-visible,
  body[data-ed-portal="farmer"] .ent-copilot-agent-panel select:focus-visible,
  body[data-ed-portal="farmer"] .ent-copilot-agent-panel input:focus-visible { outline:2px solid #F5A623 !important; outline-offset:2px !important; }
  body[data-ed-portal="farmer"] .copilot-fab--farmer {
    width:44px !important; height:44px !important; min-width:44px !important; min-height:44px !important; border-radius:12px !important; background:#F5A623 !important; color:#17130B !important; box-shadow:0 4px 14px rgba(0,0,0,.24) !important;
  }
}

@media (max-width: 360px) {
  body[data-ed-portal="farmer"] .ent-copilot-agent-selector { grid-template-columns:1fr !important; gap:4px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-selector > label { display:none !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-brand small { max-width:210px !important; overflow:hidden !important; text-overflow:ellipsis !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-secondary-toolbar { gap:6px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-language select { min-width:78px !important; }
}

/* Farmer mobile Profile: shared body-level sheet, presentation only. */
@media (max-width: 768px) {
  body[data-ed-portal="farmer"].profile-sheet-open { overflow:hidden !important; }
  body[data-ed-portal="farmer"].profile-sheet-open .farmer-mobile-bottom-nav,
  body[data-ed-portal="farmer"].profile-sheet-open .ed-mobile-workspace-trigger,
  body[data-ed-portal="farmer"].profile-sheet-open .copilot-fab,
  body[data-ed-portal="farmer"].profile-sheet-open .topbar { visibility:hidden !important; pointer-events:none !important; }
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian { z-index:9000 !important; align-items:flex-end !important; padding:0 !important; background:rgba(4,6,10,.96) !important; }
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-sheet-panel { width:100vw !important; max-width:none !important; max-height:96dvh !important; border-radius:16px 16px 0 0 !important; }
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-form-grid,
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-password-grid { grid-template-columns:1fr !important; gap:10px !important; }
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-field-wide { grid-column:auto !important; }
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-primary-action,
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-secondary-action { width:100% !important; min-height:48px !important; }
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .input { min-height:44px !important; }
}

/* Farmer drawer final mobile branding/footer contract. */
@media (max-width: 768px) {
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 { min-height:68px !important; padding:10px 12px !important; gap:9px !important; }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-collapse-btn,
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-mobile-drawer-brand-mark,
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-header-title { display:none !important; }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-header-mobile-eyebrow { color:#F2F3F5 !important; font-size:12px !important; font-weight:760 !important; letter-spacing:.055em !important; }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-header-desktop-subtitle { display:block !important; margin-top:3px !important; color:#F5A623 !important; font-size:9.5px !important; font-weight:720 !important; letter-spacing:.12em !important; }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-drawer-close { width:44px !important; height:44px !important; min-width:44px !important; display:grid !important; place-items:center !important; border-radius:10px !important; }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item { min-height:44px !important; }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 { padding-bottom:max(10px,calc(8px + env(safe-area-inset-bottom,0px))) !important; }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-mobile-logout { min-height:48px !important; width:100% !important; }
}

/* Farmer compact-landscape mobile contract — phone landscape up to 900x480. */
@media (max-width: 900px) and (max-height: 480px) {
  body[data-ed-portal="farmer"] .farmer-dashboard-root {
    padding-top:calc(58px + env(safe-area-inset-top,0px)) !important;
    padding-bottom:calc(68px + env(safe-area-inset-bottom,0px)) !important;
  }
  body[data-ed-portal="farmer"] .farmer-dashboard-root > header.topbar {
    position:fixed !important; inset-inline:0 !important; top:0 !important; z-index:40 !important;
  }
  body[data-ed-portal="farmer"] .farmer-mobile-bottom-nav {
    position:fixed !important; left:0 !important; right:0 !important; bottom:0 !important;
    display:grid !important; grid-template-columns:repeat(5,minmax(0,1fr)) !important;
    height:calc(64px + env(safe-area-inset-bottom,0px)) !important;
    z-index:61 !important;
  }
  body[data-ed-portal="farmer"] .ed-mobile-workspace-trigger { display:flex !important; }
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar {
    position:fixed !important; inset:0 auto 0 0 !important;
    width:min(82vw,312px) !important; max-width:312px !important;
    height:100dvh !important; min-height:100dvh !important; max-height:100dvh !important;
    display:flex !important; flex-direction:column !important; overflow:hidden !important;
  }
  body[data-ed-portal="farmer"].ed-mobile-portal-active .ed-sidebar > nav {
    flex:1 1 auto !important; min-height:0 !important; overflow-y:auto !important; overflow-x:hidden !important;
  }
  body[data-ed-portal="farmer"].copilot-sheet-open .farmer-mobile-bottom-nav,
  body[data-ed-portal="farmer"].copilot-sheet-open .ed-mobile-workspace-trigger,
  body[data-ed-portal="farmer"].copilot-sheet-open .copilot-fab,
  body[data-ed-portal="farmer"].copilot-sheet-open .topbar {
    visibility:hidden !important; pointer-events:none !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-overlay {
    position:fixed !important; inset:0 !important; width:100vw !important; height:100dvh !important;
    z-index:150 !important; display:block !important; overflow:hidden !important; background:#080B10 !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-panel {
    position:relative !important; inset:auto !important; width:100vw !important; height:100dvh !important;
    min-height:100dvh !important; max-width:none !important; max-height:none !important; margin:0 !important;
    display:grid !important; grid-template-rows:auto auto minmax(0,1fr) auto auto !important;
    overflow:hidden !important; border:0 !important; border-radius:0 !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-header { min-height:58px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-selector { min-height:52px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-welcome { margin-top:8px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-prompts { margin-top:10px !important; gap:5px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-prompts button { min-height:44px !important; }
  body[data-ed-portal="farmer"].profile-sheet-open .farmer-mobile-bottom-nav,
  body[data-ed-portal="farmer"].profile-sheet-open .ed-mobile-workspace-trigger,
  body[data-ed-portal="farmer"].profile-sheet-open .copilot-fab,
  body[data-ed-portal="farmer"].profile-sheet-open .topbar { visibility:hidden !important; pointer-events:none !important; }
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian { align-items:center !important; padding:0 !important; }
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-sheet-panel {
    width:100vw !important; max-width:none !important; height:100dvh !important; max-height:100dvh !important;
    border-radius:0 !important;
  }
}

@media (max-width: 900px) and (max-height: 480px) {
  body[data-ed-portal="farmer"] .ent-copilot-agent-header {
    padding:7px 10px 7px 12px !important; display:flex !important; align-items:center !important; justify-content:space-between !important; gap:10px !important;
    border-bottom:1px solid rgba(255,255,255,.07) !important; background:#090C11 !important;
  }
  body[data-ed-portal="farmer"] .ent-copilot-agent-brand { display:flex !important; align-items:center !important; gap:9px !important; min-width:0 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-brand-icon { width:36px !important; height:36px !important; display:grid !important; place-items:center !important; color:#F5A623 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-close { width:44px !important; height:44px !important; min-width:44px !important; display:grid !important; place-items:center !important; border:0 !important; border-radius:10px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-selector { padding:4px 10px !important; display:grid !important; grid-template-columns:auto minmax(0,1fr) !important; align-items:center !important; gap:9px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-select-wrap { height:44px !important; display:grid !important; grid-template-columns:20px minmax(0,1fr) 18px !important; align-items:center !important; gap:6px !important; padding:0 9px !important; border:1px solid rgba(255,255,255,.08) !important; border-radius:10px !important; background:#10141B !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-select-wrap select { width:100% !important; height:42px !important; border:0 !important; background:transparent !important; color:#D7DAE0 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-messages { min-height:0 !important; overflow-y:auto !important; overflow-x:hidden !important; padding:8px 10px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-prompts { display:grid !important; grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-prompts button { width:100% !important; min-height:44px !important; padding:7px 10px !important; border:1px solid rgba(255,255,255,.075) !important; border-radius:10px !important; background:#10141B !important; color:#C8CCD3 !important; text-align:left !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-secondary-toolbar { min-height:50px !important; padding:3px 10px !important; display:flex !important; align-items:center !important; justify-content:space-between !important; gap:8px !important; border-top:1px solid rgba(255,255,255,.07) !important; background:#0B0E14 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-language { height:44px !important; display:flex !important; align-items:center !important; gap:6px !important; padding:0 9px !important; border:1px solid rgba(255,255,255,.07) !important; border-radius:9px !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-language select { min-width:92px !important; height:42px !important; border:0 !important; background:transparent !important; color:#AEB3BC !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-knowledge-button { min-height:44px !important; padding:0 10px !important; display:inline-flex !important; align-items:center !important; gap:6px !important; border:1px solid rgba(255,255,255,.07) !important; border-radius:9px !important; background:#10141B !important; color:#8E949F !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-composer { min-height:58px !important; padding:7px 10px max(7px,env(safe-area-inset-bottom,0px)) !important; display:grid !important; grid-template-columns:44px minmax(0,1fr) 44px !important; align-items:center !important; gap:7px !important; border-top:1px solid rgba(255,255,255,.07) !important; background:#090C11 !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-composer button { width:44px !important; height:44px !important; min-width:44px !important; display:grid !important; place-items:center !important; }
  body[data-ed-portal="farmer"] .ent-copilot-agent-composer input { width:100% !important; min-width:0 !important; height:44px !important; }

  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 { min-height:68px !important; padding:10px 12px !important; display:flex !important; align-items:center !important; gap:9px !important; }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-collapse-btn,
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-mobile-drawer-brand-mark,
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-header-title { display:none !important; }
  body[data-ed-portal="farmer"] .ed-sidebar-header-v14 .ed-drawer-close { width:44px !important; height:44px !important; min-width:44px !important; display:grid !important; place-items:center !important; }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-search-wrap { padding:6px 12px !important; }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-search-input { min-height:44px !important; }
  body[data-ed-portal="farmer"] .ed-sidebar .ed-nav-item { min-height:44px !important; padding:8px 11px !important; display:flex !important; align-items:center !important; }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 { flex:0 0 auto !important; padding-bottom:max(8px,env(safe-area-inset-bottom,0px)) !important; }
  body[data-ed-portal="farmer"] .ed-sidebar-footer-v8 .ed-mobile-logout { min-height:48px !important; width:100% !important; display:flex !important; align-items:center !important; justify-content:center !important; }

  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-form-grid,
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-password-grid { grid-template-columns:1fr !important; gap:10px !important; }
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-primary-action,
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .profile-secondary-action { width:100% !important; min-height:48px !important; display:inline-flex !important; align-items:center !important; justify-content:center !important; }
  body[data-ed-portal="farmer"] .profile-sheet-overlay--agrarian .input { min-height:44px !important; }
}


/* ═══════════════════════════════════════════════════════════════
   Admin desktop refinement — Pass 11
   Desktop presentation only. No Admin routes, APIs, calculations, table
   handlers, permissions or workflow contracts are changed here.
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  body[data-ed-portal="admin"] {
    --admin-desk-card:#151515;
    --admin-desk-card-2:#181714;
    --admin-desk-line:#2a2926;
    --admin-desk-text:#f5f5f4;
    --admin-desk-muted:#9298a7;
    --admin-desk-subtle:#6f7788;
  }

  /* Shared KPI contract: one card, one border, one information hierarchy. */
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-tile {
    min-height: 112px !important;
    padding: 16px 17px !important;
    border:1px solid var(--admin-desk-line) !important;
    border-radius:12px !important;
    background:var(--admin-desk-card) !important;
    box-shadow:none !important;
    overflow:hidden !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-body {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) 36px !important;
    align-items:start !important;
    gap:12px !important;
    min-height:0 !important;
    width:100% !important;
    padding:0 !important;
    margin:0 !important;
    background:transparent !important;
    border:0 !important;
    border-radius:0 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-copy {
    min-width:0 !important;
    padding:0 !important;
    margin:0 !important;
    background:transparent !important;
    border:0 !important;
    border-radius:0 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-label,
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-hint,
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-value {
    max-width:100% !important;
    min-width:0 !important;
    padding:0 !important;
    background:transparent !important;
    border:0 !important;
    border-radius:0 !important;
    box-shadow:none !important;
    text-overflow:clip !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-label {
    font-size:10px !important;
    line-height:1.25 !important;
    font-weight:650 !important;
    letter-spacing:.075em !important;
    color:var(--admin-desk-muted) !important;
    white-space:normal !important;
    overflow:visible !important;
    overflow-wrap:break-word !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-value {
    margin-top:12px !important;
    font-size:24px !important;
    line-height:1 !important;
    font-weight:720 !important;
    color:var(--admin-desk-text) !important;
    white-space:normal !important;
    overflow:visible !important;
    overflow-wrap:break-word !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-hint {
    margin-top:9px !important;
    font-size:11px !important;
    line-height:1.35 !important;
    color:var(--admin-desk-subtle) !important;
    white-space:normal !important;
    overflow:visible !important;
    overflow-wrap:break-word !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-icon {
    width:36px !important;
    height:36px !important;
    margin-left:0 !important;
    padding:0 !important;
    border:1px solid #2b303b !important;
    border-radius:10px !important;
    background:#11151d !important;
    color:#7f899e !important;
    box-shadow:none !important;
  }

  /* Overview becomes information-dense without changing any metric values. */
  body[data-ed-portal="admin"] #admin-main-content .grid > .ui-metric-tile {
    align-self:stretch !important;
  }

  /* Workspace/sidebar polish. */
  body[data-ed-portal="admin"] .ed-sidebar .ed-search-input::placeholder {
    color:#70788b !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar .ed-group-label {
    color:#8b95a9 !important;
    font-size:9.5px !important;
    letter-spacing:.15em !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar .ed-group-label:hover {
    color:#b8c0d0 !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar .ed-nav-item[aria-current="page"] {
    background:linear-gradient(90deg,rgba(245,158,11,.14),rgba(245,158,11,.04)) !important;
    box-shadow:inset 2px 0 0 #f59e0b !important;
  }

  /* Module title/search rhythm stays consistent across the 68 workspaces. */
  body[data-ed-portal="admin"] #admin-main-content {
    scroll-padding-top:86px !important;
  }
  body[data-ed-portal="admin"] #admin-main-content > div {
    min-width:0 !important;
  }
  body[data-ed-portal="admin"] #admin-main-content [role="tablist"]:not([aria-label="Admin navigation"]) {
    opacity:1 !important;
    visibility:visible !important;
  }
  body[data-ed-portal="admin"] #admin-main-content [class*="overflow-x-auto"][class*="no-scrollbar"]:has(button[role="tab"]) {
    opacity:1 !important;
    visibility:visible !important;
  }

  /* Tables remain authoritative desktop tables; only ergonomics are normalized. */
  body[data-ed-portal="admin"] #admin-main-content .data-table {
    width:100% !important;
    border-collapse:separate !important;
    border-spacing:0 !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .data-table thead th {
    /* Do not globally stick every Admin table header. The previous viewport-
       relative top:72px rule pulled the first body row underneath/above the
       header on normal document-scrolling tables. Modules that later gain a
       dedicated scroll container can opt into sticky headers locally. */
    position:static !important;
    top:auto !important;
    z-index:auto !important;
    background:#0f1726 !important;
    box-shadow:0 1px 0 #293244 !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .data-table tbody td {
    min-height:42px !important;
    vertical-align:middle !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .data-table td:last-child button,
  body[data-ed-portal="admin"] #admin-main-content .data-table td:last-child a {
    display:inline-flex !important;
    align-items:center !important;
    min-height:30px !important;
    padding:4px 8px !important;
    border-radius:7px !important;
    text-decoration:none !important;
    white-space:nowrap !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .data-table td:last-child button:hover,
  body[data-ed-portal="admin"] #admin-main-content .data-table td:last-child a:hover {
    background:rgba(255,255,255,.055) !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .admin-empty-table-row td {
    height:132px !important;
    text-align:center !important;
    color:#7e8798 !important;
    background:#121212 !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .admin-empty-table-title {
    display:block !important;
    color:#d8dbe2 !important;
    font-size:13px !important;
    font-weight:650 !important;
    margin-bottom:5px !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .admin-empty-table-copy {
    font-size:11px !important;
    line-height:1.45 !important;
  }

  /* API provider primary action follows the shared Admin primary-action system. */
  body[data-ed-portal="admin"] #admin-main-content .api-keys-tab .btn-accent {
    background:#f59e0b !important;
    border-color:#f59e0b !important;
    color:#15110a !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .api-keys-tab .btn-accent:hover {
    background:#fbbf24 !important;
    border-color:#fbbf24 !important;
  }

  /* Admin Copilot is a quiet docked desktop assistant, not a full-screen mobile takeover. */
  body[data-ed-portal="admin"] .copilot-fab--admin {
    width:48px !important;
    height:48px !important;
    right:24px !important;
    bottom:24px !important;
    border-radius:12px !important;
    background:#f59e0b !important;
    color:#16110a !important;
    box-shadow:0 12px 30px rgba(0,0,0,.34) !important;
    transform:none !important;
  }
  body[data-ed-portal="admin"] .ent-copilot-admin {
    position:fixed !important;
    top:88px !important;
    right:24px !important;
    bottom:24px !important;
    width:420px !important;
    height:auto !important;
    max-width:calc(100vw - 336px) !important;
    max-height:none !important;
    border-radius:14px !important;
    border:1px solid #2b303b !important;
    background:#0b0e14 !important;
    box-shadow:0 24px 70px rgba(0,0,0,.46) !important;
    z-index:90 !important;
  }
  body[data-ed-portal="admin"] .ent-copilot-admin > div:first-child {
    background:#0f141e !important;
    color:#f5f5f4 !important;
    border-bottom-color:#293244 !important;
  }
  body[data-ed-portal="admin"] .ent-copilot-admin .admin-copilot-subtitle {
    display:block !important;
    margin-top:1px !important;
    font-size:10px !important;
    font-weight:500 !important;
    color:#8791a5 !important;
  }

  /* Shared Profile behaves as a desktop modal, not the mobile near-fullscreen sheet. */
  body[data-ed-portal="admin"].profile-sheet-open .profile-sheet-panel {
    width:min(720px,calc(100vw - 72px)) !important;
    height:auto !important;
    max-height:calc(100dvh - 72px) !important;
    margin:auto !important;
    border-radius:16px !important;
  }
}

@media (min-width:1024px) and (max-width:1199px) {
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-tile { padding:14px !important; min-height:108px !important; }
  body[data-ed-portal="admin"] #admin-main-content .ui-metric-value { font-size:21px !important; }
  body[data-ed-portal="admin"] .ent-copilot-admin { right:16px !important; width:380px !important; max-width:calc(100vw - 304px) !important; }
}

/* ═══════════════════════════════════════════════════════════════
   ADMIN DESKTOP PASS 12 — root-cause regression corrections
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  /* All create/add CTAs inside Admin use one primary enterprise language.
     Role/module semantics remain in labels and icons, not arbitrary button hue. */
  body[data-ed-portal="admin"] #admin-main-content .btn-accent.brand-surface-admin,
  body[data-ed-portal="admin"] #admin-main-content .btn-accent.brand-surface-cargo {
    background:#f59e0b !important;
    border-color:#f59e0b !important;
    color:#111827 !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .btn-accent.brand-surface-admin:hover,
  body[data-ed-portal="admin"] #admin-main-content .btn-accent.brand-surface-cargo:hover {
    background:#fbbf24 !important;
    border-color:#fbbf24 !important;
  }

  /* Map workspaces own their corners for zoom/legend/attribution/farm controls.
     Keep the assistant reachable elsewhere instead of allowing a fixed FAB to
     cover authoritative map controls. */
  body[data-ed-portal="admin"]:has(#admin-main-content[data-admin-tab="fleet"]) .copilot-fab--admin,
  body[data-ed-portal="admin"]:has(#admin-main-content[data-admin-tab="eudr-map"]) .copilot-fab--admin {
    display:none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   PASS 13 — ADMIN DESKTOP MAP + COLLAPSIBLE NAVIGATION
   Presentation-only shell hardening. Keeps Admin routes/business logic intact.
   ═══════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  body[data-ed-portal="admin"] .ed-sidebar .ed-collapse-btn {
    appearance:none !important;
    width:34px !important;
    height:34px !important;
    min-width:34px !important;
    padding:0 !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    border:1px solid rgba(212,160,23,.52) !important;
    border-radius:9px !important;
    background:rgba(212,160,23,.08) !important;
    color:#E8B51C !important;
    cursor:pointer !important;
    transition:background .16s ease,border-color .16s ease,transform .22s ease !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar .ed-collapse-btn:hover,
  body[data-ed-portal="admin"] .ed-sidebar .ed-collapse-btn:focus-visible {
    background:rgba(212,160,23,.16) !important;
    border-color:#D4A017 !important;
    outline:2px solid rgba(212,160,23,.30) !important;
    outline-offset:2px !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar .ed-collapse-btn svg { transition:transform .22s ease !important; }
  body[data-ed-portal="admin"] .ed-sidebar .ed-collapse-btn.is-collapsed svg { transform:rotate(180deg) !important; }

  body[data-ed-portal="admin"] .ed-sidebar .ed-collapsed-search-btn {
    display:none;
    width:40px;
    height:40px;
    margin:8px auto 4px;
    align-items:center;
    justify-content:center;
    border:1px solid #263047;
    border-radius:9px;
    background:#111827;
    color:#A7B0C2;
    cursor:pointer;
  }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-collapsed-search-btn { display:flex; }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-header-v14 {
    padding-left:18px !important;
    padding-right:18px !important;
    justify-content:center !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-mobile-drawer-brand-mark,
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-drawer-close { display:none !important; }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-nav-v14 { padding-left:8px !important; padding-right:8px !important; }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-nav-item {
    width:52px !important;
    min-width:52px !important;
    justify-content:center !important;
    padding-left:0 !important;
    padding-right:0 !important;
    margin-left:auto !important;
    margin-right:auto !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-nav-icon { margin:0 !important; }

  /* Leaflet tiles must remain real image tiles. Tailwind/global image rules must
     never collapse or visually suppress the Leaflet tile pane on Admin desktop. */
  body[data-ed-portal="admin"] #admin-main-content .leaflet-container img.leaflet-tile,
  body[data-ed-portal="admin"] #admin-main-content .leaflet-pane > img {
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    filter:none !important;
    max-width:none !important;
    max-height:none !important;
  }
  body[data-ed-portal="admin"] #admin-main-content .leaflet-tile-pane { opacity:1 !important; visibility:visible !important; }
  body[data-ed-portal="admin"] #admin-main-content .leaflet-map-pane,
  body[data-ed-portal="admin"] #admin-main-content .leaflet-tile-pane,
  body[data-ed-portal="admin"] #admin-main-content .leaflet-overlay-pane,
  body[data-ed-portal="admin"] #admin-main-content .leaflet-marker-pane { transform-origin:0 0 !important; }
}

/* Admin desktop Pass 13.1 — persistent sidebar boundary toggle.
   Intentionally outside .ed-sidebar so fixed headers/scroll layers cannot hide it. */
@media (min-width: 769px) {
  body[data-ed-portal="admin"].ed-enterprise-shell .ed-sidebar .ed-collapse-btn {
    display: none !important;
  }
  body[data-ed-portal="admin"].ed-enterprise-shell .ed-admin-sidebar-toggle {
    position: fixed !important;
    top: 84px !important;
    left: 272px;
    z-index: 120 !important;
    width: 34px !important;
    height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    border: 1px solid rgba(245,158,11,.55) !important;
    border-radius: 9px !important;
    background: #111827 !important;
    color: #f59e0b !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.32) !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    transition: left .25s cubic-bezier(.4,0,.2,1), background .15s ease, border-color .15s ease, transform .15s ease !important;
  }
  body[data-ed-portal="admin"].ed-enterprise-shell .ed-admin-sidebar-toggle:hover {
    background: rgba(245,158,11,.15) !important;
    border-color: #f59e0b !important;
  }
  body[data-ed-portal="admin"].ed-enterprise-shell .ed-admin-sidebar-toggle:focus-visible {
    outline: 2px solid #f59e0b !important;
    outline-offset: 2px !important;
  }
  body[data-ed-portal="admin"].ed-enterprise-shell .ed-admin-sidebar-toggle:active {
    transform: scale(.97) !important;
  }
}
@media (max-width: 768px) {
  .ed-admin-sidebar-toggle { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════
   ADMIN DESKTOP PASS 14 — canonical icon rail + enterprise collapse UX
   Shell-only. No Admin routes/business handlers are changed here.
   ═══════════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  body[data-ed-portal="admin"].ed-enterprise-shell .ed-sidebar {
    transition: width .18s cubic-bezier(.4,0,.2,1) !important;
    will-change: width;
  }
  body[data-ed-portal="admin"].ed-enterprise-shell #admin-main-content {
    transition: margin-left .18s cubic-bezier(.4,0,.2,1) !important;
  }

  /* Toggle is a permanent shell control, not part of the scrolling rail. */
  body[data-ed-portal="admin"].ed-enterprise-shell .ed-admin-sidebar-toggle {
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    border-radius:10px !important;
    transition:left .18s cubic-bezier(.4,0,.2,1),background .12s ease,border-color .12s ease,transform .12s ease !important;
  }
  body[data-ed-portal="admin"].ed-enterprise-shell .ed-admin-sidebar-toggle svg {
    width:18px !important;
    height:18px !important;
  }

  /* One optical contract for all route icons. */
  body[data-ed-portal="admin"] .ed-sidebar .ed-nav-icon {
    width:20px !important;
    height:20px !important;
    min-width:20px !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar .ed-nav-icon > svg {
    width:20px !important;
    height:20px !important;
    display:block !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar .ed-nav-item {
    min-height:42px !important;
    transition:background-color .12s ease,color .12s ease,border-color .12s ease !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar .ed-nav-item:focus-visible {
    outline:2px solid rgba(245,158,11,.72) !important;
    outline-offset:-2px !important;
  }

  /* Collapsed mode is a complete 72px navigation rail. All groups remain
     navigable; group boundaries survive as quiet separators instead of text. */
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-group {
    padding-top:5px !important;
    margin-top:5px !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-group + .ed-group {
    border-top:1px solid rgba(255,255,255,.065) !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-group-items {
    overflow:visible !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-nav-item {
    width:48px !important;
    min-width:48px !important;
    min-height:44px !important;
    height:44px !important;
    border-left-width:0 !important;
    border-radius:9px !important;
    justify-content:center !important;
    padding:0 !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-nav-item[aria-current="page"] {
    box-shadow:inset 3px 0 0 #f59e0b !important;
    background:rgba(245,158,11,.14) !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-collapsed-search-btn {
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    border-radius:9px !important;
  }

  /* Collapsed account footer remains complete: avatar + sign-out icon. */
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-footer-v8 {
    padding:10px 8px !important;
    gap:4px !important;
    justify-content:center !important;
    flex-direction:column !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-footer-avatar {
    width:34px !important;
    height:34px !important;
  }
  body[data-ed-portal="admin"] .ed-sidebar[data-collapsed="true"] .ed-mobile-logout {
    width:44px !important;
    height:44px !important;
    min-width:44px !important;
    padding:0 !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
  }

  /* Fixed tooltip escapes the rail's overflow container. Accessible naming is
     still provided by aria-label; the tooltip is supplemental visual context. */
  body[data-ed-portal="admin"] .ed-admin-nav-tooltip {
    position:fixed !important;
    z-index:140 !important;
    transform:translateY(-50%) translateX(-3px) !important;
    opacity:0 !important;
    visibility:hidden !important;
    pointer-events:none !important;
    max-width:260px !important;
    padding:7px 10px !important;
    border:1px solid rgba(148,163,184,.24) !important;
    border-radius:8px !important;
    background:#0f172a !important;
    color:#f8fafc !important;
    box-shadow:0 10px 28px rgba(0,0,0,.34) !important;
    font:500 12px/1.25 Inter,system-ui,sans-serif !important;
    white-space:nowrap !important;
    transition:opacity .1s ease,transform .1s ease,visibility .1s ease !important;
  }
  body[data-ed-portal="admin"] .ed-admin-nav-tooltip.is-visible {
    opacity:1 !important;
    visibility:visible !important;
    transform:translateY(-50%) translateX(0) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-ed-portal="admin"].ed-enterprise-shell .ed-sidebar,
  body[data-ed-portal="admin"].ed-enterprise-shell #admin-main-content,
  body[data-ed-portal="admin"].ed-enterprise-shell .ed-admin-sidebar-toggle,
  body[data-ed-portal="admin"] .ed-admin-nav-tooltip,
  body[data-ed-portal="admin"] .ed-sidebar .ed-nav-item {
    transition-duration:.01ms !important;
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
  }
}

/* ════════════════════════════════════════════════════════════════════
 * PASS 15 — WAREHOUSE + COMMAND CENTER ENTERPRISE SHELL CONTRACT
 * Role-aware Back to Admin, action-first warehouse queues, and a
 * situational-awareness section index. Presentation only.
 * ════════════════════════════════════════════════════════════════════ */
.portal-back-admin {
  min-height: 44px !important;
  min-width: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
  font-weight: 650 !important;
}
.portal-back-admin:focus-visible,
.warehouse-ops-action:focus-visible,
.command-section-link:focus-visible {
  outline: 2px solid rgba(245, 158, 11, .95) !important;
  outline-offset: 2px !important;
}

.warehouse-ops-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.warehouse-ops-action {
  min-width: 0;
  min-height: 86px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  text-align: left;
  border: 1px solid var(--ed-desk-border, rgba(148,163,184,.18));
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  color: inherit;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}
.warehouse-ops-action:hover {
  border-color: rgba(245,158,11,.34);
  background: rgba(245,158,11,.055);
}
.warehouse-ops-action.is-active {
  border-color: rgba(245,158,11,.48);
  background: rgba(245,158,11,.08);
}
.warehouse-ops-action strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-size: 26px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.warehouse-ops-action > span:last-child {
  color: var(--ed-desk-subtle, #8f98a8);
  font-size: 11.5px;
}
.warehouse-ops-kicker {
  color: var(--ed-desk-muted, #b1b8c5);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.command-section-nav {
  position: sticky;
  top: 72px;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--ed-desk-border, rgba(148,163,184,.18));
  border-radius: 12px;
  background: rgba(10,13,20,.88);
  backdrop-filter: blur(14px) saturate(125%);
  -webkit-backdrop-filter: blur(14px) saturate(125%);
}
.command-section-link {
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9px;
  color: var(--ed-desk-muted, #b1b8c5);
  font-size: 11.5px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease;
}
.command-section-link:hover {
  color: #fff;
  background: rgba(245,158,11,.08);
}
.command-section-anchor { scroll-margin-top: 132px; }

@media (max-width: 1100px) {
  .command-section-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .portal-back-admin span { display: none; }
  .portal-back-admin { padding-left: 10px !important; padding-right: 10px !important; }
  .warehouse-ops-strip { grid-template-columns: 1fr; }
  .warehouse-ops-action { min-height: 68px; }
  .command-section-nav {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .command-section-anchor { scroll-margin-top: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .warehouse-ops-action,
  .command-section-link { transition: none !important; }
}


/* PASS 15.1 — Warehouse + Command Center shell recovery */
@media (min-width:769px) {
  body[data-ed-portal="warehouse"] .ed-sidebar,
  body[data-ed-portal="command"] .ed-sidebar { transition: width .18s cubic-bezier(.4,0,.2,1) !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-header-text,
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-nav-text,
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-nav-badge,
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-group-label,
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-footer-text,
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-search-wrap,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-header-text,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-nav-text,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-nav-badge,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-group-label,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-footer-text,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-search-wrap { display:none !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-nav-v14,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-nav-v14 { padding-left:8px !important; padding-right:8px !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-nav-item,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-nav-item { width:48px !important; height:44px !important; padding:0 !important; margin:2px auto !important; justify-content:center !important; gap:0 !important; border-left-width:0 !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-nav-icon,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-nav-icon { width:20px !important; height:20px !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-collapsed-search-btn,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-collapsed-search-btn { display:flex !important; width:44px !important; height:44px !important; align-items:center !important; justify-content:center !important; margin:8px auto 4px !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar:not([data-collapsed="true"]) .ed-collapsed-search-btn,
  body[data-ed-portal="command"] .ed-sidebar:not([data-collapsed="true"]) .ed-collapsed-search-btn { display:none !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-footer-v8,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-footer-v8 { padding:10px 8px !important; justify-content:center !important; gap:6px !important; flex-direction:column !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-mobile-logout,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-mobile-logout { width:44px !important; height:44px !important; padding:0 !important; justify-content:center !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar[data-collapsed="true"] .ed-mobile-logout span,
  body[data-ed-portal="command"] .ed-sidebar[data-collapsed="true"] .ed-mobile-logout span { display:none !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar .ed-collapse-btn,
  body[data-ed-portal="command"] .ed-sidebar .ed-collapse-btn { display:none !important; }
  body[data-ed-portal="warehouse"] .ed-admin-sidebar-toggle,
  body[data-ed-portal="command"] .ed-admin-sidebar-toggle { display:flex !important; }
  body[data-ed-portal="command"] .command-section-nav { display:none !important; }
  body[data-ed-portal="command"] #command-main-content { max-width:none !important; width:auto !important; }
  body[data-ed-portal="command"] .command-section-anchor { scroll-margin-top:88px !important; }
}
body[data-ed-portal="command"] .command-section-anchor { min-width:0; }
body[data-ed-portal="command"] #command-main-content > section { width:100%; }
body[data-ed-portal="command"] #command-main-content .grid { min-width:0; }

.portal-back-admin { position:relative; z-index:22; }

@media (prefers-reduced-motion: reduce) {
  body[data-ed-portal="warehouse"] .ed-sidebar,
  body[data-ed-portal="command"] .ed-sidebar { transition:none !important; }
}


/* PASS 15.1 hardening — shared enterprise rail geometry + header recovery */
@media (min-width:769px) {
  body[data-ed-portal="warehouse"].ed-enterprise-shell .ed-admin-sidebar-toggle,
  body[data-ed-portal="command"].ed-enterprise-shell .ed-admin-sidebar-toggle {
    position:fixed !important; top:84px !important; left:272px; z-index:120 !important;
    width:44px !important; height:44px !important; min-width:44px !important; padding:0 !important;
    display:inline-flex !important; align-items:center !important; justify-content:center !important;
    border:1px solid rgba(245,158,11,.55) !important; border-radius:10px !important;
    background:#111827 !important; color:#f59e0b !important; box-shadow:0 8px 24px rgba(0,0,0,.32) !important;
    cursor:pointer !important; pointer-events:auto !important;
    transition:left .18s cubic-bezier(.4,0,.2,1),background .12s ease,border-color .12s ease,transform .12s ease !important;
  }
  body[data-ed-portal="warehouse"].ed-enterprise-shell .ed-admin-sidebar-toggle:hover,
  body[data-ed-portal="command"].ed-enterprise-shell .ed-admin-sidebar-toggle:hover { background:rgba(245,158,11,.15) !important; border-color:#f59e0b !important; }
  body[data-ed-portal="warehouse"].ed-enterprise-shell .ed-admin-sidebar-toggle:focus-visible,
  body[data-ed-portal="command"].ed-enterprise-shell .ed-admin-sidebar-toggle:focus-visible { outline:2px solid #f59e0b !important; outline-offset:2px !important; }

  body[data-ed-portal="warehouse"] header.topbar > div,
  body[data-ed-portal="command"] header.topbar > div {
    max-width:none !important; width:100% !important; margin:0 !important;
    padding-left:calc(var(--ed-sidebar-offset, 304px) + 20px) !important;
    padding-right:24px !important;
  }
  body[data-ed-portal="warehouse"] header.topbar .portal-back-admin,
  body[data-ed-portal="command"] header.topbar .portal-back-admin { display:inline-flex !important; visibility:visible !important; opacity:1 !important; flex:0 0 auto !important; }

  body[data-ed-portal="warehouse"] .ed-sidebar .ed-nav-icon,
  body[data-ed-portal="command"] .ed-sidebar .ed-nav-icon { width:20px !important; height:20px !important; min-width:20px !important; }
  body[data-ed-portal="warehouse"] .ed-sidebar .ed-nav-icon > svg,
  body[data-ed-portal="command"] .ed-sidebar .ed-nav-icon > svg { width:20px !important; height:20px !important; }
}


/* PASS 15.2 runtime-root shell correction */
@media (min-width:769px) {
  body[data-ed-portal="warehouse"] header.topbar .ed-shell-back-admin,
  body[data-ed-portal="command"] header.topbar .ed-shell-back-admin {
    display:inline-flex !important; align-items:center !important; justify-content:center !important;
    gap:7px !important; min-width:44px !important; min-height:44px !important; flex:0 0 auto !important;
    position:relative !important; z-index:30 !important; visibility:visible !important; opacity:1 !important;
  }
  body[data-ed-portal="warehouse"] header.topbar .ed-shell-back-admin:focus-visible,
  body[data-ed-portal="command"] header.topbar .ed-shell-back-admin:focus-visible {
    outline:2px solid #f59e0b !important; outline-offset:2px !important;
  }
  body[data-ed-portal="command"] #command-main-content {
    max-width:none !important; width:100% !important; box-sizing:border-box !important;
    padding-left:24px !important; padding-right:24px !important;
  }
}
@media (max-width:768px) {
  body[data-ed-portal="warehouse"] header.topbar .ed-shell-back-admin span,
  body[data-ed-portal="command"] header.topbar .ed-shell-back-admin span { display:none !important; }
}


/* PASS 15.3 — Command Center runtime provenance + cockpit recovery */
@media (min-width:769px) {
  body[data-ed-portal="command"].ed-enterprise-shell header.topbar {
    position:sticky !important; top:0 !important; z-index:35 !important;
  }
  body[data-ed-portal="command"] #command-main-content {
    width:100% !important; max-width:1600px !important; margin:0 auto !important;
    padding:28px clamp(20px,2.2vw,36px) 40px !important; box-sizing:border-box !important;
  }
  body[data-ed-portal="command"] #command-main-content > section {
    width:100% !important; max-width:none !important; min-width:0 !important;
  }
  body[data-ed-portal="command"] #command-main-content .grid {
    width:100% !important; max-width:none !important; min-width:0 !important;
  }
  body[data-ed-portal="command"] .command-section-anchor { scroll-margin-top:92px !important; }
  body[data-ed-portal="command"] .ed-sidebar .ed-nav-item[aria-current="page"] {
    background:rgba(212,160,23,.15) !important; color:#fff !important;
  }
  body[data-ed-portal="command"] .ed-sidebar .ed-nav-item[aria-current="page"] .ed-nav-icon { color:#D4A017 !important; }
}
@media (min-width:1024px) {
  body[data-ed-portal="command"] #command-kpis > .grid {
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }
  body[data-ed-portal="command"] #command-ai > .grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important; align-items:stretch !important;
  }
  body[data-ed-portal="command"] #command-alerts > .grid {
    grid-template-columns:repeat(3,minmax(0,1fr)) !important; align-items:start !important;
  }
}
@media (min-width:1500px) {
  body[data-ed-portal="command"] #command-kpis > .grid {
    grid-template-columns:repeat(6,minmax(0,1fr)) !important;
  }
}
@media (max-width:1023px) and (min-width:769px) {
  body[data-ed-portal="command"] #command-kpis > .grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  body[data-ed-portal="command"] #command-ai > .grid,
  body[data-ed-portal="command"] #command-alerts > .grid { grid-template-columns:1fr !important; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-ed-portal="command"] .ed-sidebar,
  body[data-ed-portal="command"] .ed-admin-sidebar-toggle { transition:none !important; }
}

/* ========================================================================== */
/* PASS 16 — LOGIN / AUTHENTICATION — INSTITUTIONAL ENTERPRISE EXPERIENCE     */
/* Scoped to .login-enterprise so authenticated portals remain untouched.      */
/* ========================================================================== */
.login-enterprise {
  display:grid;
  grid-template-columns:minmax(440px, 46%) minmax(520px, 54%);
  min-height:100vh;
  min-height:100dvh;
  overflow:hidden;
}
.login-enterprise-brand { position:relative; min-height:100vh; min-height:100dvh; overflow:hidden; }
.login-enterprise-brand::after {
  content:""; position:absolute; inset:0; pointer-events:none;
  background:linear-gradient(135deg, rgba(255,255,255,.035), transparent 38%, rgba(0,0,0,.10));
}
.login-enterprise-brand-pattern { position:absolute; inset:0; opacity:.07; }
.login-enterprise-brand-inner { position:relative; z-index:1; min-height:100%; padding:clamp(36px,4vw,64px); display:flex; flex-direction:column; justify-content:space-between; gap:40px; }
.login-enterprise-brand-header { display:flex; align-items:center; gap:14px; }
.login-enterprise-logo { box-shadow:0 12px 30px rgba(0,0,0,.18) !important; }
.login-enterprise-brand-name { margin:0; font-size:16px; font-weight:700; letter-spacing:-.015em; }
.login-enterprise-brand-org { margin:3px 0 0; font-size:12px; color:rgba(255,255,255,.62); }
.login-enterprise-story { width:min(100%, 590px); }
.login-enterprise-kicker { margin:0 0 14px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.13em; color:rgba(255,255,255,.56); }
.login-enterprise-headline { margin:0; font-size:clamp(40px,4.5vw,66px); line-height:1.03; letter-spacing:-.048em; font-weight:690; text-wrap:balance; }
.login-enterprise-summary { margin:24px 0 0; max-width:560px; font-size:15px; line-height:1.72; color:rgba(255,255,255,.73); }
.login-enterprise-signals { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:34px; }
.login-enterprise-signal { min-width:0; display:flex; gap:10px; align-items:center; padding:14px; border:1px solid rgba(255,255,255,.13); border-radius:12px; background:rgba(12,7,4,.15); backdrop-filter:blur(4px); }
.login-enterprise-signal-icon { flex:0 0 34px; width:34px; height:34px; display:grid; place-items:center; border-radius:9px; color:#f7ca72; background:rgba(245,158,11,.10); border:1px solid rgba(247,202,114,.17); }
.login-enterprise-signal-icon svg { width:17px; height:17px; }
.login-enterprise-signal > span:last-child { min-width:0; display:flex; flex-direction:column; gap:2px; }
.login-enterprise-signal strong { font-size:15px; line-height:1.1; color:#fff; }
.login-enterprise-signal small { font-size:10px; line-height:1.35; color:rgba(255,255,255,.55); }
.login-enterprise-assurance { display:flex; flex-wrap:wrap; gap:10px 18px; margin-top:18px; padding-top:18px; border-top:1px solid rgba(255,255,255,.11); }
.login-enterprise-assurance span { display:inline-flex; align-items:center; gap:7px; font-size:10px; font-weight:600; letter-spacing:.01em; color:rgba(255,255,255,.61); }
.login-enterprise-assurance svg { width:14px; height:14px; color:#f6bd58; }
.login-enterprise-brand-footer { display:flex; align-items:center; gap:8px; font-size:10px; color:rgba(255,255,255,.42); }

.login-enterprise-auth { min-width:0; min-height:100vh; min-height:100dvh; display:flex; flex-direction:column; background:#080a0d; }
.login-enterprise-mobile-brand { align-items:center; gap:12px; padding:18px 20px 6px; }
.login-enterprise-auth-inner { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; padding:clamp(28px,5vw,72px); }
.login-enterprise-form-shell { width:min(100%, 470px); }
.login-enterprise-form-heading { margin-bottom:28px; }
.login-enterprise-access-badge { display:inline-flex; align-items:center; gap:7px; margin-bottom:12px; color:#d2a34b; font-size:10px; font-weight:750; letter-spacing:.12em; text-transform:uppercase; }
.login-enterprise-access-badge svg { width:15px; height:15px; }
.login-enterprise-form-heading h2 { margin:0; font-size:30px; line-height:1.12; color:#f8fafc; font-weight:690; letter-spacing:-.035em; }
.login-enterprise-form-heading p { margin:9px 0 0; max-width:430px; color:#7d8798; font-size:13px; line-height:1.55; }
.login-enterprise-alert { display:flex; align-items:flex-start; gap:9px; margin:0 0 18px; padding:12px 13px; border-radius:10px; color:#fca5a5; background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.24); font-size:12px; line-height:1.45; }
.login-enterprise-alert svg { width:16px; height:16px; flex:0 0 auto; margin-top:1px; }
.login-enterprise-form { display:flex; flex-direction:column; gap:17px; }
.login-enterprise-field label { display:block; margin:0 0 7px; color:#bdc4ce; font-size:10px; font-weight:700; letter-spacing:.07em; text-transform:uppercase; }
.login-enterprise-input-wrap { position:relative; }
.login-enterprise-field-icon { position:absolute; left:13px; top:50%; transform:translateY(-50%); width:17px; height:17px; display:grid; place-items:center; color:#697386; pointer-events:none; z-index:2; }
.login-enterprise-field-icon svg { width:17px; height:17px; }
.login-enterprise-input.input { width:100%; height:48px; padding-left:41px !important; padding-right:14px !important; border-radius:9px !important; background:#11151a !important; border:1px solid #272d36 !important; color:#f4f6f8 !important; font-size:13px !important; box-shadow:none !important; transition:border-color .16s ease, box-shadow .16s ease, background .16s ease !important; }
.login-enterprise-password-input.input { padding-right:50px !important; }
.login-enterprise-input.input::placeholder { color:#576171 !important; opacity:1 !important; }
.login-enterprise-input.input:hover { border-color:#343c48 !important; background:#13181e !important; }
.login-enterprise-input.input:focus { outline:none !important; border-color:#b88424 !important; box-shadow:0 0 0 3px rgba(184,132,36,.15) !important; }
.login-enterprise-input.input[aria-invalid="true"] { border-color:rgba(239,68,68,.52) !important; }
.login-enterprise-password-toggle { position:absolute; right:5px; top:50%; transform:translateY(-50%); width:40px; height:40px; display:grid; place-items:center; padding:0; border:0; border-radius:8px; background:transparent; color:#7d8798; cursor:pointer; }
.login-enterprise-password-toggle svg { width:17px; height:17px; }
.login-enterprise-password-toggle:hover { color:#d4d8de; background:rgba(255,255,255,.045); }
.login-enterprise-password-toggle:focus-visible { outline:2px solid #d79d32; outline-offset:1px; }
.login-enterprise-submit { margin-top:3px; min-height:48px; width:100%; border:1px solid #d89b27; border-radius:9px; display:inline-flex; align-items:center; justify-content:center; gap:9px; padding:0 16px; background:#d9a41d; color:#11100c; font-size:12px; font-weight:750; letter-spacing:.005em; cursor:pointer; box-shadow:0 8px 22px rgba(217,164,29,.11); transition:transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease; }
.login-enterprise-submit svg { width:16px; height:16px; }
.login-enterprise-submit:hover:not(:disabled) { background:#e3ae28; border-color:#e6b43e; box-shadow:0 10px 26px rgba(217,164,29,.16); }
.login-enterprise-submit:active:not(:disabled) { transform:translateY(1px); box-shadow:none; }
.login-enterprise-submit:focus-visible { outline:2px solid #f7c75f; outline-offset:3px; }
.login-enterprise-submit:disabled { cursor:not-allowed; opacity:.62; box-shadow:none; }
.login-enterprise-spinner { animation:login-enterprise-spin .8s linear infinite; }
@keyframes login-enterprise-spin { to { transform:rotate(360deg); } }
.login-enterprise-routing-note { display:flex; align-items:flex-start; gap:8px; margin-top:13px; color:#677184; font-size:10px; line-height:1.5; }
.login-enterprise-routing-note svg { width:14px; height:14px; flex:0 0 auto; margin-top:1px; }
.login-enterprise-portals { margin-top:26px; }
.login-enterprise-divider { display:flex; align-items:center; gap:12px; margin-bottom:12px; color:#677184; font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:.11em; }
.login-enterprise-divider::before,.login-enterprise-divider::after { content:""; flex:1; height:1px; background:#21262e; }
.login-enterprise-portal-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.login-enterprise-portal-button { min-width:0; min-height:58px; display:grid; grid-template-columns:34px minmax(0,1fr) 16px; align-items:center; gap:9px; padding:10px 11px; text-align:left; border:1px solid #262d37; border-radius:10px; background:#11161c; color:#d8dde5; cursor:pointer; transition:border-color .16s ease, background .16s ease, transform .16s ease; }
.login-enterprise-portal-button:hover { border-color:#3b4552; background:#151b22; }
.login-enterprise-portal-button:active { transform:translateY(1px); }
.login-enterprise-portal-button:focus-visible { outline:2px solid #d79d32; outline-offset:2px; }
.login-enterprise-portal-icon { width:34px; height:34px; display:grid; place-items:center; border-radius:8px; }
.login-enterprise-portal-icon svg { width:18px; height:18px; }
.login-enterprise-portal-icon.farmer { color:#4ade80; background:rgba(34,197,94,.10); }
.login-enterprise-portal-icon.driver { color:#fbbf24; background:rgba(245,158,11,.10); }
.login-enterprise-portal-button > span:nth-child(2) { min-width:0; display:flex; flex-direction:column; gap:2px; }
.login-enterprise-portal-button strong { font-size:11px; font-weight:680; color:#e8ebef; }
.login-enterprise-portal-button small { font-size:9px; line-height:1.3; color:#697386; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.login-enterprise-portal-arrow { width:14px; height:14px; color:#667080; }
.login-enterprise-support { margin:14px 0 0; text-align:center; color:#5f6979; font-size:9px; line-height:1.5; }

@media (max-width:1100px) {
  .login-enterprise { grid-template-columns:minmax(380px,43%) minmax(480px,57%); }
  .login-enterprise-brand-inner { padding:34px; }
  .login-enterprise-headline { font-size:40px; }
  .login-enterprise-signals { grid-template-columns:1fr; gap:8px; }
  .login-enterprise-signal { padding:10px 12px; }
  .login-enterprise-assurance { gap:8px 12px; }
}
@media (max-width:767px) {
  .login-enterprise { display:block; min-height:100dvh; overflow:auto; }
  .login-enterprise-brand { display:none; }
  .login-enterprise-auth { min-height:100dvh; }
  .login-enterprise-mobile-brand { display:flex !important; padding-top:max(18px, env(safe-area-inset-top)); }
  .login-enterprise-auth-inner { align-items:flex-start; padding:34px 20px max(28px,env(safe-area-inset-bottom)); }
  .login-enterprise-form-shell { max-width:520px; margin:0 auto; }
  .login-enterprise-form-heading { margin-bottom:24px; }
  .login-enterprise-form-heading h2 { font-size:27px; }
}
@media (max-width:480px) {
  .login-enterprise-auth-inner { padding-left:16px; padding-right:16px; }
  .login-enterprise-portal-grid { grid-template-columns:1fr; }
  .login-enterprise-portal-button { min-height:56px; }
}
@media (max-height:760px) and (min-width:768px) {
  .login-enterprise-brand-inner { padding-top:26px; padding-bottom:26px; gap:18px; }
  .login-enterprise-headline { font-size:38px; }
  .login-enterprise-summary { margin-top:14px; font-size:13px; line-height:1.55; }
  .login-enterprise-signals { margin-top:20px; }
  .login-enterprise-assurance { margin-top:12px; padding-top:12px; }
  .login-enterprise-auth-inner { padding-top:26px; padding-bottom:26px; }
  .login-enterprise-form-heading { margin-bottom:20px; }
  .login-enterprise-portals { margin-top:18px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-enterprise *, .login-enterprise *::before, .login-enterprise *::after { scroll-behavior:auto !important; transition-duration:.01ms !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; }
}
@media (forced-colors: active) {
  .login-enterprise-submit,.login-enterprise-portal-button,.login-enterprise-input.input,.login-enterprise-password-toggle { forced-color-adjust:auto; }
}

/* PASS 16 — browser autofill must preserve dark institutional form styling. */
.login-enterprise input:-webkit-autofill,
.login-enterprise input:-webkit-autofill:hover,
.login-enterprise input:-webkit-autofill:focus {
  -webkit-text-fill-color:#f4f6f8 !important;
  caret-color:#f4f6f8 !important;
  box-shadow:0 0 0 1000px #11151a inset !important;
  -webkit-box-shadow:0 0 0 1000px #11151a inset !important;
  border-color:#272d36 !important;
  transition:background-color 99999s ease-out 0s !important;
}
@media (max-height:760px) and (min-width:768px) and (max-width:1100px) {
  .login-enterprise-signals { grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
  .login-enterprise-signal { gap:6px; padding:8px; }
  .login-enterprise-signal-icon { width:28px; height:28px; flex-basis:28px; }
  .login-enterprise-signal-icon svg { width:14px; height:14px; }
  .login-enterprise-signal strong { font-size:13px; }
  .login-enterprise-signal small { font-size:8px; }
  .login-enterprise-assurance { gap:6px 10px; }
  .login-enterprise-assurance span { font-size:8px; }
}

/* ═══════════════════════════════════════════════════════════════
   FACTORY CLERK PASS 17 — enterprise operations shell
   ═══════════════════════════════════════════════════════════════ */
.factory-clerk-enterprise .clerk-ops-strip {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.factory-clerk-enterprise .clerk-ops-card {
  min-width:0;
  min-height:92px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:15px 16px;
  border:1px solid rgba(148,163,184,.18);
  border-radius:12px;
  background:linear-gradient(180deg,rgba(255,255,255,.035),rgba(255,255,255,.015));
  text-align:left;
  transition:border-color .15s ease,background .15s ease,transform .15s ease;
}
.factory-clerk-enterprise .clerk-ops-card:hover {
  border-color:rgba(245,158,11,.42);
  background:rgba(245,158,11,.055);
}
.factory-clerk-enterprise .clerk-ops-card:focus-visible {
  outline:2px solid #f59e0b;
  outline-offset:2px;
}
.factory-clerk-enterprise .clerk-ops-icon {
  width:38px;height:38px;min-width:38px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  color:#f59e0b;background:rgba(245,158,11,.11);border:1px solid rgba(245,158,11,.18);
}
.factory-clerk-enterprise .clerk-ops-card > span:last-child { display:grid;min-width:0; }
.factory-clerk-enterprise .clerk-ops-card small {
  color:#8b95a7;font-size:10px;line-height:1.3;text-transform:uppercase;letter-spacing:.075em;font-weight:650;
}
.factory-clerk-enterprise .clerk-ops-card strong { color:#f4f4f5;font-size:23px;line-height:1.18;font-variant-numeric:tabular-nums; }
.factory-clerk-enterprise .clerk-ops-card em { color:#70798b;font-size:11px;line-height:1.35;font-style:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.factory-clerk-enterprise .clerk-ai-advisory {
  display:inline-flex;margin-left:6px;padding:2px 6px;border-radius:999px;
  background:rgba(59,130,246,.10);border:1px solid rgba(59,130,246,.22);
  color:#60a5fa;font-size:9px;line-height:1;text-transform:uppercase;letter-spacing:.06em;vertical-align:middle;
}

@media (min-width:769px) {
  body[data-ed-portal="clerk"] .ed-sidebar { transition:width .18s cubic-bezier(.4,0,.2,1) !important; }
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-header-text,
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-nav-text,
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-nav-badge,
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-group-label,
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-footer-text,
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-search-wrap { display:none !important; }
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-nav-v14 { padding-left:8px !important;padding-right:8px !important; }
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-nav-item {
    width:48px !important;height:44px !important;padding:0 !important;margin:2px auto !important;
    justify-content:center !important;gap:0 !important;border-left-width:0 !important;
  }
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-nav-icon { width:20px !important;height:20px !important; }
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-collapsed-search-btn {
    display:flex !important;width:44px !important;height:44px !important;align-items:center !important;justify-content:center !important;margin:8px auto 4px !important;
  }
  body[data-ed-portal="clerk"] .ed-sidebar:not([data-collapsed="true"]) .ed-collapsed-search-btn { display:none !important; }
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-footer-v8 {
    padding:10px 8px !important;justify-content:center !important;gap:6px !important;flex-direction:column !important;
  }
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-mobile-logout { width:44px !important;height:44px !important;padding:0 !important;justify-content:center !important; }
  body[data-ed-portal="clerk"] .ed-sidebar[data-collapsed="true"] .ed-mobile-logout span { display:none !important; }
  body[data-ed-portal="clerk"] .ed-sidebar .ed-collapse-btn { display:none !important; }
  body[data-ed-portal="clerk"].ed-enterprise-shell .ed-admin-sidebar-toggle {
    position:fixed !important;top:84px !important;left:272px;z-index:120 !important;
    width:44px !important;height:44px !important;min-width:44px !important;padding:0 !important;
    display:inline-flex !important;align-items:center !important;justify-content:center !important;
    border:1px solid rgba(245,158,11,.55) !important;border-radius:10px !important;
    background:#111827 !important;color:#f59e0b !important;box-shadow:0 8px 24px rgba(0,0,0,.32) !important;
    cursor:pointer !important;pointer-events:auto !important;
    transition:left .18s cubic-bezier(.4,0,.2,1),background .12s ease,border-color .12s ease !important;
  }
  body[data-ed-portal="clerk"].ed-enterprise-shell .ed-admin-sidebar-toggle:hover { background:rgba(245,158,11,.15) !important;border-color:#f59e0b !important; }
  body[data-ed-portal="clerk"].ed-enterprise-shell .ed-admin-sidebar-toggle:focus-visible { outline:2px solid #f59e0b !important;outline-offset:2px !important; }
  body[data-ed-portal="clerk"] header.topbar > div {
    max-width:none !important;width:100% !important;margin:0 !important;
    padding-left:calc(var(--ed-sidebar-offset,304px) + 20px) !important;padding-right:24px !important;
  }
  body[data-ed-portal="clerk"] #clerk-main-content {
    width:auto !important;max-width:1600px !important;margin-right:auto !important;
    padding-left:24px !important;padding-right:24px !important;
  }
  body[data-ed-portal="clerk"] .ed-sidebar .ed-nav-icon,
  body[data-ed-portal="clerk"] .ed-sidebar .ed-nav-icon > svg { width:20px !important;height:20px !important;min-width:20px !important; }
  body[data-ed-portal="clerk"] header.topbar .ed-shell-back-admin {
    display:inline-flex !important;align-items:center !important;justify-content:center !important;gap:7px !important;
    min-width:44px !important;min-height:44px !important;position:relative !important;z-index:30 !important;
  }

  /* Clerk Copilot — quiet desktop operations assistant. */
  body[data-ed-portal="clerk"] .copilot-fab--clerk {
    width:48px !important;height:48px !important;right:24px !important;bottom:24px !important;border-radius:12px !important;
    background:#f59e0b !important;color:#16110a !important;box-shadow:0 12px 30px rgba(0,0,0,.34) !important;transform:none !important;
  }
  body[data-ed-portal="clerk"] .ent-copilot-clerk {
    position:fixed !important;top:88px !important;right:24px !important;bottom:24px !important;
    width:420px !important;height:auto !important;max-width:calc(100vw - 336px) !important;max-height:none !important;
    border-radius:14px !important;border:1px solid #2b303b !important;background:#0b0e14 !important;
    box-shadow:0 24px 70px rgba(0,0,0,.46) !important;z-index:90 !important;
  }
  body[data-ed-portal="clerk"] .ent-copilot-clerk > div:first-child { background:#0f141e !important;color:#f5f5f4 !important;border-bottom-color:#293244 !important; }
  body[data-ed-portal="clerk"] .ent-copilot-clerk .clerk-copilot-subtitle {
    display:block !important;margin-top:1px !important;font-size:10px !important;font-weight:500 !important;color:#8791a5 !important;
  }
}

@media (max-width:1023px) {
  .factory-clerk-enterprise .clerk-ops-strip { grid-template-columns:1fr; }
}
@media (max-width:768px) {
  .factory-clerk-enterprise .clerk-ops-strip { grid-template-columns:repeat(3,minmax(0,1fr));gap:8px; }
  .factory-clerk-enterprise .clerk-ops-card { min-height:78px;padding:10px;gap:8px; }
  .factory-clerk-enterprise .clerk-ops-icon { width:32px;height:32px;min-width:32px; }
  .factory-clerk-enterprise .clerk-ops-card strong { font-size:19px; }
  .factory-clerk-enterprise .clerk-ops-card em { display:none; }
  body[data-ed-portal="clerk"] .ent-copilot-clerk {
    position:fixed !important;inset:0 !important;width:100vw !important;height:100dvh !important;max-width:none !important;max-height:none !important;
    border-radius:0 !important;border:0 !important;z-index:160 !important;
  }
  body[data-ed-portal="clerk"] .copilot-fab--clerk { right:16px !important;bottom:max(16px,env(safe-area-inset-bottom)) !important; }
  body[data-ed-portal="clerk"] header.topbar .ed-shell-back-admin span { display:none !important; }
}
@media (max-width:520px) {
  .factory-clerk-enterprise .clerk-ops-strip { grid-template-columns:1fr; }
  .factory-clerk-enterprise .clerk-ops-card { min-height:68px; }
  .factory-clerk-enterprise .clerk-ops-card em { display:block; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-ed-portal="clerk"] .ed-sidebar,
  body[data-ed-portal="clerk"] .ed-admin-sidebar-toggle,
  .factory-clerk-enterprise .clerk-ops-card { transition:none !important; }
}


/* ═══════════════════════════════════════════════════════════════
   FINANCE PASS 18 — TOP 0.1% ENTERPRISE OPERATIONS WORKSPACE
   Presentation-only shell/workflow hardening. Financial APIs and
   mutation handlers remain in FinanceDashboard.tsx unchanged.
   ═══════════════════════════════════════════════════════════════ */
.finance-enterprise .finance-ops-strip {
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;
}
.finance-enterprise .finance-ops-card {
  min-height:88px;padding:14px;border:1px solid rgba(148,163,184,.15);border-radius:12px;
  background:linear-gradient(180deg,rgba(17,24,39,.96),rgba(10,14,22,.96));
  display:grid;grid-template-columns:40px minmax(0,1fr) auto;align-items:center;gap:12px;text-align:left;
  color:#f4f4f5;box-shadow:0 8px 24px rgba(0,0,0,.12);transition:border-color .16s ease,background .16s ease,transform .16s ease;
}
.finance-enterprise .finance-ops-card:hover { border-color:rgba(245,158,11,.42);background:linear-gradient(180deg,rgba(29,35,48,.98),rgba(13,18,28,.98));transform:translateY(-1px); }
.finance-enterprise .finance-ops-card:focus-visible { outline:2px solid #f59e0b;outline-offset:2px; }
.finance-enterprise .finance-ops-card > span:nth-child(2) { display:grid;min-width:0; }
.finance-enterprise .finance-ops-card small { color:#8b95a7;font-size:10px;text-transform:uppercase;letter-spacing:.075em;font-weight:700;line-height:1.3; }
.finance-enterprise .finance-ops-card strong { color:#f7f7f8;font-size:24px;line-height:1.15;font-variant-numeric:tabular-nums; }
.finance-enterprise .finance-ops-icon { width:40px;height:40px;border-radius:10px;display:grid;place-items:center;color:#f59e0b;background:rgba(245,158,11,.11);border:1px solid rgba(245,158,11,.20); }
.finance-enterprise .finance-ops-icon svg { width:20px;height:20px; }
.finance-enterprise .finance-ops-action { color:#9aa3b2;font-size:11px;font-weight:650;white-space:nowrap; }

.finance-enterprise .finance-money-table .finance-money-col,
.finance-enterprise .finance-ledger-card .data-table th:nth-child(4),
.finance-enterprise .finance-ledger-card .data-table td:nth-child(4) { text-align:right; font-variant-numeric:tabular-nums; }
.finance-enterprise .finance-money-table thead th,
.finance-enterprise .finance-ledger-card .data-table thead th { position:sticky;top:0;z-index:3;background:var(--surface-card,#111827); }
.finance-enterprise .finance-payments-card,
.finance-enterprise .finance-withdrawals-card,
.finance-enterprise .finance-ledger-card { border-color:rgba(148,163,184,.15) !important; }
.finance-enterprise .finance-payments-card .data-table tbody tr:hover,
.finance-enterprise .finance-withdrawals-card .data-table tbody tr:hover,
.finance-enterprise .finance-ledger-card .data-table tbody tr:hover { background:rgba(245,158,11,.035); }

.finance-enterprise .finance-reports > *:first-child { border-left:3px solid rgba(245,158,11,.78); }
.finance-enterprise .finance-ai-insights > * { border-color:rgba(148,163,184,.15) !important; }
.finance-enterprise .finance-ai-insights > *:first-child { background:linear-gradient(135deg,rgba(245,158,11,.07),rgba(59,130,246,.04)); }
.finance-enterprise .finance-money-sheet-safety {
  display:flex;align-items:flex-start;gap:8px;padding:10px 12px;border-radius:9px;
  background:rgba(245,158,11,.08);border:1px solid rgba(245,158,11,.24);color:#b7791f;font-size:12px;line-height:1.45;
}
.dark .finance-enterprise .finance-money-sheet-safety { color:#fbbf24; }
.finance-enterprise .finance-money-sheet-safety svg { flex:0 0 auto;margin-top:1px; }

@media (min-width:769px) {
  body[data-ed-portal="finance"] .ed-sidebar { transition:width .18s cubic-bezier(.4,0,.2,1) !important; }
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-header-text,
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-nav-text,
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-nav-badge,
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-group-label,
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-footer-text,
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-search-wrap { display:none !important; }
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-nav-v14 { padding-left:8px !important;padding-right:8px !important; }
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-nav-item {
    width:48px !important;height:44px !important;padding:0 !important;margin:2px auto !important;justify-content:center !important;gap:0 !important;border-left-width:0 !important;
  }
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-nav-icon { width:20px !important;height:20px !important; }
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-collapsed-search-btn {
    display:flex !important;width:44px !important;height:44px !important;align-items:center !important;justify-content:center !important;margin:8px auto 4px !important;
  }
  body[data-ed-portal="finance"] .ed-sidebar:not([data-collapsed="true"]) .ed-collapsed-search-btn { display:none !important; }
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-sidebar-footer-v8 { padding:10px 8px !important;justify-content:center !important;gap:6px !important;flex-direction:column !important; }
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-mobile-logout { width:44px !important;height:44px !important;padding:0 !important;justify-content:center !important; }
  body[data-ed-portal="finance"] .ed-sidebar[data-collapsed="true"] .ed-mobile-logout span { display:none !important; }
  body[data-ed-portal="finance"] .ed-sidebar .ed-collapse-btn { display:none !important; }
  body[data-ed-portal="finance"].ed-enterprise-shell .ed-admin-sidebar-toggle {
    position:fixed !important;top:84px !important;left:272px;z-index:120 !important;width:44px !important;height:44px !important;min-width:44px !important;padding:0 !important;
    display:inline-flex !important;align-items:center !important;justify-content:center !important;border:1px solid rgba(245,158,11,.55) !important;border-radius:10px !important;
    background:#111827 !important;color:#f59e0b !important;box-shadow:0 8px 24px rgba(0,0,0,.32) !important;cursor:pointer !important;pointer-events:auto !important;
    transition:left .18s cubic-bezier(.4,0,.2,1),background .12s ease,border-color .12s ease !important;
  }
  body[data-ed-portal="finance"].ed-enterprise-shell .ed-admin-sidebar-toggle:hover { background:rgba(245,158,11,.15) !important;border-color:#f59e0b !important; }
  body[data-ed-portal="finance"].ed-enterprise-shell .ed-admin-sidebar-toggle:focus-visible { outline:2px solid #f59e0b !important;outline-offset:2px !important; }
  body[data-ed-portal="finance"] header.topbar > div { max-width:none !important;width:100% !important;margin:0 !important;padding-left:calc(var(--ed-sidebar-offset,304px) + 20px) !important;padding-right:24px !important; }
  body[data-ed-portal="finance"] #finance-main-content { width:auto !important;max-width:1600px !important;margin-right:auto !important;padding-left:24px !important;padding-right:24px !important; }
  body[data-ed-portal="finance"] .ed-sidebar .ed-nav-icon,
  body[data-ed-portal="finance"] .ed-sidebar .ed-nav-icon > svg { width:20px !important;height:20px !important;min-width:20px !important; }
  body[data-ed-portal="finance"] header.topbar .ed-shell-back-admin { display:inline-flex !important;align-items:center !important;justify-content:center !important;gap:7px !important;min-width:44px !important;min-height:44px !important;position:relative !important;z-index:30 !important; }

  body[data-ed-portal="finance"] .copilot-fab--finance {
    width:48px !important;height:48px !important;right:24px !important;bottom:24px !important;border-radius:12px !important;background:#f59e0b !important;color:#16110a !important;box-shadow:0 12px 30px rgba(0,0,0,.34) !important;transform:none !important;
  }
  body[data-ed-portal="finance"] .ent-copilot-finance {
    position:fixed !important;top:88px !important;right:24px !important;bottom:24px !important;width:432px !important;height:auto !important;max-width:calc(100vw - 336px) !important;max-height:none !important;
    border-radius:14px !important;border:1px solid #2b303b !important;background:#0b0e14 !important;box-shadow:0 24px 70px rgba(0,0,0,.46) !important;z-index:90 !important;
  }
  body[data-ed-portal="finance"] .ent-copilot-finance > div:first-child { background:#0f141e !important;color:#f5f5f4 !important;border-bottom-color:#293244 !important; }
  body[data-ed-portal="finance"] .ent-copilot-finance .finance-copilot-subtitle { display:block !important;margin-top:1px !important;font-size:10px !important;font-weight:500 !important;color:#8791a5 !important; }
}

@media (max-width:1199px) {
  .finance-enterprise .finance-ops-strip { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:768px) {
  .finance-enterprise .finance-ops-strip { grid-template-columns:repeat(2,minmax(0,1fr));gap:8px; }
  .finance-enterprise .finance-ops-card { min-height:78px;padding:10px;grid-template-columns:34px minmax(0,1fr); }
  .finance-enterprise .finance-ops-icon { width:34px;height:34px; }
  .finance-enterprise .finance-ops-action { display:none; }
  .finance-enterprise .finance-ops-card strong { font-size:20px; }
  body[data-ed-portal="finance"] .ent-copilot-finance { position:fixed !important;inset:0 !important;width:100vw !important;height:100dvh !important;max-width:none !important;max-height:none !important;border-radius:0 !important;border:0 !important;z-index:160 !important; }
  body[data-ed-portal="finance"] .copilot-fab--finance { right:16px !important;bottom:max(16px,env(safe-area-inset-bottom)) !important; }
  body[data-ed-portal="finance"] header.topbar .ed-shell-back-admin span { display:none !important; }
}
@media (max-width:520px) {
  .finance-enterprise .finance-ops-strip { grid-template-columns:1fr; }
  .finance-enterprise .finance-ops-card { min-height:68px; }
  .finance-enterprise .finance-money-table { min-width:760px; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-ed-portal="finance"] .ed-sidebar,
  body[data-ed-portal="finance"] .ed-admin-sidebar-toggle,
  .finance-enterprise .finance-ops-card { transition:none !important; }
}

.finance-enterprise .finance-reconciliation-note {
  display:flex;align-items:flex-start;gap:8px;padding:10px 12px;border-radius:9px;
  border:1px solid rgba(59,130,246,.18);background:rgba(59,130,246,.055);color:#64748b;font-size:12px;line-height:1.5;
}
.dark .finance-enterprise .finance-reconciliation-note { color:#94a3b8; }
.finance-enterprise .finance-reconciliation-note svg { flex:0 0 auto;margin-top:1px;color:#60a5fa; }
body[data-ed-portal="finance"] .finance-copilot-agent-icon { display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:5px;vertical-align:-3px; }
body[data-ed-portal="finance"] .finance-copilot-agent-icon svg { width:14px;height:14px; }
body[data-ed-portal="finance"] .ent-copilot-finance > div:nth-child(2) button { display:inline-flex;align-items:center;gap:4px;min-height:30px; }


/* ═══════════════════════════════════════════════════════════════
   EUDR REGULATORY MAPPING — MOBILE CONTROL VISIBILITY
   Ensures every evidence-capture control remains reachable on small screens.
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map {
    height:min(52vh, 400px) !important;
    min-height:320px !important;
    max-height:440px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-action-dock {
    left:8px !important;
    right:8px !important;
    bottom:8px !important;
    max-height:46% !important;
    overflow-y:auto !important;
    overscroll-behavior:contain !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-actions {
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    width:100% !important;
    gap:6px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-button {
    width:100% !important;
    min-width:0 !important;
    min-height:44px !important;
    padding:0 8px !important;
    white-space:normal !important;
    text-align:center !important;
    line-height:1.15 !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-button.is-primary,
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-button.is-secondary,
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-button.is-tertiary {
    flex:none !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-footer {
    box-shadow:0 -10px 24px rgba(0,0,0,.14) !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-footer .agent-mapping-sync-button {
    min-height:48px !important;
    font-size:12px !important;
  }
}

@media (max-width: 380px) {
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map {
    height:min(49vh, 370px) !important;
    min-height:300px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-gps-status {
    max-width:132px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   EUDR FIELD SURVEY UX v10.20 — CLOSE-RANGE, INSTRUMENT-FIRST
   Mature survey controls; vector-first capture; live trace priority.
   ═══════════════════════════════════════════════════════════════ */
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .enterprise-gps-marker-core {
  background:var(--gps-core,#0EA5E9) !important;
  box-shadow:0 0 0 1px rgba(255,255,255,.95),0 0 0 4px rgba(14,165,233,.18) !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .enterprise-vertex {
  background:#7C3AED !important;
  border:2px solid rgba(248,250,252,.96) !important;
  box-shadow:0 1px 5px rgba(15,23,42,.38) !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .enterprise-vertex-start {
  background:#0EA5E9 !important;
  border:2px solid #F8FAFC !important;
  box-shadow:0 0 0 4px rgba(14,165,233,.20),0 2px 6px rgba(15,23,42,.40) !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-button svg {
  width:18px !important;
  height:18px !important;
  flex:0 0 auto !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-button {
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:8px !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-calibration {
  position:absolute !important;
  z-index:520 !important;
  left:50% !important;
  top:50% !important;
  transform:translate(-50%,-50%) !important;
  width:min(390px,calc(100% - 32px)) !important;
  padding:18px 18px 16px !important;
  border:1px solid rgba(148,163,184,.26) !important;
  border-radius:16px !important;
  background:rgba(15,23,42,.94) !important;
  color:#F8FAFC !important;
  box-shadow:0 20px 50px rgba(2,6,23,.34) !important;
  backdrop-filter:blur(16px) !important;
  text-align:left !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-calibration-title {
  font:700 15px/1.2 Inter,Geist,system-ui,sans-serif !important;
  letter-spacing:.01em !important;
  margin-bottom:12px !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-calibration-reading {
  display:flex !important;
  align-items:baseline !important;
  justify-content:space-between !important;
  gap:16px !important;
  padding-bottom:10px !important;
  border-bottom:1px solid rgba(148,163,184,.18) !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-calibration-reading span {
  color:#94A3B8 !important;
  font:600 11px/1.2 Inter,Geist,system-ui,sans-serif !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-calibration-reading strong {
  color:#F8FAFC !important;
  font:750 22px/1 Inter,Geist,system-ui,sans-serif !important;
  font-variant-numeric:tabular-nums !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-calibration-rule {
  margin-top:10px !important;
  color:#F59E0B !important;
  font:700 10px/1.25 Inter,Geist,system-ui,sans-serif !important;
  text-transform:uppercase !important;
  letter-spacing:.08em !important;
}
body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-calibration-message {
  margin-top:7px !important;
  color:#CBD5E1 !important;
  font:500 11px/1.45 Inter,Geist,system-ui,sans-serif !important;
}

@media (max-width: 767px) {
  body[data-ed-portal="agent"] .agent-mapping-mobile-sheet {
    inset:0 !important;
    width:100% !important;
    max-width:none !important;
    height:100dvh !important;
    max-height:100dvh !important;
    border-radius:0 !important;
    padding:0 !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-sheet .sheet-handle { display:none !important; }
  body[data-ed-portal="agent"] .agent-mapping-mobile-header {
    min-height:64px !important;
    padding-top:max(10px,env(safe-area-inset-top)) !important;
    border-bottom:1px solid rgba(148,163,184,.16) !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-scroll {
    padding:0 !important;
    overflow-y:auto !important;
    background:#0F172A !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-scroll > .agent-mapping-evidence-note,
  body[data-ed-portal="agent"] .agent-mapping-mobile-scroll > .agent-mapping-evidence-status {
    margin:0 !important;
    padding:8px 14px !important;
    background:#111827 !important;
    color:#CBD5E1 !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-scroll > .agent-mapping-evidence-note {
    font-size:10px !important;
    line-height:1.35 !important;
    padding-bottom:3px !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-scroll > .agent-mapping-evidence-status {
    font-size:10px !important;
    padding-top:3px !important;
    padding-bottom:8px !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-scroll > div:has(.agent-regulatory-mapping-map) {
    margin:0 !important;
    border:0 !important;
    border-radius:0 !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map {
    height:calc(100dvh - 190px) !important;
    min-height:500px !important;
    max-height:none !important;
    border-radius:0 !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .leaflet-control-zoom {
    display:none !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-gps-status {
    top:12px !important;
    left:12px !important;
    max-width:172px !important;
    min-height:46px !important;
    border-radius:12px !important;
    background:rgba(15,23,42,.92) !important;
    border-color:rgba(148,163,184,.22) !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-toolbar {
    top:12px !important;
    right:12px !important;
    gap:6px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-control-group {
    background:rgba(15,23,42,.90) !important;
    border-color:rgba(148,163,184,.22) !important;
    border-radius:11px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-control {
    width:44px !important;
    min-width:44px !important;
    height:44px !important;
    min-height:44px !important;
    color:#CBD5E1 !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-control[data-active="true"] {
    color:#F8FAFC !important;
    background:rgba(124,58,237,.22) !important;
    border-color:rgba(139,92,246,.50) !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-side-tools {
    top:70px !important;
    right:12px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-hint {
    bottom:148px !important;
    left:50% !important;
    transform:translateX(-50%) !important;
    width:max-content !important;
    max-width:calc(100% - 32px) !important;
    padding:7px 11px !important;
    border-radius:9px !important;
    background:rgba(15,23,42,.88) !important;
    color:#CBD5E1 !important;
    text-align:center !important;
    font-size:10px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-action-dock {
    left:16px !important;
    right:16px !important;
    bottom:16px !important;
    max-height:none !important;
    overflow:visible !important;
    gap:8px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-inline-status {
    border:0 !important;
    border-radius:10px !important;
    background:rgba(15,23,42,.90) !important;
    padding:8px 10px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-actions {
    display:grid !important;
    grid-template-columns:1fr 1fr !important;
    gap:10px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-actions > :only-child {
    grid-column:1 / -1 !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-button {
    min-height:58px !important;
    border-radius:15px !important;
    font:700 13px/1.1 Inter,Geist,system-ui,sans-serif !important;
    letter-spacing:0 !important;
    text-transform:none !important;
    box-shadow:0 6px 18px rgba(2,6,23,.18) !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-button.is-primary {
    background:#6D28D9 !important;
    color:#FFF !important;
    border-color:#7C3AED !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-button.is-secondary {
    background:rgba(248,250,252,.96) !important;
    color:#4C1D95 !important;
    border-color:rgba(255,255,255,.85) !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-button:disabled {
    opacity:.48 !important;
    filter:saturate(.55) !important;
    box-shadow:none !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-primary-start {
    grid-column:1 / -1 !important;
    width:min(280px,78%) !important;
    justify-self:center !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-calibration {
    top:44% !important;
    width:calc(100% - 36px) !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-footer {
    min-height:72px !important;
    padding:10px 14px max(10px,env(safe-area-inset-bottom)) !important;
    border-top:1px solid rgba(148,163,184,.18) !important;
    background:#0B1220 !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-footer .agent-mapping-sync-button {
    min-height:52px !important;
    border-radius:14px !important;
    font-size:12px !important;
  }
  body[data-ed-portal="agent"] .agent-mapping-mobile-scroll > p.nums,
  body[data-ed-portal="agent"] .agent-mapping-mobile-scroll > .mb-3,
  body[data-ed-portal="agent"] .agent-mapping-mobile-scroll > .mt-3 {
    margin-left:14px !important;
    margin-right:14px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   EUDR FIELD SURVEY UX v10.21 — MOBILE PRIMARY CONTROL INVARIANT
   The map must never extend beneath the evidence/sync footer. Start,
   Pause, Resume and End remain visible on real Android/iOS viewports.
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  body[data-ed-portal="agent"] .agent-mapping-mobile-scroll {
    overscroll-behavior:contain !important;
  }

  /* Previous 100dvh-190px sizing ignored the header, evidence copy,
     sync footer and portal nav, placing the action dock off-screen. */
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map {
    height:clamp(420px, calc(100dvh - 430px), 780px) !important;
    min-height:420px !important;
    max-height:780px !important;
  }

  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-action-dock {
    position:absolute !important;
    left:14px !important;
    right:14px !important;
    bottom:14px !important;
    z-index:900 !important;
    max-height:none !important;
    overflow:visible !important;
    pointer-events:auto !important;
  }

  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-actions {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
    gap:10px !important;
    width:100% !important;
    visibility:visible !important;
    opacity:1 !important;
    pointer-events:auto !important;
  }

  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-primary-start,
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-actions > :only-child {
    grid-column:1 / -1 !important;
    width:min(300px,82%) !important;
    justify-self:center !important;
  }

  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-capture-major {
    min-height:62px !important;
    font-size:14px !important;
  }

  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-primary-start {
    min-height:62px !important;
    font-size:14px !important;
  }

  /* Keep the instructional hint above the primary action surface. */
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-hint {
    bottom:112px !important;
  }

  /* The sync footer must remain a separate, visible stage after capture. */
  body[data-ed-portal="agent"] .agent-mapping-mobile-footer {
    position:relative !important;
    z-index:950 !important;
    flex:0 0 auto !important;
  }
}

@media (max-width: 420px) and (max-height: 820px) {
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map {
    height:clamp(360px, calc(100dvh - 390px), 520px) !important;
    min-height:360px !important;
  }
  body[data-ed-portal="agent"] .agent-regulatory-mapping-map .agent-map-context-hint {
    bottom:104px !important;
  }
}
