/* AgroTiram Enterprise™ - Master Stylesheet */
:root {
  /* Palette & Brand Tokens */
  --hue-primary: 155; /* Emerald / Mushroom Green */
  --hue-accent: 215;  /* Deep Indigo / Corporate Blue */
  --hue-amber: 40;
  --hue-rose: 350;
  --hue-purple: 270;
  
  /* Midnight Enterprise Dark Theme (Default) */
  --bg-app: #030712;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 185, 129, 0.6);
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --primary: hsl(var(--hue-primary), 75%, 45%);
  --primary-hover: hsl(var(--hue-primary), 75%, 52%);
  --primary-light: rgba(16, 185, 129, 0.12);
  
  --accent: hsl(var(--hue-accent), 80%, 55%);
  --accent-light: rgba(59, 130, 246, 0.12);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: rgba(239, 68, 68, 0.15);
  --info: #06b6d4;
  --info-light: rgba(6, 182, 212, 0.15);
  
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.2);
  
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

/* Light Theme Overrides */
[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --border-card: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(16, 185, 129, 0.8);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: rgba(16, 185, 129, 0.1);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(5, 150, 105, 0.15);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 40px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Light */
.premium-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 60vh;
  z-index: -1;
  background: radial-gradient(circle at 50% -10%, rgba(16, 185, 129, 0.15) 0%, rgba(59, 130, 246, 0.08) 40%, transparent 80%);
  pointer-events: none;
}

/* Telemetry Microclimate Ticker */
.telemetry-bar {
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid var(--border-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0.78rem;
  padding: 6px 0;
  position: sticky;
  top: 0;
  z-index: 120;
}

[data-theme="light"] .telemetry-bar {
  background: rgba(241, 245, 249, 0.9);
}

.telemetry-inner {
  width: 92%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.telemetry-inner::-webkit-scrollbar {
  display: none;
}

.telemetry-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pulse {
  font-weight: 700;
  color: var(--success);
  letter-spacing: 0.5px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulseAnim 1.8s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.kumbung-badge {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  color: var(--text-secondary);
}

[data-theme="light"] .kumbung-badge {
  background: rgba(0, 0, 0, 0.06);
}

.telemetry-val {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.btn-micro {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--border-card);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-micro:hover {
  background: var(--primary);
  color: white;
}

/* Header Area */
.app-header {
  position: sticky;
  top: 33px; /* Right beneath telemetry bar */
  z-index: 110;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(3, 7, 18, 0.85);
  border-bottom: 1px solid var(--border-card);
  transition: all 0.3s ease;
}

[data-theme="light"] .app-header {
  background: rgba(248, 250, 252, 0.9);
}

.header-container {
  width: 92%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 0 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-wrapper {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--text-primary);
}

.brand-accent {
  color: var(--success);
  margin-left: 1px;
}

.enterprise-tag {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: -0.2px;
}

/* Greeting Badge (Original Test-ID Target) */
.tracker-header__greeting {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--primary-light);
  border: 1px solid var(--border-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  letter-spacing: -0.2px;
}

@media (max-width: 900px) {
  .tracker-header__greeting {
    display: none;
  }
}

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

.btn-ghost {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

.file-input-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.08);
}

/* Module Navigation Tabs */
.module-nav {
  border-top: 1px solid var(--border-card);
  background: rgba(10, 15, 26, 0.4);
}

[data-theme="light"] .module-nav {
  background: rgba(255, 255, 255, 0.5);
}

.nav-container {
  width: 92%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 6px 0;
}

.nav-container::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .nav-tab:hover {
  background: rgba(0, 0, 0, 0.04);
}

.nav-tab.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.3);
}

/* Content Container */
.app-content {
  width: 92%;
  max-width: 1400px;
  margin: 24px auto 0 auto;
}

/* Tab Panes */
.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

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

/* Glassmorphism Cards */
.card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Farm Hero Banner */
.farm-hero-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 95, 70, 0.05));
  border-color: rgba(16, 185, 129, 0.2);
}

@media (max-width: 900px) {
  .farm-hero-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.hero-status-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.status-indicator-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.date-now-badge {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hero-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.hero-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 650px;
}

.hero-quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Executive KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.kpi-card {
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.kpi-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.kpi-green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.kpi-emerald { background: rgba(5, 150, 105, 0.15); color: #059669; }
.kpi-purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.kpi-amber { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.kpi-rose { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.kpi-content {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.kpi-value small {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-subtext {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.text-emerald { color: #10b981 !important; }
.text-blue { color: #3b82f6 !important; }
.text-purple { color: #a855f7 !important; }
.text-amber { color: #f59e0b !important; }
.text-rose { color: #ef4444 !important; }

/* Section Blocks */
.section-block {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 16px;
  gap: 16px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Kumbung Cards Grid */
.kumbung-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
}

.kumbung-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-left: 4px solid var(--primary);
}

.kumbung-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.kumbung-title-area h4 {
  font-size: 1.05rem;
  font-weight: 700;
}

.kumbung-location {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-chip {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-chip.optimal { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.status-chip.warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-chip.danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }

.kumbung-sensors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: var(--radius-sm);
}

[data-theme="light"] .kumbung-sensors {
  background: rgba(0, 0, 0, 0.03);
}

.sensor-item {
  display: flex;
  flex-direction: column;
}

.sensor-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.sensor-value {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.kumbung-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kumbung-meta-row {
  display: flex;
  justify-content: space-between;
}

/* Analytics Charts */
.analytics-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

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

.chart-card {
  display: flex;
  flex-direction: column;
}

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

.chart-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 12px;
}

.chart-container {
  height: 240px;
  width: 100%;
  position: relative;
}

.chart-container svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

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

.legend-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Donut Chart */
.donut-chart-wrapper {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-chart-wrapper svg {
  height: 160px;
  width: 160px;
}

.grade-legend-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.grade-legend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.grade-pill {
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.72rem;
}

.grade-pill-a { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.grade-pill-b { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.grade-pill-c { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.grade-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Pane Header & Subheaders */
.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .pane-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.pane-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.pane-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

/* Filter Card */
.filter-card {
  padding: 14px 20px;
  margin-bottom: 20px;
}

.filter-row {
  display: flex;
  gap: 16px;
  align-items: center;
}

@media (max-width: 768px) {
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }
}

.filter-select-wrapper select {
  min-width: 220px;
}

/* Batch Cards Grid */
.batch-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.batch-card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.batch-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.batch-id-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.batch-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 4px;
}

.batch-strain {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.batch-progress-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.batch-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.progress-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

[data-theme="light"] .progress-bar-bg {
  background: rgba(0, 0, 0, 0.08);
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.4s ease;
}

.batch-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: rgba(0, 0, 0, 0.15);
  padding: 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}

[data-theme="light"] .batch-stats-grid {
  background: rgba(0, 0, 0, 0.03);
}

.batch-stat-val {
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.batch-stat-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.batch-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
  border-top: 1px solid var(--border-card);
  padding-top: 12px;
}

/* Summary Ribbon */
.summary-ribbon {
  display: flex;
  justify-content: space-around;
  padding: 18px 24px;
  margin-bottom: 20px;
  align-items: center;
}

@media (max-width: 768px) {
  .summary-ribbon {
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }
  .ribbon-divider {
    display: none;
  }
}

.ribbon-col {
  display: flex;
  flex-direction: column;
}

.ribbon-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.ribbon-val {
  font-size: 1.3rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.ribbon-divider {
  width: 1px;
  height: 36px;
  background: var(--border-card);
}

/* Tables */
.table-card {
  padding: 0;
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.enterprise-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 18px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-card);
  white-space: nowrap;
}

[data-theme="light"] .enterprise-table th {
  background: rgba(0, 0, 0, 0.02);
}

.enterprise-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-card);
  color: var(--text-primary);
  vertical-align: middle;
}

.enterprise-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .enterprise-table tr:hover td {
  background: rgba(0, 0, 0, 0.015);
}

.table-btn {
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.table-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--primary);
}

.table-btn-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* QC Guidelines */
.qc-guidelines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.guideline-card {
  padding: 20px;
}

.border-green { border-top: 3px solid #10b981; }
.border-amber { border-top: 3px solid #f59e0b; }
.border-purple { border-top: 3px solid #a855f7; }

.guideline-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}

.guideline-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.guideline-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Inventory Grid */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.inventory-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.inventory-name {
  font-size: 1rem;
  font-weight: 700;
}

.inventory-category-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.inventory-stock-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 6px 0;
}

.inventory-stock-num {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.inventory-stock-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.inventory-alert {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.alert-low {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

/* Export Cards */
.export-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.export-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
}

.export-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex-grow: 1;
}

/* ============================================================ */
/* FINANCIAL / CASHFLOW SECTION (ORIGINAL CLASSES PRESERVED)   */
/* ============================================================ */

.summary-section {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .summary-section {
    flex-direction: column;
  }
}

.balance-card {
  flex: 1 1 340px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.05));
  border-color: rgba(16, 185, 129, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.summary-grid {
  flex: 2 1 600px;
  display: flex;
  gap: 18px;
}

@media (max-width: 576px) {
  .summary-grid {
    flex-direction: column;
  }
}

.summary-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.summary-indicator {
  width: 6px;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
}

.indicator-income { background-color: var(--success); }
.indicator-expense { background-color: var(--danger); }

.summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-family: var(--font-mono);
}

#netBalance {
  font-size: 2rem;
  color: var(--text-primary);
}

.grid-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
  align-items: start;
}

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

.form-card {
  padding: 24px;
}

.card-header {
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

label small {
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

.input-wrapper {
  position: relative;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1.5px solid var(--border-card);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="date"],
[data-theme="light"] select {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #059669);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-text {
  background: transparent;
  color: var(--text-muted);
  box-shadow: none;
}

.btn-text:hover {
  color: var(--text-primary);
  background: var(--border-card);
}

/* Search Box */
.search-card {
  margin-bottom: 24px;
  padding: 14px 20px;
}

.search-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper input {
  padding-left: 42px;
}

/* Lists Layout */
.lists-layout {
  display: flex;
  gap: 20px;
}

@media (max-width: 768px) {
  .lists-layout {
    flex-direction: column;
  }
}

.list-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.list-title-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.badge-success { background-color: var(--success); }
.badge-danger { background-color: var(--danger); }

.count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--border-card);
  color: var(--text-secondary);
}

.transaction-list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Transaction Card */
.transaction-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  position: relative;
}

.transaction-item-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.income-card {
  border-left: 4px solid var(--success);
}

.expense-card {
  border-left: 4px solid var(--danger);
}

.transaction-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.transaction-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.transaction-amount {
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.income-card .transaction-amount { color: var(--success); }
.expense-card .transaction-amount { color: var(--danger); }

.transaction-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.transaction-actions {
  display: flex;
  gap: 6px;
}

.btn-action {
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s ease;
}

.btn-toggle-type:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-delete-trans:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-card);
}

/* ============================================================ */
/* MODAL OVERLAYS & POPUPS                                      */
/* ============================================================ */

.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.dialog-overlay.active {
  opacity: 1;
  visibility: visible;
}

.dialog-card {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-md);
  padding: 24px;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.dialog-overlay.active .dialog-card {
  transform: scale(1);
}

.modal-lg {
  max-width: 680px;
}

.dialog-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.dialog-alert-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.icon-success { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.icon-primary { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.icon-emerald { background: rgba(5, 150, 105, 0.15); color: #059669; }
.icon-blue { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }

.dialog-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.dialog-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 576px) {
  .modal-form-grid {
    grid-template-columns: 1fr;
  }
}

.weights-input-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

@media (max-width: 576px) {
  .weights-input-box {
    grid-template-columns: 1fr;
  }
}

.total-weight-banner {
  background: var(--primary-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 0.95rem;
}

.total-weight-banner strong {
  font-size: 1.25rem;
  color: var(--primary);
  font-family: var(--font-mono);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  animation: slideToast 0.3s ease-out;
}

@keyframes slideToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-success { border-left: 4px solid var(--success); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-danger { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--info); }

/* Footer */
.app-footer {
  margin-top: 48px;
  border-top: 1px solid var(--border-card);
  padding-top: 24px;
}

.footer-container {
  width: 92%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-logo {
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 8px;
}

/* ============================================================ */
/* PRINT FORMATTING & INVOICE DOCUMENT STYLES                   */
/* ============================================================ */

.invoice-container {
  background: #ffffff;
  color: #111827;
  padding: 28px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.5;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #059669;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.invoice-brand h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #059669;
}

.invoice-brand p {
  font-size: 0.8rem;
  color: #4b5563;
}

.invoice-meta {
  text-align: right;
  font-family: var(--font-mono);
}

.invoice-meta h3 {
  font-size: 1.1rem;
  color: #111827;
}

.invoice-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.invoice-items-table th, 
.invoice-items-table td {
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
}

.invoice-items-table th {
  background-color: #f3f4f6;
  font-weight: 700;
  text-align: left;
}

.invoice-total-row {
  text-align: right;
  font-size: 1.1rem;
  font-weight: 800;
  color: #059669;
  margin-top: 14px;
}

.invoice-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 20px;
}

.signature-box {
  text-align: center;
  width: 200px;
}

.signature-line {
  border-bottom: 1px solid #111827;
  margin-top: 50px;
  margin-bottom: 4px;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
  }
  .telemetry-bar,
  .app-header,
  .module-nav,
  .app-footer,
  .hero-quick-actions,
  .pane-actions,
  .filter-card,
  .search-card,
  .header-actions,
  .non-printable,
  .dialog-actions,
  .toast-container,
  .premium-bg {
    display: none !important;
  }
  .dialog-overlay {
    position: static !important;
    background: transparent !important;
    display: block !important;
    padding: 0 !important;
  }
  .dialog-card {
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  .tab-pane {
    display: block !important;
  }
}
