/**
 * ====================================================================
 * DASHBOARD PENGELOLA AKUAPONIK ECO FARM UNNES
 * STYLE & UI SYSTEM
 * ====================================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-dark: #081514;
  --bg-card: #0d211e;
  --bg-card-hover: #112a26;
  --bg-input: #0a1b18;
  --border-card: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(96, 178, 96, 0.35);

  --teal-deep: #105157;
  --teal-light: #16646b;
  --green-action: #60b260;
  --green-bright: #38ef7d;
  --green-dark: #1b4b22;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #0284c7;

  --text-white: #ffffff;
  --text-slate: #cbd5e1;
  --text-muted: #809a93;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

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

.hidden {
  display: none !important;
}

body.dashboard-body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-dark);
  color: var(--text-slate);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ====================================================================
   1. AUTHENTICATION LOCK SCREEN MODAL
   ==================================================================== */
/* SINKRONISASI SESI CEPAT: Cegah Flash Modal & Autofill Password saat Refresh */
html.is-authenticated .auth-overlay,
html.is-authenticated #auth-modal {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

html.is-authenticated .dashboard-wrapper,
html.is-authenticated #dashboard-app {
  display: flex !important;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(16, 81, 87, 0.6) 0%, rgba(8, 21, 20, 0.95) 70%, #050e0d 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.auth-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.auth-card {
  background: linear-gradient(145deg, #0e2724, #081715);
  border: 1px solid rgba(96, 178, 96, 0.3);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(96, 178, 96, 0.15);
  text-align: center;
}

.auth-badge-icon {
  width: 64px;
  height: 64px;
  background: rgba(96, 178, 96, 0.12);
  border: 1px solid rgba(96, 178, 96, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 18px;
}

.auth-header .auth-subtag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--green-bright);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.auth-header h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: -0.01em;
}

.auth-header p {
  margin: 0 0 24px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-form .input-group {
  text-align: left;
  margin-bottom: 18px;
}

.auth-form label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-slate);
  margin-bottom: 6px;
}

.password-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-wrap input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 12px 42px 12px 14px;
  font-size: 15px;
  color: #ffffff;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.password-field-wrap input:focus {
  border-color: var(--green-bright);
  box-shadow: 0 0 0 3px rgba(56, 239, 125, 0.2);
}

.btn-toggle-eye {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: 0.7;
}
.btn-toggle-eye:hover {
  opacity: 1;
}

.auth-error {
  margin-top: 8px;
  font-size: 12px;
  color: #f87171;
  font-weight: 600;
}

.auth-hint-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  text-align: left;
}

.auth-hint-box code {
  background: rgba(56, 239, 125, 0.15);
  color: var(--green-bright);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-auth-submit {
  width: 100%;
  background: var(--green-action);
  color: #ffffff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(96, 178, 96, 0.35);
  transition: all 0.2s ease;
}

.btn-auth-submit:hover {
  background: #4fa04f;
  transform: translateY(-1px);
}

.btn-auth-back {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px;
  transition: color 0.15s ease;
}

.btn-auth-back:hover {
  color: var(--text-white);
}

/* ====================================================================
   2. DASHBOARD MAIN WRAPPER
   ==================================================================== */
.dashboard-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.dashboard-wrapper.hidden {
  display: none;
}

/* TOP HEADER */
.dash-header {
  height: 64px;
  background: rgba(10, 26, 24, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-card);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.dash-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-brand-info strong {
  display: block;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: -0.01em;
}

.dash-brand-info small {
  display: block;
  font-size: 11px;
  color: var(--green-bright);
}

.dash-status-strip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-online .status-dot {
  background: var(--green-bright);
  box-shadow: 0 0 8px var(--green-bright);
}

.status-sync .status-dot {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}

.status-ready .status-dot {
  background: var(--green-bright);
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-clock {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-pill-subtle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-slate);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pill-subtle:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-white);
}

.btn-pill-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pill-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
}

/* ====================================================================
   MAIN DASHBOARD GRID LAYOUT
   ==================================================================== */
.dash-main-content {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex: 1;
}

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* CARD CONTAINER */
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-icon {
  font-size: 22px;
}

.card-title-group h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-white);
}

.card-title-group p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

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

.tab-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-slate);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-pill.active {
  background: var(--green-action);
  color: #ffffff;
  border-color: var(--green-action);
}

/* ====================================================================
   CAMERA TOP-DOWN VIEW
   ==================================================================== */
.camera-feed-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #060e0d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 14px;
}

.camera-canvas-el, .camera-stream-el {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.camera-hud-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-top, .hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-tag {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #e2e8f0;
}

.rec-dot {
  color: #ef4444;
  font-weight: 700;
}

/* CAMERA METRICS GRID */
.camera-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.vision-metric-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
}

.v-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.v-val {
  font-size: 18px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-white);
  margin-bottom: 6px;
}

.highlight-psi {
  color: var(--green-bright);
}

.v-bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.v-bar > div {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.metric-green .v-bar > div { background: #22c55e; }
.metric-yellow .v-bar > div { background: #eab308; }
.metric-brown .v-bar > div { background: #8b5cf6; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-optimal {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-warning {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.camera-control-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.strip-label {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-micro {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-slate);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-micro:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.btn-micro-alt {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}

.stream-input-panel {
  margin-top: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.stream-url-row {
  display: flex;
  gap: 8px;
  margin: 6px 0;
}

.stream-url-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 8px 12px;
  color: #ffffff;
  font-size: 12.5px;
}

/* ====================================================================
   SPK SUGENO & ACTION CONFIRMATION ZONE
   ==================================================================== */
.card-decision-spk {
  border-color: rgba(96, 178, 96, 0.3);
  background: linear-gradient(180deg, #0d2621 0%, #0a1b18 100%);
}

.spk-decision-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.spk-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  gap: 20px;
}

.spk-sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.spk-huge-number {
  font-size: 38px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--green-bright);
  line-height: 1.1;
}

.spk-volume-calc {
  font-size: 13px;
  color: #a7f3d0;
  font-weight: 600;
}

.spk-badges-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: right;
}

.spk-badge-item small {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.spk-badge-item strong {
  font-size: 13px;
  display: block;
}

.action-alert-banner {
  background: rgba(96, 178, 96, 0.08);
  border: 1px solid rgba(96, 178, 96, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.alert-icon {
  font-size: 20px;
}

.alert-text strong {
  display: block;
  font-size: 13px;
  color: #ffffff;
  margin-bottom: 2px;
}

.alert-text p {
  margin: 0;
  font-size: 12px;
  color: var(--text-slate);
  line-height: 1.4;
}

.action-button-group {
  display: flex;
  gap: 12px;
}

.btn-action-confirm {
  flex: 2;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
  transition: all 0.2s ease;
}

.btn-action-confirm:hover {
  background: linear-gradient(135deg, #2ecc71 0%, #15803d 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.45);
}

.btn-action-confirm .btn-ic {
  font-size: 28px;
}

.btn-action-confirm .btn-lbl strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.btn-action-confirm .btn-lbl small {
  display: block;
  font-size: 11.5px;
  color: #dcfce7;
  opacity: 0.9;
}

.btn-action-reject {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 14px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action-reject:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

/* PROGRESS BAR */
.exchange-progress-box {
  margin-top: 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(56, 239, 125, 0.3);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: #a7f3d0;
  margin-bottom: 8px;
}

.progress-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38ef7d, #38bdf8);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.btn-micro-danger {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

/* ====================================================================
   RIGHT COLUMN: TELEMETRY SENSORS & ACTUATORS
   ==================================================================== */
.sensors-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.sensor-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.s-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.s-name {
  font-weight: 600;
  color: var(--text-slate);
  flex: 1;
  margin-left: 6px;
}

.s-main-val {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}

.s-num {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-white);
}

.s-unit {
  font-size: 13px;
  color: var(--text-muted);
}

.s-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.s-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
}

.s-bar-indicator {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  background: var(--green-bright);
  border-radius: 3px;
  transform: translateX(-50%);
}

.s-bar-fill-turb {
  height: 100%;
  background: #38bdf8;
  border-radius: 3px;
}

.s-bar-fill-level {
  height: 100%;
  background: #22c55e;
  border-radius: 3px;
}

.sensor-slider-row input[type="range"] {
  width: 100%;
  height: 4px;
  accent-color: var(--green-bright);
  cursor: pointer;
  opacity: 0.6;
}
.sensor-slider-row input[type="range"]:hover {
  opacity: 1;
}

.s-sub-weather {
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
}

/* ACTUATORS STATUS */
.actuators-status-strip {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.sub-heading {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.actuator-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.act-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.act-chip .act-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
  margin-bottom: 2px;
}

.act-chip.active .act-dot {
  background: var(--green-bright);
  box-shadow: 0 0 6px var(--green-bright);
}

.act-name {
  font-size: 11px;
  color: var(--text-muted);
}

.act-state {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-slate);
}

.act-chip.active .act-state {
  color: #4ade80;
}

/* ====================================================================
   DATABASE / API SETUP
   ==================================================================== */
.db-setup-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-slate);
  margin-bottom: 6px;
}

.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: #ffffff;
  outline: none;
}

.input-with-button {
  display: flex;
  gap: 8px;
}

.input-with-button input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: #ffffff;
  outline: none;
}

.btn-small-primary {
  background: var(--teal-deep);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-small-primary:hover {
  background: var(--teal-light);
}

.btn-small-subtle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

.text-muted {
  color: var(--text-muted);
  font-size: 11.5px;
}

.json-schema-accordion {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
}

.json-schema-accordion summary {
  cursor: pointer;
  font-weight: 600;
  color: #38bdf8;
}

.json-snippet {
  margin: 10px 0 0;
  background: #040908;
  padding: 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #94a3b8;
  overflow-x: auto;
}

/* ====================================================================
   BOTTOM AUDIT LOG TABLE
   ==================================================================== */
.dash-footer-log {
  padding: 0 24px 24px;
}

.log-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.btn-micro-subtle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

.log-table-wrapper {
  overflow-x: auto;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.log-table th {
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.log-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tag-opt {
  color: #4ade80;
  font-family: var(--font-mono);
}

.tag-warn {
  color: #facc15;
  font-family: var(--font-mono);
}

.badge-done {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.badge-executed {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
  .dash-main-content {
    grid-template-columns: 1fr;
  }
  .dash-header {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .camera-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sensors-grid {
    grid-template-columns: 1fr;
  }
  .action-button-group {
    flex-direction: column;
  }
}

/* ====================================================================
   SUBNAV TABS (OPSI A: UNIFIED ALL-IN-ONE DASHBOARD)
   ==================================================================== */
.dash-subnav-bar {
  background: #091a18;
  border-bottom: 1px solid var(--border-card);
  padding: 10px 24px;
  position: sticky;
  top: 60px;
  z-index: 90;
  backdrop-filter: blur(10px);
}

.dash-subnav-inner {
  max-width: 1540px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.dash-nav-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.dash-nav-tab:hover {
  background: rgba(96, 178, 96, 0.12);
  border-color: var(--border-accent);
  color: #ffffff;
}

.dash-nav-tab.active {
  background: rgba(56, 239, 125, 0.15);
  border-color: var(--green-bright);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(56, 239, 125, 0.2);
}

.tab-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.2s ease;
}

.dash-nav-tab.active .tab-indicator-dot {
  background: var(--green-bright);
  box-shadow: 0 0 6px var(--green-bright);
}

.tab-view-pane.hidden {
  display: none !important;
}

.dash-footer {
  padding: 24px 32px;
  border-top: 1px solid var(--border-card);
  font-size: 0.82rem;
  color: var(--text-muted);
  background: #061110;
  margin-top: 32px;
}

/* ====================================================================
   LIVE MONITORING TANAMAN COMPONENTS & UNIFIED MANAGER INTEGRATION
   Scoped styles for 24-Zone Heatmap, Camera Feed HUD, SPK Action,
   Telemetri Mutu Air, and Hardware Setup Modal
   ==================================================================== */

/* CAMERA FEED CONTROLS & HUD */
.card-camera-view {
  min-width: 0;
}

.camera-switch-panel {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 4px;
}

.switch-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.switch-btn:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.06);
}

.switch-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

#dashBtnMonitor.active {
  background: rgba(56, 239, 125, 0.15);
  color: var(--green-bright);
  border-color: rgba(56, 239, 125, 0.4);
}

#dashBtnStream.active {
  background: rgba(245, 158, 11, 0.18);
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.4);
}

.btn-icon-setting {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon-setting:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(96, 178, 96, 0.4);
}

.dot-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot-green {
  background: var(--green-bright);
  box-shadow: 0 0 6px var(--green-bright);
}

.dot-amber {
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}

.stream-timer-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 5, 8, 0.88);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  backdrop-filter: blur(4px);
}

.stream-timer-countdown {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  color: #f87171;
}

.btn-stop-sm {
  background: #dc2626;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-stop-sm:hover {
  background: #b91c1c;
}

.stream-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 21, 20, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-slate);
  font-size: 13px;
  padding: 16px;
  text-align: center;
  z-index: 5;
}

.stream-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(96, 178, 96, 0.2);
  border-top-color: var(--green-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 24-ZONE PLANAR HEATMAP GRID */
.heatmap {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

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

.tile {
  position: relative;
  background: #0a1b18;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  cursor: pointer;
  color: #ffffff;
  font-family: var(--font-sans);
  text-align: center;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  user-select: none;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: var(--green-bright);
  box-shadow: 0 4px 12px rgba(56, 239, 125, 0.2);
  z-index: 2;
}

.tile:focus-visible, .tile.active {
  outline: 2px solid var(--green-bright);
  outline-offset: 2px;
  border-color: var(--green-bright);
  box-shadow: 0 0 10px rgba(56, 239, 125, 0.4);
}

.tile.empty {
  background: #091715;
  color: var(--text-muted);
}

.tile-id {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.9;
  margin-bottom: 2px;
}

.tile-cov {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
}

.tile-kes {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.4);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 10px;
}

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

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.zone-detail {
  margin-top: 12px;
  padding: 12px 14px;
  background: #091a17;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.5;
}

.zone-detail b {
  color: #ffffff;
}

.zone-detail .kv {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 6px;
}

/* MULTI-LAYER CONTROLS */
.layer-control-wrap {
  background: #091a17;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.layer-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.layer-tab {
  flex: 1;
  min-width: 130px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.layer-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-white);
}

.layer-tab.active {
  background: var(--green-action);
  color: #ffffff;
  border-color: var(--green-action);
  box-shadow: 0 2px 8px rgba(96, 178, 96, 0.3);
}

/* AGRONOMY REKOMENDASI & CHIPS */
.reko {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-white);
  background: rgba(0, 0, 0, 0.25);
  padding: 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--green-bright);
  margin: 0 0 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  background: #091a17;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 11.5px;
  color: var(--text-slate);
}

.chip b {
  color: var(--green-bright);
  font-family: var(--font-mono);
}

/* SENSOR & TELEMETRI REFINEMENTS */
.s-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.s-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--green-bright);
}

.mode-data-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.dot-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.text-optimal {
  color: #4ade80 !important;
}

.text-warning {
  color: #facc15 !important;
}

.text-danger {
  color: #f87171 !important;
}

/* SPK ACTION & DECISION REFINEMENTS */
.spk-action-zone {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spk-output-main {
  display: flex;
  flex-direction: column;
}

.btn-action-dismiss {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 14px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action-dismiss:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-abort-action {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-abort-action:hover {
  background: rgba(239, 68, 68, 0.35);
  color: #ffffff;
}

.progress-step-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #a7f3d0;
  margin-bottom: 6px;
}

/* UNIFIED DASHBOARD TABLE */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.dash-table th {
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.dash-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-slate);
  white-space: nowrap;
}

.dash-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* GROWTH CYCLE SECTION 4 SCOPED STYLING */
#growth-panel-content .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

#growth-panel-content .card.stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

#growth-panel-content .card.stat h2 {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 6px;
}

#growth-panel-content .stat-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-white);
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

#growth-panel-content .stat-value .unit {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

#growth-panel-content .muted {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
}

/* HARDWARE NETWORK CONFIG MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-card {
  background: linear-gradient(160deg, #0e2724, #081715);
  border: 1px solid rgba(96, 178, 96, 0.35);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-white);
}

.btn-modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.btn-modal-close:hover {
  color: #ffffff;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: #ffffff;
  outline: none;
  font-family: inherit;
  margin-top: 4px;
}

.form-input:focus {
  border-color: var(--green-bright);
  box-shadow: 0 0 0 2px rgba(56, 239, 125, 0.2);
}

.modal-body {
  padding: 4px 0 0;
}

.hint-text {
  font-size: 12px;
  color: #94a3b8;
}

.metric-psi {
  border-color: rgba(56, 239, 125, 0.25);
  background: rgba(56, 239, 125, 0.04);
}

.modal-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* LAYOUT CONTAINER REFINEMENTS */
.dash-col-left, .dash-col-right {
  min-width: 0;
}

.dash-header-left {
  display: flex;
  align-items: center;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1540px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 12px;
}

/* ====================================================================
   SPECIES AGRONOMY NOTE BANNER (KANGKUNG IDENTIFICATION)
   ==================================================================== */
.species-info-card {
  background: linear-gradient(135deg, rgba(16, 81, 87, 0.45), rgba(13, 33, 30, 0.9));
  border: 1px solid rgba(96, 178, 96, 0.35);
  border-left: 4px solid var(--green-bright);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.species-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.species-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--green-bright);
  background: rgba(56, 239, 125, 0.15);
  border: 1px solid rgba(56, 239, 125, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.species-sci-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-white);
}

.species-info-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-slate);
}

.species-info-text strong {
  color: #a7f3d0;
}

