/* ==========================================================================
   AgriEnterprise ERP™ — Production Prototype Stylesheet
   Designed for 1,200-Acre Agricultural Estate, Mirpurkhas, Sindh, Pakistan
   ========================================================================== */

:root {
  --primary-950: #032d22;
  --primary-900: #064e3b;
  --primary-800: #065f46;
  --primary-700: #047857;
  --primary-600: #059669;
  --primary-500: #10b981;
  --primary-200: #a7f3d0;
  --primary-100: #d1fae5;
  --primary-50:  #ecfdf5;

  --accent-gold-600: #b45309;
  --accent-gold-500: #d97706;
  --accent-gold-400: #f59e0b;
  --accent-gold-100: #fef3c7;

  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;

  --crimson-600: #dc2626;
  --crimson-500: #ef4444;
  --crimson-100: #fee2e2;

  --dark-950: #080d1a;
  --dark-900: #0f172a;
  --dark-800: #1e293b;
  --dark-700: #334155;
  --dark-600: #475569;
  --dark-500: #64748b;
  --dark-400: #94a3b8;
  --dark-300: #cbd5e1;
  --dark-200: #e2e8f0;
  --dark-100: #f1f5f9;
  --dark-50:  #f8fafc;

  --white: #ffffff;

  --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', 'Plus Jakarta Sans', serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

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

html, body {
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body.erp-app-body {
  font-family: var(--font-main);
  background-color: #f1f5f9;
  color: var(--dark-900);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

/* ==========================================================================
   Typography & Helpers
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--dark-950);
}

.text-accent { color: var(--primary-700); }
.text-success { color: var(--primary-600); }
.text-muted { color: var(--dark-500); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }

/* Status dots */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green { background-color: var(--primary-500); box-shadow: 0 0 6px rgba(16, 185, 129, 0.7); }
.status-dot.yellow { background-color: var(--accent-gold-400); }
.status-dot.red { background-color: var(--crimson-500); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-emerald { background-color: var(--primary-100); color: var(--primary-800); }
.badge-gold { background-color: var(--accent-gold-100); color: var(--accent-gold-600); }
.badge-blue { background-color: var(--blue-100); color: var(--blue-600); }
.badge-warning { background-color: #fef9c3; color: #854d0e; }
.badge-danger { background-color: var(--crimson-100); color: var(--crimson-600); }

.badge-pulse {
  background-color: #dcfce7;
  color: #15803d;
  position: relative;
}

.badge-pulse::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #22c55e;
  animation: beaconPulse 1.8s infinite;
}

@keyframes beaconPulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  font-family: var(--font-main);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(6, 78, 59, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 78, 59, 0.3);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-gold-500), var(--accent-gold-600));
  color: var(--white);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}

.btn-accent:hover {
  background: linear-gradient(135deg, var(--accent-gold-400), var(--accent-gold-500));
  transform: translateY(-1px);
}

.btn-outline {
  border-color: var(--dark-300);
  background: var(--white);
  color: var(--dark-800);
}

.btn-outline:hover {
  background: var(--dark-100);
  border-color: var(--dark-400);
}

.btn-outline-white {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.btn-outline-white:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Toast Notification Stack
   ========================================================================== */

.toast-container {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-card {
  pointer-events: auto;
  min-width: 320px;
  max-width: 420px;
  background: #0f172a;
  color: #fff;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--primary-500);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.3s ease;
}

.toast-card.success { border-left-color: var(--primary-500); }
.toast-card.warning { border-left-color: var(--accent-gold-500); }
.toast-card.info    { border-left-color: var(--blue-500); }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #f8fafc;
}

.toast-desc {
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-top: 2px;
}

/* ==========================================================================
   Top Header
   ========================================================================== */

.app-topbar {
  background: linear-gradient(90deg, #090d16, #064e3b 85%);
  color: var(--white);
  min-height: 68px;
  height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
  box-sizing: border-box;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-glyph {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-800));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  display: block;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-edition {
  font-size: 0.7rem;
  color: #a7f3d0;
  letter-spacing: 0.02em;
  display: block;
  line-height: 1.2;
  white-space: nowrap;
}

.estate-selector-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 12px;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-beacon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  flex-shrink: 0;
}

.estate-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  white-space: nowrap;
}

.estate-info strong {
  font-size: 0.8125rem;
  color: var(--white);
  white-space: nowrap;
}

.estate-sub {
  font-size: 0.6875rem;
  color: var(--dark-300);
  white-space: nowrap;
}

.topbar-center {
  display: flex;
  align-items: center;
  margin: 0 12px;
  flex-shrink: 1;
  overflow: hidden;
}

.field-weather-ticker {
  display: flex;
  gap: 14px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  flex-shrink: 0;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--dark-200);
  white-space: nowrap;
}

.ticker-item strong {
  color: var(--white);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.app-topbar .btn {
  white-space: nowrap;
  flex-shrink: 0;
  height: 38px;
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
  flex-shrink: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #059669, #0f766e);
  color: var(--white);
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  white-space: nowrap;
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
}

.user-role {
  font-size: 0.6875rem;
  color: var(--dark-300);
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .topbar-center { display: none; }
}

@media (max-width: 992px) {
  .estate-sub { display: none; }
  .estate-selector-pill { padding: 4px 8px; }
}

@media (max-width: 768px) {
  .user-details { display: none; }
  .app-topbar { padding: 0 12px; }
}

/* ==========================================================================
   Layout & Sidebar
   ========================================================================== */

.app-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  height: calc(100vh - 68px);
}

.app-sidebar {
  width: 250px;
  background: #0f172a;
  color: var(--white);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 16px 12px;
}

.sidebar-section-title {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dark-400);
  padding: 8px 12px 6px 12px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--dark-300);
  background: transparent;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
  font-family: var(--font-main);
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.2), rgba(6, 78, 59, 0.4));
  color: #34d399;
  font-weight: 700;
  border-left: 3px solid #10b981;
}

.nav-pill {
  margin-left: auto;
  font-size: 0.6875rem;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--dark-200);
  font-weight: 600;
}

.nav-pill.badge-green { background: rgba(16, 185, 129, 0.25); color: #34d399; }
.nav-pill.badge-warning { background: rgba(245, 158, 11, 0.25); color: #fbbf24; }
.nav-pill.badge-blue { background: rgba(59, 130, 246, 0.25); color: #93c5fd; }
.nav-pill.badge-accent { background: rgba(217, 119, 6, 0.25); color: #fcd34d; }

.sidebar-estate-footer {
  margin-top: auto;
  padding: 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  color: var(--dark-400);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.system-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dark-200);
}

.version-tag {
  font-size: 0.6875rem;
  color: var(--dark-500);
}

/* ==========================================================================
   Main Workspace Views
   ========================================================================== */

.app-main-workspace {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  background-color: #f8fafc;
}

.erp-view {
  display: none;
  animation: fadeInView 0.2s ease forwards;
}

.erp-view.active {
  display: block;
}

@keyframes fadeInView {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.view-title {
  font-size: 1.65rem;
  color: var(--dark-950);
}

.view-subtitle {
  font-size: 0.9375rem;
  color: var(--dark-500);
  margin-top: 4px;
}

.view-actions {
  display: flex;
  gap: 10px;
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 1.15rem;
  color: var(--dark-900);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.kpi-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--dark-500);
  letter-spacing: 0.03em;
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon.emerald { background: var(--primary-100); color: var(--primary-800); }
.kpi-icon.blue    { background: var(--blue-100); color: var(--blue-600); }
.kpi-icon.gold    { background: var(--accent-gold-100); color: var(--accent-gold-600); }
.kpi-icon.dark    { background: var(--dark-100); color: var(--dark-700); }

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--dark-950);
}

.kpi-unit {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dark-500);
}

.kpi-footer {
  font-size: 0.75rem;
  color: var(--dark-500);
  margin-top: 8px;
  border-top: 1px dashed var(--dark-200);
  padding-top: 6px;
}

/* Two Column Layout */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 960px) {
  .dash-grid-2 { grid-template-columns: 1fr; }
}

/* Cropping Progress List */
.crop-progress-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.crop-prog-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prog-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.prog-meta span {
  font-size: 0.75rem;
  color: var(--dark-500);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--dark-100);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
}

.progress-bar-fill.emerald { background: linear-gradient(90deg, #10b981, #047857); }
.progress-bar-fill.gold    { background: linear-gradient(90deg, #fbbf24, #d97706); }
.progress-bar-fill.blue    { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.progress-bar-fill.crimson { background: linear-gradient(90deg, #f87171, #dc2626); }

.prog-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--dark-600);
}

/* Activity Feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--dark-200);
}

.feed-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.feed-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--dark-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.feed-body {
  flex: 1;
}

.feed-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--dark-900);
}

.feed-sub {
  font-size: 0.75rem;
  color: var(--dark-500);
}

.feed-time {
  font-size: 0.6875rem;
  color: var(--dark-400);
  white-space: nowrap;
}

/* ==========================================================================
   Interactive Vector Cadastral Map (SVG)
   ========================================================================== */

.gis-workspace-layout {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .gis-workspace-layout { grid-template-columns: 1fr; }
}

.map-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--dark-200);
}

.map-layer-selector {
  display: flex;
  gap: 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--dark-700);
}

.layer-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.map-legend-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.75rem;
}

.legend-chip {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.dot.emerald { background: #059669; }
.dot.gold    { background: #d97706; }
.dot.blue    { background: #2563eb; }
.dot.crimson { background: #dc2626; }
.dot.slate   { background: #475569; }

.svg-map-wrapper {
  background: #09131e;
  border-radius: var(--radius-md);
  border: 1px solid #1e293b;
  padding: 12px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.cadastral-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* SVG Field Polygons */
.svg-field-polygon {
  cursor: pointer;
  transition: all 0.2s ease;
}

.svg-field-polygon:hover .field-poly {
  stroke: #34d399 !important;
  stroke-width: 3.5px !important;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.6));
}

.svg-field-polygon.active .field-poly {
  stroke: #10b981 !important;
  stroke-width: 4px !important;
  filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.85));
}

.field-poly {
  stroke-width: 1.5px;
  transition: all 0.2s ease;
}

.poly-orchard  { fill: #064e3b; stroke: #047857; }
.poly-cane     { fill: #78350f; stroke: #b45309; }
.poly-cotton   { fill: #1e3a8a; stroke: #2563eb; }
.poly-chillies { fill: #7f1d1d; stroke: #dc2626; }
.poly-slate    { fill: #1e293b; stroke: #475569; }
.poly-infra    { fill: #334155; stroke: #64748b; }

/* In NDVI Overlay Mode */
.svg-map-wrapper.ndvi-mode .poly-orchard  { fill: #047857; }
.svg-map-wrapper.ndvi-mode .poly-cane     { fill: #059669; }
.svg-map-wrapper.ndvi-mode .poly-cotton   { fill: #ca8a04; }
.svg-map-wrapper.ndvi-mode .poly-chillies { fill: #15803d; }

/* In Salinity Overlay Mode */
.svg-map-wrapper.salinity-mode .poly-orchard  { fill: #15803d; stroke: #22c55e; }
.svg-map-wrapper.salinity-mode .poly-cane     { fill: #b45309; stroke: #f59e0b; }
.svg-map-wrapper.salinity-mode .poly-cotton   { fill: #15803d; stroke: #22c55e; }
.svg-map-wrapper.salinity-mode .poly-chillies { fill: #047857; stroke: #10b981; }

.poly-title {
  fill: #f8fafc;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}

.poly-sub {
  fill: #cbd5e1;
  font-family: var(--font-main);
  font-size: 11px;
  pointer-events: none;
}

.poly-telemetry {
  fill: #6ee7b7;
  font-family: var(--font-main);
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
}

.poly-title-sm {
  fill: #f8fafc;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

.poly-tube-icon {
  fill: #38bdf8;
  stroke: #ffffff;
  stroke-width: 2px;
}

.map-statusbar {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--dark-500);
  margin-top: 14px;
  border-top: 1px solid var(--dark-200);
  padding-top: 10px;
}

.inspector-props {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prop-group {
  display: flex;
  flex-direction: column;
  border-bottom: 1px dashed var(--dark-200);
  padding-bottom: 8px;
}

.prop-lbl {
  font-size: 0.75rem;
  color: var(--dark-500);
}

.prop-val {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--dark-900);
  margin-top: 2px;
}

/* ==========================================================================
   Data Tables & Live Filters
   ========================================================================== */

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

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.table-filter-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.table-search-input {
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--dark-300);
  font-size: 0.8125rem;
  font-family: var(--font-main);
  min-width: 240px;
}

.table-search-input:focus {
  outline: none;
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-select {
  padding: 7px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--dark-300);
  background: var(--white);
  font-size: 0.8125rem;
  font-weight: 500;
}

.erp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.erp-table th {
  background: var(--dark-50);
  color: var(--dark-600);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--dark-200);
}

.erp-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--dark-200);
  color: var(--dark-800);
  vertical-align: middle;
}

.erp-table tbody tr:hover {
  background: var(--dark-50);
}

/* ==========================================================================
   Weighbridge (Kanta) Scale Simulator
   ========================================================================== */

.kanta-display-card {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: var(--white);
  border: 2px solid #334155;
  box-shadow: var(--shadow-lg);
}

.kanta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.kanta-indicator-branding {
  display: flex;
  flex-direction: column;
}

.kanta-brand {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #38bdf8;
}

.kanta-ip {
  font-size: 0.6875rem;
  color: var(--dark-400);
}

.scale-live-tag {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanta-screen {
  background: #030712;
  border-radius: var(--radius-md);
  border: 2px solid #1f2937;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

.kanta-weight-display {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.kanta-digits {
  font-family: 'Space Grotesk', monospace;
  font-size: 3.5rem;
  font-weight: 800;
  color: #10b981;
  text-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
  letter-spacing: 0.05em;
}

.kanta-unit {
  font-size: 1.25rem;
  font-weight: 700;
  color: #6ee7b7;
}

.kanta-sub-readout {
  display: flex;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--dark-400);
  margin-top: 8px;
}

/* ==========================================================================
   Printable Weighbridge Gate Pass Receipt Styling
   ========================================================================== */

.kanta-printed-slip {
  background: #fffdf5;
  border: 2px dashed #94a3b8;
  border-radius: var(--radius-sm);
  padding: 20px;
  font-family: var(--font-mono);
  color: #0f172a;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
}

.slip-header {
  text-align: center;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.slip-gov { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.05em; }
.slip-estate { font-size: 1.05rem; font-weight: 800; margin: 3px 0; }
.slip-meta { font-size: 0.75rem; color: #475569; }

.slip-ticket-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 700;
  background: #e2e8f0;
  padding: 4px 8px;
  margin-bottom: 12px;
}

.slip-table {
  width: 100%;
  font-size: 0.8125rem;
  margin-bottom: 14px;
}

.slip-table td {
  padding: 4px 0;
}

.slip-table .bold { font-weight: 700; }

.slip-weight-box {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 10px;
  margin: 12px 0;
}

.slip-weight-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  padding: 2px 0;
}

.slip-weight-row.net {
  font-size: 1rem;
  font-weight: 800;
  border-top: 1px dashed #475569;
  padding-top: 6px;
  margin-top: 4px;
  color: #064e3b;
}

.slip-barcode-area {
  text-align: center;
  margin: 14px 0;
}

.fake-barcode {
  display: inline-block;
  font-size: 2.2rem;
  letter-spacing: 4px;
  color: #0f172a;
  font-family: monospace;
}

.slip-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  font-size: 0.6875rem;
  border-top: 1px solid #cbd5e1;
  padding-top: 8px;
}

/* ==========================================================================
   Inventory Badges & Demographics
   ========================================================================== */

.inventory-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .inventory-summary-cards { grid-template-columns: repeat(2, 1fr); }
}

.inv-badge-card {
  background: var(--white);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 16px;
}

.inv-badge-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--dark-500);
  text-transform: uppercase;
}

.inv-badge-val {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--dark-950);
  margin: 4px 0;
}

.inv-badge-sub {
  font-size: 0.6875rem;
  color: var(--primary-700);
}

.demographics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 600px) {
  .demographics-grid { grid-template-columns: repeat(2, 1fr); }
}

.demo-box {
  background: var(--dark-50);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.demo-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-800);
  display: block;
}

.demo-lbl {
  font-size: 0.6875rem;
  color: var(--dark-500);
}

.milk-stats-strip {
  display: flex;
  justify-content: space-between;
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.8125rem;
  flex-wrap: wrap;
  gap: 10px;
}

/* Warabandi */
.warabandi-schedule {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wb-row {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--dark-50);
  border: 1px solid var(--dark-200);
}

.wb-row.active-now {
  background: var(--primary-50);
  border-color: var(--primary-500);
}

.wb-indicator {
  font-size: 0.6875rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--primary-600);
  color: var(--white);
  height: fit-content;
}

.wb-indicator.next {
  background: var(--dark-500);
}

.wb-details {
  flex: 1;
}

.wb-details strong {
  font-size: 0.9375rem;
  display: block;
  color: var(--dark-950);
}

.wb-details span {
  font-size: 0.8125rem;
  color: var(--dark-600);
}

.wb-flow {
  font-size: 0.75rem;
  margin-top: 4px;
  color: var(--primary-800);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 620px;
  width: 100%;
  margin: auto 0;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--dark-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: var(--white);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark-900);
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--dark-500);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--dark-100);
  color: var(--dark-900);
}

.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 10px;
}

.form-row .form-group {
  margin-bottom: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--dark-700);
}

.form-control {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--dark-300);
  font-size: 0.85rem;
  font-family: var(--font-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.kanta-calc-summary {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.readonly-box {
  background: var(--dark-100);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-weight: 700;
  font-family: var(--font-display);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--dark-200);
  flex-shrink: 0;
  background: var(--white);
  position: sticky;
  bottom: 0;
  z-index: 5;
}

/* ==========================================================================
   AgriMobile™ Field Smartphone Simulator Drawer
   ========================================================================== */

.mobile-sim-drawer {
  position: fixed;
  top: 0;
  right: -440px;
  width: 420px;
  height: 100vh;
  background: #0f172a;
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 1200;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.mobile-sim-drawer.open {
  right: 0;
}

.mobile-sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--white);
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 12px;
}

.sim-close-btn {
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
}

.mobile-phone-frame {
  background: #000;
  border: 8px solid #334155;
  border-radius: 36px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  position: relative;
}

.phone-speaker {
  width: 60px;
  height: 4px;
  background: #475569;
  border-radius: 2px;
  margin: 8px auto;
}

.phone-screen {
  background: #f8fafc;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.phone-status-bar {
  display: flex;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: #0f172a;
  color: var(--white);
}

.phone-app-header {
  background: linear-gradient(135deg, #064e3b, #047857);
  color: var(--white);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.phone-user-info {
  display: flex;
  flex-direction: column;
}

.phone-user-role {
  font-size: 0.6875rem;
  color: #a7f3d0;
}

.phone-user-name {
  font-size: 0.875rem;
  font-family: var(--font-urdu), var(--font-main);
}

.phone-lang-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--white);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  cursor: pointer;
}

.phone-content {
  padding: 14px;
  flex: 1;
}

.offline-badge-strip {
  background: #dcfce7;
  color: #15803d;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.phone-quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.phone-action-btn {
  background: var(--white);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-urdu), var(--font-main);
  font-size: 0.75rem;
  color: var(--dark-900);
  font-weight: 700;
  transition: all 0.15s ease;
}

.phone-action-btn:hover {
  background: var(--primary-50);
  border-color: var(--primary-500);
}

.p-btn-icon {
  font-size: 1.5rem;
}

.phone-card {
  background: var(--white);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.75rem;
  font-family: var(--font-urdu), var(--font-main);
}

.p-card-title {
  font-weight: 700;
  color: var(--primary-900);
  border-bottom: 1px solid var(--dark-100);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.phone-sync-status {
  font-size: 0.6875rem;
  color: var(--dark-500);
  text-align: center;
  font-family: var(--font-urdu), var(--font-main);
}

/* Audio Waveform Simulator */
.audio-waveform-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 48px;
  background: #0f172a;
  border-radius: var(--radius-md);
  padding: 8px;
  margin: 10px 0;
}

.wave-bar {
  width: 4px;
  height: 10px;
  background: #34d399;
  border-radius: 2px;
  animation: wavePulse 0.8s ease-in-out infinite alternate;
}

.wave-bar:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; height: 35px; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; height: 18px; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; height: 30px; }
.wave-bar:nth-child(6) { animation-delay: 0.5s; height: 14px; }

@keyframes wavePulse {
  from { height: 8px; }
  to { height: 38px; }
}

/* Simulated Camera Card */
.camera-preview-box {
  background: #000;
  border-radius: var(--radius-md);
  padding: 10px;
  color: #fff;
  position: relative;
  text-align: center;
  margin-top: 8px;
}

.camera-watermark {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 0.625rem;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 6px;
  border-radius: 2px;
  text-align: left;
}

/* ==========================================================================
   SMART IOT HARDWARE & TELEMETRY HUB STYLES
   ========================================================================== */

/* Topbar Telemetry Ticker item hover */
.ticker-item#topbarIotPill {
  transition: all 0.2s ease;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.ticker-item#topbarIotPill:hover {
  background: rgba(16, 185, 129, 0.2);
  transform: translateY(-1px);
}

/* Gateway Health Ribbon */
.iot-network-banner {
  background: linear-gradient(135deg, #091322 0%, #0d2238 50%, #062b23 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  color: #fff;
  margin-bottom: 20px;
  box-shadow: 0 10px 25px -5px rgba(3, 45, 34, 0.3);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.iot-banner-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.iot-gateway-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.iot-gateway-glyph {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #059669, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.4);
}

.iot-gateway-details h3 {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.iot-gateway-details p {
  color: #94a3b8;
  font-size: 0.78125rem;
  margin-top: 2px;
}

.iot-network-metrics {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.iot-metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 8px;
}

.iot-metric-item .lbl {
  font-size: 0.6875rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.iot-metric-item .val {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.iot-banner-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  font-size: 0.75rem;
  color: #cbd5e1;
  flex-wrap: wrap;
  gap: 10px;
}

.iot-strip-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.iot-strip-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Domain Filter Tabs */
.iot-tabs-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.iot-tabs-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.iot-tab-btn {
  padding: 8px 16px;
  border-radius: 30px;
  background: #fff;
  border: 1px solid var(--dark-200);
  color: var(--dark-700);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  font-family: var(--font-main);
}

.iot-tab-btn:hover {
  background: var(--dark-50);
  border-color: var(--dark-300);
  color: var(--dark-900);
}

.iot-tab-btn.active {
  background: var(--primary-900);
  color: #fff;
  border-color: var(--primary-900);
  box-shadow: 0 4px 10px rgba(6, 78, 59, 0.25);
}

.iot-tab-btn .tab-count {
  font-size: 0.6875rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--dark-100);
  color: var(--dark-600);
}

.iot-tab-btn.active .tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.iot-tabs-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* IoT Analytics / Charts Grid */
.iot-analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1100px) {
  .iot-analytics-grid {
    grid-template-columns: 1fr;
  }
}

.iot-chart-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--dark-200);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.iot-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.iot-chart-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--dark-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.iot-chart-subtitle {
  font-size: 0.75rem;
  color: var(--dark-500);
  margin-top: 2px;
}

.iot-chart-readout {
  text-align: right;
}

.iot-chart-readout .main-val {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--primary-700);
}

.iot-chart-readout .sub-val {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--dark-500);
}

.iot-svg-chart-wrapper {
  width: 100%;
  height: 180px;
  position: relative;
  margin-top: 4px;
}

.iot-svg-chart {
  width: 100%;
  height: 100%;
}

.iot-chart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--dark-100);
  padding-top: 10px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--dark-600);
}

/* IoT Device Cards Grid */
.iot-device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.iot-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--dark-200);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.iot-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-500);
}

.iot-card.alert-state {
  border-color: var(--crimson-500);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

.iot-card.warning-state {
  border-color: var(--accent-gold-500);
  box-shadow: 0 0 12px rgba(217, 119, 6, 0.15);
}

.iot-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.iot-card-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--dark-500);
  display: flex;
  align-items: center;
  gap: 6px;
}

.iot-domain-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
}

.iot-domain-water { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.iot-domain-soil  { background: rgba(5, 150, 105, 0.12); color: #047857; }
.iot-domain-pump  { background: rgba(217, 119, 6, 0.12); color: #b45309; }
.iot-domain-fleet { background: rgba(79, 70, 229, 0.12); color: #4338ca; }
.iot-domain-stock { background: rgba(147, 51, 234, 0.12); color: #7e22ce; }

.iot-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--dark-900);
  margin-bottom: 2px;
  line-height: 1.3;
}

.iot-card-loc {
  font-size: 0.75rem;
  color: var(--dark-500);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.iot-primary-telemetry {
  background: var(--dark-50);
  border: 1px solid var(--dark-100);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.iot-primary-metric {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--dark-950);
}

.iot-primary-metric.val-good { color: var(--primary-700); }
.iot-primary-metric.val-warn { color: var(--accent-gold-600); }
.iot-primary-metric.val-alert { color: var(--crimson-600); }

.iot-metric-target {
  font-size: 0.6875rem;
  color: var(--dark-500);
  font-weight: 500;
}

.iot-secondary-telemetry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-size: 0.75rem;
  color: var(--dark-700);
  margin-bottom: 14px;
  padding: 0 2px;
}

.iot-sub-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--dark-100);
  padding-bottom: 3px;
}

.iot-sub-row .label {
  color: var(--dark-500);
}

.iot-sub-row .val {
  font-weight: 600;
  font-family: var(--font-mono);
}

.iot-card-footer {
  margin-top: auto;
  border-top: 1px solid var(--dark-100);
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.iot-hw-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.6875rem;
  color: var(--dark-500);
}

.iot-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Edge Rules Grid */
.iot-rules-section {
  margin-top: 30px;
  margin-bottom: 30px;
}

.iot-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.iot-rule-card {
  background: #fff;
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.iot-rule-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-600);
}

.iot-rule-card.rule-alert::before {
  background: var(--crimson-500);
}

.iot-rule-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.iot-rule-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--dark-900);
}

.iot-rule-box {
  background: var(--dark-50);
  border: 1px solid var(--dark-100);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.iot-rule-box .if-line {
  color: #1e3a8a;
  font-weight: 600;
}

.iot-rule-box .then-line {
  color: #065f46;
  font-weight: 700;
}

.iot-rule-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--dark-500);
}

/* Simulation Test Bench */
.iot-sim-panel {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  color: #fff;
  margin-top: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.iot-sim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.iot-sim-header h3 {
  color: #fff;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.iot-sim-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-sim {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.78125rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-sim:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.btn-sim.sim-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fca5a5;
}

.btn-sim.sim-warning:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fde68a;
}

.btn-sim.sim-success:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #6ee7b7;
}

/* SVG GIS Map IoT Node styling */
.svg-layer-iot {
  pointer-events: all;
  transition: opacity 0.3s ease;
}

.iot-pin-group {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.iot-pin-group:hover {
  transform: scale(1.15);
}

.iot-radar-ring {
  transform-origin: center;
  animation: radarPulse 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes radarPulse {
  0% { r: 6; opacity: 0.8; }
  100% { r: 24; opacity: 0; }
}

.iot-pin-marker {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

/* Actuator Modal Slider & Switch */
.actuator-ctrl-card {
  background: var(--dark-50);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.actuator-ctrl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.actuator-range-slider {
  width: 100%;
  accent-color: var(--primary-600);
  cursor: pointer;
}

.actuator-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--dark-500);
  margin-top: 4px;
}

.actuator-stats-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--dark-600);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--dark-200);
}

/* ==========================================================================
   SAP S/4HANA Cloud Integration Hub & Sugarcane CV Scanner Styles
   ========================================================================== */

/* SAP Tenant Banner */
.sap-tenant-banner {
  background: linear-gradient(135deg, #091e3a 0%, #0f2b48 50%, #064e3b 100%);
  border: 1px solid rgba(2, 132, 199, 0.3);
  border-radius: var(--radius-lg);
  color: var(--white);
  padding: 22px 24px;
  box-shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.2);
}

.sap-banner-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sap-tenant-identity {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sap-logo-badge {
  background: linear-gradient(135deg, #0a6ed1 0%, #0050a0 100%);
  color: #ffffff;
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: 1px;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(10, 110, 209, 0.4);
}

.sap-tenant-meta h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sap-tenant-meta p {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.8);
}

.sap-tenant-meta code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: #38bdf8;
}

.sap-banner-metrics {
  display: flex;
  align-items: center;
  gap: 20px;
}

.sap-metric-box {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  text-align: center;
  min-width: 105px;
}

.sap-metric-box .lbl {
  display: block;
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sap-metric-box .val {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
}

.sap-banner-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
}

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

.sap-strip-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Master Data Synchronization Matrix Grid */
.sap-matrix-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 1100px) {
  .sap-matrix-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .sap-matrix-grid { grid-template-columns: 1fr; }
}

.badge-purple {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
}

.ariba-bid-winner {
  background: #f0fdf4 !important;
  font-weight: 600;
}

.sap-matrix-card {
  background: var(--white);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sap-matrix-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #0284c7;
}

.sap-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--dark-100);
}

.sap-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--dark-900);
}

.sap-card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sap-field-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 0.75rem;
  gap: 8px;
}

.sap-field-row .lbl {
  color: var(--dark-500);
  font-weight: 500;
}

.sap-field-row .val {
  color: var(--dark-900);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.sap-card-footer {
  padding: 10px 16px;
  background: var(--dark-50);
  border-top: 1px solid var(--dark-100);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-size: 0.6875rem;
  color: var(--dark-500);
  text-align: center;
}

/* Architecture Flow Steps */
.sap-architecture-panel {
  background: var(--white);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.sap-arch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sap-arch-header h4 {
  margin: 0;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dark-900);
}

.sap-arch-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 850px) {
  .sap-arch-steps { flex-direction: column; }
  .arch-arrow { transform: rotate(90deg); }
}

.arch-step-box {
  flex: 1;
  background: var(--dark-50);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 14px;
}

.arch-step-box.highlight {
  background: #f0fdf4;
  border-color: #86efac;
}

.step-num {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #0284c7;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.arch-step-box strong {
  font-size: 0.875rem;
  color: var(--dark-900);
  display: block;
}

.arch-step-box p {
  margin: 4px 0 0;
  font-size: 0.6875rem;
  color: var(--dark-600);
  line-height: 1.4;
}

.arch-arrow {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0284c7;
}

/* Sugarcane Computer Vision Scanner Layout */
.cv-scanner-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
}

@media (max-width: 780px) {
  .cv-scanner-layout { grid-template-columns: 1fr; }
}

.cv-camera-frame {
  background: #0f172a;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #334155;
  display: flex;
  flex-direction: column;
}

.cv-camera-header {
  background: rgba(15, 23, 42, 0.95);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.6875rem;
  color: #f1f5f9;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: recBlink 1s infinite alternate;
}

@keyframes recBlink {
  0% { opacity: 1; }
  100% { opacity: 0.2; }
}

.cv-fps-tag {
  margin-left: auto;
  font-family: var(--font-mono);
  color: #22c55e;
  font-weight: 600;
}

.cv-viewport-svg {
  position: relative;
  background: #000000;
}

.cv-feed-svg {
  width: 100%;
  height: auto;
  display: block;
}

.cv-hud-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 10px 12px;
  background: #1e293b;
  border-top: 1px solid #334155;
}

.hud-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.hud-lbl {
  color: #94a3b8;
}

.hud-val {
  font-weight: 700;
}

.cv-controls-panel {
  display: flex;
  flex-direction: column;
}

.cpr-calc-card {
  background: #f8fafc;
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
}

.cpr-calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--dark-600);
}

.cpr-calc-row.highlight {
  background: #f0fdf4;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.cpr-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--dark-300);
  font-weight: 800;
  font-size: 0.9375rem;
  color: #064e3b;
}

/* OData JSON Payload Viewer */
.sap-payload-viewer {
  background: #0b0f19;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #1e293b;
}

.payload-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #131b2e;
  padding: 8px 14px;
  font-size: 0.6875rem;
  color: #94a3b8;
  border-bottom: 1px solid #1e293b;
}

.payload-bar strong {
  color: #38bdf8;
}

.sap-json-code {
  margin: 0;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #a5f3fc;
  line-height: 1.5;
  max-height: 380px;
  overflow-y: auto;
}

/* ==========================================================================
   Block 360° Dossier & ABC Cost Drill-Down Component Styling
   ========================================================================== */

.dossier-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 700px) {
  .dossier-grid { grid-template-columns: repeat(2, 1fr); }
}

.dossier-kpi-card {
  background: var(--dark-50);
  border: 1px solid var(--dark-200);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.dossier-kpi-lbl {
  font-size: 0.6875rem;
  color: var(--dark-500);
  text-transform: uppercase;
  font-weight: 600;
  display: block;
}

.dossier-kpi-val {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dark-950);
  margin-top: 4px;
  display: block;
}

.dossier-section-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--dark-900);
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cost-stacked-bar {
  display: flex;
  height: 20px;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0 12px;
}

.cost-slice {
  height: 100%;
  transition: width 0.3s ease;
}

.cost-slice.fert { background: #10b981; }
.cost-slice.chem { background: #06b6d4; }
.cost-slice.labour { background: #f59e0b; }
.cost-slice.fuel { background: #ef4444; }
.cost-slice.water { background: #3b82f6; }
.cost-slice.ovhd { background: #8b5cf6; }

.cost-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  font-size: 0.75rem;
}

@media (max-width: 600px) {
  .cost-legend { grid-template-columns: 1fr; }
}

.cost-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cost-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}



