/* ==========================================================================
   AgroApex Enterprise™ — Executive Agribusiness Cloud ERP (Light Theme)
   Designed for Zafa Pharmaceutical Laboratories • 1,200-Acre Mirpurkhas Estate
   Corporate Architecture: Edge IoT, AI Computer Vision & SAP S/4HANA Integration
   ========================================================================== */

:root {
  /* Surface & Canvas (Pristine Executive Light Palette) */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #fbfcfe;
  --bg-muted: #f1f5f9;
  --bg-hover: #e2e8f0;
  --bg-active: #cbd5e1;

  /* Text & Contrast Hierarchy */
  --text-main: #0f172a;       /* Slate 900 */
  --text-body: #334155;       /* Slate 700 */
  --text-muted: #64748b;      /* Slate 500 */
  --text-subtle: #94a3b8;     /* Slate 400 */
  --text-inverse: #ffffff;

  /* Line & Hairline Borders */
  --border-light: #f1f5f9;
  --border-color: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;

  /* Primary Brand: Forest Emerald (Agricultural Growth & Vigor) */
  --emerald-950: #022c22;
  --emerald-900: #064e3b;
  --emerald-800: #065f46;
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --emerald-200: #a7f3d0;
  --emerald-100: #d1fae5;
  --emerald-50:  #ecfdf5;

  /* Corporate Accent: Zafa Corporate Sapphire / Navy */
  --sapphire-950: #0b1329;
  --sapphire-900: #0f172a;
  --sapphire-800: #1e3a8a;
  --sapphire-700: #1d4ed8;
  --sapphire-600: #2563eb;
  --sapphire-500: #3b82f6;
  --sapphire-400: #60a5fa;
  --sapphire-100: #dbeafe;
  --sapphire-50:  #eff6ff;

  /* Harvest Amber / Gold */
  --amber-800: #92400e;
  --amber-700: #b45309;
  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-400: #fbbf24;
  --amber-100: #fef3c7;
  --amber-50:  #fffbeb;

  /* Canal Azure / Hydrology */
  --azure-800: #075985;
  --azure-700: #0369a1;
  --azure-600: #0284c7;
  --azure-500: #0ea5e9;
  --azure-100: #e0f2fe;
  --azure-50:  #f0f9ff;

  /* Biosecurity Rose / Danger Alerts */
  --rose-800: #9f1239;
  --rose-700: #be123c;
  --rose-600: #e11d48;
  --rose-500: #f43f5e;
  --rose-100: #ffe4e6;
  --rose-50:  #fff1f2;

  /* Typography Stack */
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
  --font-urdu: 'Noto Nastaliq Urdu', serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layered Depth & Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.07), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.09), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  /* Corner Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body.agroapex-body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-muted);
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

/* Global Top Announcement Switcher Banner */
.app-system-banner {
  background: linear-gradient(90deg, #065f46 0%, #047857 50%, #0369a1 100%);
  color: #ffffff;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 100;
}
.banner-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.banner-links {
  display: flex;
  align-items: center;
  gap: 12px;
}
.banner-btn {
  background: #ffffff;
  color: #065f46;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
}
.banner-btn:hover {
  background: #ecfdf5;
  transform: translateY(-1px);
}
.banner-btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.banner-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* App Header & Topbar */
.agroapex-topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}
.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--emerald-600), var(--emerald-800));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--emerald-100);
  color: var(--emerald-800);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}
.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.estate-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: pulse-ring 2s infinite ease-in-out;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.estate-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
}
.estate-client {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Center Tickers */
.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
}
.live-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: var(--radius-md);
  font-size: 0.76rem;
  color: var(--text-body);
  transition: all 0.2s;
}
.live-chip strong {
  color: var(--text-main);
  font-family: var(--font-mono);
}
.live-chip:hover {
  background: #ffffff;
  border-color: var(--border-medium);
}
.live-chip-interactive {
  cursor: pointer;
}
.live-chip-interactive:hover {
  border-color: var(--emerald-500);
  background: var(--emerald-50);
}

/* Topbar Right Actions */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn-sm {
  padding: 6px 10px;
  font-size: 0.76rem;
}
.btn-primary {
  background: var(--emerald-700);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(4, 120, 87, 0.2);
}
.btn-primary:hover {
  background: var(--emerald-800);
  box-shadow: 0 4px 8px rgba(4, 120, 87, 0.3);
  transform: translateY(-1px);
}
.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-color);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-medium);
}
.btn-corporate {
  background: var(--sapphire-700);
  color: #ffffff;
}
.btn-corporate:hover {
  background: var(--sapphire-800);
  box-shadow: 0 4px 8px rgba(29, 78, 216, 0.25);
  transform: translateY(-1px);
}
.btn-amber {
  background: var(--amber-600);
  color: #ffffff;
}
.btn-amber:hover {
  background: var(--amber-700);
}
.btn-outline-emerald {
  background: transparent;
  color: var(--emerald-700);
  border-color: var(--emerald-600);
}
.btn-outline-emerald:hover {
  background: var(--emerald-50);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: #ffffff;
  cursor: pointer;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sapphire-700), var(--sapphire-900));
  color: #ffffff;
  font-weight: 700;
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-info {
  display: flex;
  flex-direction: column;
}
.user-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}
.user-org {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* App Main Layout */
.agroapex-layout {
  display: flex;
  min-height: calc(100vh - 64px - 34px);
}

/* Sidebar Navigation */
.agroapex-sidebar {
  width: 270px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 20px;
  flex-shrink: 0;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px - 34px);
  overflow-y: auto;
}

.nav-group-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-subtle);
  letter-spacing: 0.8px;
  padding: 0 10px;
  margin-bottom: 6px;
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-body);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
  position: relative;
}
.nav-link svg {
  color: var(--text-muted);
  transition: color 0.16s ease;
  flex-shrink: 0;
}
.nav-link:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}
.nav-link:hover svg {
  color: var(--emerald-700);
}
.nav-link.active {
  background: var(--emerald-50);
  color: var(--emerald-900);
  font-weight: 700;
  border: 1px solid var(--emerald-200);
}
.nav-link.active svg {
  color: var(--emerald-700);
}
.nav-badge {
  margin-left: auto;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-muted);
}
.nav-link.active .nav-badge {
  background: var(--emerald-200);
  color: var(--emerald-900);
}
.nav-badge-accent {
  background: var(--amber-100);
  color: var(--amber-800);
}
.nav-badge-blue {
  background: var(--sapphire-100);
  color: var(--sapphire-800);
}

.sidebar-footer-card {
  margin-top: auto;
  background: linear-gradient(145deg, #f0fdf4, #e0f2fe);
  border: 1px solid var(--emerald-200);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.sidebar-footer-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--emerald-950);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.sidebar-footer-desc {
  font-size: 0.72rem;
  color: var(--text-body);
  line-height: 1.4;
  margin-bottom: 10px;
}
.sidebar-footer-btn {
  width: 100%;
  font-size: 0.74rem;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--emerald-600);
  color: var(--emerald-800);
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.sidebar-footer-btn:hover {
  background: var(--emerald-700);
  color: #ffffff;
}

/* Main Content Workspace */
.agroapex-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  max-width: 1600px;
}

/* View Sections */
.view-section {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}
.view-section.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Header */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.view-title-block h1 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.view-subtitle {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 3px;
}
.view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Executive Metric Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
  transform: translateY(-2px);
}
.kpi-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.kpi-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.kpi-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-emerald { background: var(--emerald-50); color: var(--emerald-700); }
.icon-sapphire { background: var(--sapphire-50); color: var(--sapphire-700); }
.icon-amber { background: var(--amber-50); color: var(--amber-700); }
.icon-azure { background: var(--azure-50); color: var(--azure-700); }
.icon-rose { background: var(--rose-50); color: var(--rose-700); }

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 6px;
}
.kpi-subtext {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
}
.trend-up { background: var(--emerald-100); color: var(--emerald-800); }
.trend-down { background: var(--rose-100); color: var(--rose-800); }
.trend-neutral { background: var(--bg-muted); color: var(--text-muted); }

/* Standard White Container Card */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  margin-bottom: 22px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  flex-wrap: wrap;
}
.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}
.card-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-body);
}
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body {
  padding: 20px;
}

/* Search and Filter Ribbon */
.table-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-card-subtle);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  flex-wrap: wrap;
}
.search-input-box {
  position: relative;
  min-width: 260px;
}
.search-input-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
}
.search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  font-family: var(--font-main);
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: all 0.16s ease;
}
.search-input:focus {
  border-color: var(--emerald-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-pill {
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-body);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-pill:hover {
  background: var(--border-color);
}
.filter-pill.active {
  background: var(--emerald-700);
  color: #ffffff;
  border-color: var(--emerald-800);
}

/* Modern Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}
.data-table th {
  background: var(--bg-muted);
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-body);
  vertical-align: middle;
}
.data-table tr:hover td {
  background-color: var(--bg-card-subtle);
}
.data-table td strong {
  color: var(--text-main);
  font-weight: 600;
}
.mono {
  font-family: var(--font-mono);
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-emerald { background: var(--emerald-100); color: var(--emerald-800); border: 1px solid var(--emerald-200); }
.badge-sapphire { background: var(--sapphire-100); color: var(--sapphire-800); border: 1px solid var(--sapphire-200); }
.badge-amber { background: var(--amber-100); color: var(--amber-800); border: 1px solid var(--amber-200); }
.badge-rose { background: var(--rose-100); color: var(--rose-800); border: 1px solid var(--rose-200); }
.badge-muted { background: var(--bg-muted); color: var(--text-muted); border: 1px solid var(--border-color); }

/* Interactive SVG Cadastral Map */
.gis-map-container {
  position: relative;
  background: #f1f5f9;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
}
.gis-svg {
  width: 100%;
  height: 520px;
  display: block;
}
.gis-toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  z-index: 10;
}
.gis-legend {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-md);
  z-index: 10;
  font-size: 0.74rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.legend-color {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-xs);
}
.block-polygon {
  cursor: pointer;
  transition: all 0.2s ease;
  stroke: #ffffff;
  stroke-width: 2;
}
.block-polygon:hover {
  filter: brightness(1.1);
  stroke: var(--emerald-800);
  stroke-width: 3.5;
}
.block-polygon.selected {
  stroke: #0284c7;
  stroke-width: 4;
}

/* Telemetry Charts & Gauges */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 20px;
}
.telemetry-chart-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.chart-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}
.chart-meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--emerald-700);
  font-weight: 700;
}
.svg-chart {
  width: 100%;
  height: 140px;
}

/* Sugarcane Computer Vision AI HUD */
.vision-gantry-wrapper {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: start;
}
.camera-feed-box {
  background: #0f172a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border-medium);
}
.camera-feed-canvas {
  width: 100%;
  height: 380px;
  display: block;
}
.hud-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #a7f3d0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.hud-badge-live {
  background: rgba(220, 38, 38, 0.85);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  letter-spacing: 0.5px;
}
.hud-scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(16, 185, 129, 0.8);
  box-shadow: 0 0 12px rgba(16, 185, 129, 1);
  animation: scanMove 3s linear infinite;
}
@keyframes scanMove {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}
.vision-control-panel {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* Range Sliders */
.slider-control-group {
  margin-bottom: 18px;
}
.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}
.slider-value-display {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--emerald-800);
  background: var(--emerald-50);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--emerald-200);
}
.agro-slider {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  outline: none;
  accent-color: var(--emerald-700);
  cursor: pointer;
}

/* Modals & Slide-Overs */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.active {
  display: flex;
}
.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-main);
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.modal-close-btn:hover {
  background: var(--bg-muted);
  color: var(--text-main);
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-card-subtle);
}

/* Official Government Sindh Weighbridge Slip (Printable Format) */
.weighbridge-slip-sheet {
  background: #ffffff;
  border: 2px dashed #94a3b8;
  border-radius: var(--radius-md);
  padding: 24px;
  font-family: var(--font-mono);
  color: #0f172a;
  position: relative;
}
.slip-header {
  text-align: center;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.slip-org {
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
}
.slip-sub {
  font-size: 0.72rem;
  color: #475569;
}
.slip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.78rem;
}
.slip-weights-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 16px;
}
.weight-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.85rem;
}
.weight-row.total {
  border-top: 2px solid #0f172a;
  margin-top: 6px;
  padding-top: 6px;
  font-weight: 800;
  font-size: 1rem;
  color: #047857;
}
.slip-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  text-align: center;
  font-size: 0.7rem;
}
.signature-line {
  border-top: 1px solid #64748b;
  width: 140px;
  padding-top: 4px;
}

/* Munshi Mobile App Simulator Drawer */
.mobile-sim-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: #ffffff;
  box-shadow: -10px 0 25px rgba(15, 23, 42, 0.15);
  border-left: 1px solid var(--border-color);
  z-index: 999;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.mobile-sim-drawer.open {
  right: 0;
}
.mobile-phone-frame {
  margin: 16px;
  flex: 1;
  background: #0f172a;
  border-radius: 36px;
  border: 6px solid #1e293b;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.phone-top-notch {
  height: 24px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #94a3b8;
  font-size: 0.65rem;
  font-family: var(--font-mono);
}
.phone-screen {
  flex: 1;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.phone-app-header {
  background: var(--emerald-800);
  color: #ffffff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.phone-offline-strip {
  background: #f59e0b;
  color: #0f172a;
  padding: 4px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
}
.phone-app-content {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.phone-action-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
}
.phone-action-btn:hover {
  background: var(--emerald-50);
  border-color: var(--emerald-500);
}

/* Toast Container */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}
.toast-msg {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideToast 0.25s ease-out;
  border-left: 4px solid var(--emerald-500);
  max-width: 360px;
}
@keyframes slideToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Implementation Phases Roadmap Stepper */
.phases-stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.phase-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  position: relative;
  transition: all 0.2s;
}
.phase-card.complete {
  border-color: var(--emerald-500);
  background: #f0fdf4;
}
.phase-card.active {
  border-color: var(--sapphire-600);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
.phase-number {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
}
.phase-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 4px 0;
}
.phase-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  display: inline-block;
}

/* Responsive Overrides */
@media (max-width: 1200px) {
  .vision-gantry-wrapper {
    grid-template-columns: 1fr;
  }
  .phases-stepper {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 900px) {
  .agroapex-sidebar {
    display: none;
  }
  .agroapex-topbar {
    padding: 0 14px;
  }
}
