/* ==========================================================================
   AquaControl - Sistema de Monitoreo de Agua Potable Rural (APR) y Costos
   Hoja de estilos modular con soporte para modo claro / oscuro y diseño responsivo
   ========================================================================== */

:root {
  --bg: #f3f7fb;
  --panel: #ffffff;
  --panel-alt: #f8fafd;
  --ink: #162638;
  --muted: #64748b;
  --line: #e2e8f0;
  --blue: #2477e8;
  --blue-hover: #1963c7;
  --cyan: #18b2cf;
  --green: #16a34a;
  --orange: #f0a33a;
  --red: #e11d48;
  --purple: #7c3aed;
  --nav: #10243a;
  --nav-surface: #19344e;
  --shadow: 0 8px 28px rgba(25, 52, 82, 0.06);
  --shadow-lg: 0 16px 36px rgba(25, 52, 82, 0.12);
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body.dark {
  --bg: #0b1522;
  --panel: #132235;
  --panel-alt: #182b42;
  --ink: #e2ecf7;
  --muted: #8da2b8;
  --line: #233852;
  --nav: #08101a;
  --nav-surface: #102033;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.45);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font-sans);
  transition: background 0.2s, color 0.2s;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.app {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  background: var(--nav);
  color: #dce8f5;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 10;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

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

.brand-mark {
  height: 42px;
  width: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #30c4dc, #2676e8);
  display: grid;
  place-items: center;
  color: white;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(36, 119, 232, 0.35);
}

.brand strong {
  display: block;
  font-size: 16px;
  color: white;
  letter-spacing: 0.2px;
  font-weight: 700;
}

.brand small {
  color: #9eb5cb;
  font-size: 11px;
}

.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #7891aa;
  padding: 0 12px;
  margin-bottom: 8px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  color: #aebfd0;
  margin: 3px 0;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  font-weight: 500;
}

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

.nav-item.active {
  background: #1d3c5b;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-item span:first-child {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.side-bottom {
  margin-top: auto;
  background: var(--nav-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  padding: 14px;
}

.side-bottom small {
  color: #9bb1c7;
  display: block;
  font-size: 11px;
}

.side-bottom strong {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  color: #ffffff;
  font-size: 13px;
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #35d49c;
  border-radius: 50%;
  box-shadow: 0 0 8px #35d49c;
  animation: pulse-dot 2.5s infinite;
}

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

/* ==========================================================================
   MAIN CONTAINER
   ========================================================================== */
main {
  padding: 26px clamp(16px, 2.8vw, 38px) 38px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

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

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  font-weight: 700;
}

.topbar h1 {
  font-size: clamp(22px, 2.6vw, 29px);
  letter-spacing: -0.7px;
  margin: 4px 0 0;
  font-weight: 800;
}

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

.date-chip, .status-chip, .theme-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* ==========================================================================
   RELOJ DIGITAL EN VIVO (DESTACADO Y PROMINENTE)
   ========================================================================== */
.clock-chip {
  border: 1px solid rgba(36, 119, 232, 0.28);
  background: var(--panel);
  border-radius: 12px;
  padding: 5px 14px 6px;
  box-shadow: 0 4px 14px rgba(36, 119, 232, 0.08);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-width: 145px;
  line-height: 1.1;
  transition: all 0.2s ease;
}

.clock-chip:hover {
  border-color: rgba(36, 119, 232, 0.55);
  box-shadow: 0 6px 18px rgba(36, 119, 232, 0.15);
}

.clock-chip-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.clock-chip-label {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--muted);
  user-select: none;
}

.clock-digits {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  color: #1d4ed8;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1.2px;
  font-family: 'SF Mono', 'Roboto Mono', 'Cascadia Code', 'Consolas', monospace, sans-serif;
}

body.dark .clock-chip {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(16, 26, 44, 0.92);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body.dark .clock-chip:hover {
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.25);
}

body.dark .clock-chip-label {
  color: #93c5fd;
}

body.dark .clock-digits {
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* SELECTOR DE CALENDARIO (DÍA, MES, AÑO) */
.date-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 3px 6px;
  box-shadow: var(--shadow);
}

.date-chip-interactive {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--muted);
}

.date-input {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  padding: 2px 0;
}

body.dark .date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
  cursor: pointer;
}

.date-nav-btns {
  display: inline-flex;
  gap: 3px;
}

.btn-icon-nav {
  border: 0;
  background: var(--panel-alt);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.15s ease;
  cursor: pointer;
}

.btn-icon-nav:hover {
  background: var(--line);
  color: var(--ink);
}

.status-chip {
  color: #10845c;
  background: #eafaf3;
  border-color: #d3f3e5;
}

body.dark .status-chip {
  background: rgba(22, 163, 74, 0.18);
  border-color: rgba(22, 163, 74, 0.35);
  color: #4ade80;
}

.theme-btn {
  color: var(--ink);
  transition: all 0.15s ease;
}

.theme-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ==========================================================================
   NAVEGACIÓN POR VENTANAS / VISTAS INDEPENDIENTES (SPA)
   ========================================================================== */
.window-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 4px 0 16px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

.win-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  user-select: none;
}

.win-tab:hover {
  color: var(--ink);
  border-color: rgba(36, 119, 232, 0.4);
  background: var(--panel-alt);
}

.win-tab.active {
  background: linear-gradient(135deg, #2477e8, #18b2cf);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(36, 119, 232, 0.35);
}

body.dark .win-tab.active {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.45);
}

.app-window {
  display: none;
  animation: fadeInWindow 0.22s ease-out forwards;
}

.app-window.active {
  display: block;
}

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

/* GRILLAS ESPECÍFICAS DE VENTANA */
.tank-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 22px;
  align-items: stretch;
}

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

.tech-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-content: stretch;
}

.tech-cards-grid .tech-card:nth-child(3),
.tech-card-wide {
  grid-column: 1 / -1;
}

.tech-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tech-card-header h4,
.tech-card h4 {
  font-size: 16.5px;
  font-weight: 800;
  margin: 0 0 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.tech-badge-sub {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.2px;
}

.badge-sub-green {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-sub-blue {
  background: rgba(36, 119, 232, 0.15);
  color: #2477e8;
  border: 1px solid rgba(36, 119, 232, 0.3);
}

.badge-sub-purple {
  background: rgba(147, 51, 234, 0.15);
  color: #9333ea;
  border: 1px solid rgba(147, 51, 234, 0.3);
}

.badge-sub-cyan {
  background: rgba(24, 178, 207, 0.15);
  color: #0891b2;
  border: 1px solid rgba(24, 178, 207, 0.3);
}

.tech-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tech-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  transition: transform 0.15s ease, border-color 0.15s ease;
  min-height: 48px;
}

.tech-list li:hover {
  border-color: rgba(36, 119, 232, 0.4);
}

.tech-list span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.tech-list strong {
  color: var(--ink);
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

/* Resaltados específicos y legibles de datos */
.val-highlight-green {
  color: #16a34a !important;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.32);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 16.5px !important;
  font-weight: 800 !important;
}

.val-highlight-red {
  color: #e11d48 !important;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.32);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 16.5px !important;
  font-weight: 800 !important;
}

.val-highlight-blue {
  color: #0284c7 !important;
  background: rgba(2, 132, 199, 0.14);
  border: 1px solid rgba(2, 132, 199, 0.32);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 18.5px !important;
  font-weight: 900 !important;
}

.val-highlight-cyan {
  color: #0891b2 !important;
  background: rgba(8, 145, 178, 0.14);
  border: 1px solid rgba(8, 145, 178, 0.32);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 16.5px !important;
  font-weight: 800 !important;
}

.val-pill-shield {
  color: #2563eb !important;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.3);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 14px !important;
  font-weight: 700 !important;
}

.val-chip-tech {
  color: #6366f1 !important;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 14px !important;
  font-weight: 700 !important;
}

.val-sensor-name {
  color: var(--ink);
  font-size: 14.5px !important;
  font-weight: 700;
  text-align: right;
}

/* Grilla de la tarjeta amplia (Telemetría) */
.tech-card-wide .tech-list,
.tech-list-wide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px 20px;
}

@media (max-width: 680px) {
  .tech-cards-grid {
    grid-template-columns: 1fr;
  }
  .tech-card-wide .tech-list,
  .tech-list-wide {
    grid-template-columns: 1fr;
  }
}

.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.quick-link-card {
  border: 1px solid var(--line);
  background: var(--panel-alt);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.quick-link-card:hover {
  transform: translateY(-2px);
  border-color: rgba(36, 119, 232, 0.45);
  box-shadow: 0 4px 12px rgba(36, 119, 232, 0.12);
}

.quick-link-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-link-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.quick-link-val {
  font-size: 18px;
  font-weight: 800;
  color: #1d4ed8;
}

body.dark .quick-link-val {
  color: #38bdf8;
}

.quick-link-sub {
  font-size: 11px;
  color: var(--muted);
}

/* ==========================================================================
   HERO / MONITOR RESUMEN DEL ESTANQUE (DESTACADO Y PROMINENTE)
   ========================================================================== */
.hero {
  display: grid;
  grid-template-columns: minmax(480px, 580px) minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
  background: linear-gradient(135deg, #10263d 0%, #163a5d 50%, #1a4f78 100%);
  color: white;
  border-radius: 20px;
  padding: 26px 32px;
  margin-bottom: 24px;
  box-shadow: 0 12px 36px rgba(10, 24, 40, 0.18);
  position: relative;
  overflow: hidden;
  min-height: 250px;
}

.hero::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  right: 15%;
  top: -170px;
  box-shadow: 0 0 0 36px rgba(255, 255, 255, 0.03), 0 0 0 72px rgba(255, 255, 255, 0.015);
  pointer-events: none;
}

.hero-right-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 1;
}

.hero-badge-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.hero .eyebrow {
  color: #93c5fd;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.2px;
}

.hero-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
  padding: 2.5px 10px;
  border-radius: 12px;
}

.hero h2 {
  font-size: 24px;
  margin: 4px 0 8px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #ffffff;
}

.hero-desc {
  color: #c7ddf2;
  margin: 0 0 16px 0;
  max-width: 650px;
  font-size: 13.5px;
  line-height: 1.5;
}

/* Fichas verticales una encima de otra con datos grandes y legibles */
.hero-chips-stacked {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
}

.hero-chip-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 13px 18px;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.hero-chip-row:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateX(3px);
}

.hero-chip-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.hero-chip-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hero-chip-text small {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1.2;
}

.hero-chip-text strong {
  font-size: 15px;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* ==========================================================================
   TARJETA DESTACADA DEL ESTANQUE (HERO TANK CARD - GRAN ESCALA)
   ========================================================================== */
.hero-tank-card {
  background: rgba(8, 20, 36, 0.72);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  z-index: 1;
}

.hero-tank-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-tank-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: #f1f5f9;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.hero-card-icon {
  color: #38bdf8;
  font-size: 18px;
}

.hero-tank-state-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3.5px 11px;
  border-radius: 12px;
  letter-spacing: 0.2px;
}

.hero-tank-state-badge.badge-good {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.hero-tank-state-badge.badge-warning {
  background: rgba(234, 179, 8, 0.22);
  color: #fef08a;
  border: 1px solid rgba(234, 179, 8, 0.45);
}

.hero-tank-state-badge.badge-danger {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.hero-tank-card-content {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Cilindro visual del estanque - Gran Escala (135px x 185px) */
.hero-tank-gauge {
  width: 135px;
  height: 185px;
  border: 3px solid #7dd3fc;
  border-radius: 18px 18px 24px 24px;
  background: radial-gradient(ellipse at 50% 20%, rgba(28, 55, 84, 0.95), rgba(9, 20, 34, 0.98));
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.6), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.hero-tank-gauge-water {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 68%;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 45%, #1e40af 100%);
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -2px 10px rgba(56, 189, 248, 0.5);
}

.hero-tank-gauge-wave {
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 10px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
}

.hero-tank-gauge-ticks {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  padding: 10px 8px;
}

.gauge-tick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.gauge-tick .tick-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
  margin-right: 6px;
}

.gauge-tick .tick-label {
  font-size: 9.5px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.3px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.gauge-tick.t-max .tick-line { background: rgba(134, 239, 172, 0.5); }
.gauge-tick.t-max .tick-label { color: #86efac; }
.gauge-tick.t-min .tick-line { background: rgba(252, 165, 165, 0.6); }
.gauge-tick.t-min .tick-label { color: #fca5a5; }

/* Panel de métricas numéricas */
.hero-tank-metrics {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-tank-value-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-tank-percent-big {
  font-size: 42px;
  font-weight: 900;
  color: #38bdf8;
  line-height: 1;
  letter-spacing: -1.5px;
  text-shadow: 0 2px 14px rgba(56, 189, 248, 0.4);
}

.hero-tank-vol-group {
  display: flex;
  flex-direction: column;
}

.hero-tank-vol-val {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.hero-tank-vol-sub {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.2;
}

.hero-tank-bar-track {
  width: 100%;
  height: 9px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  overflow: hidden;
  margin: 3px 0;
}

.hero-tank-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #2563eb);
  border-radius: 5px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.hero-tank-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-tank-free-pill {
  font-size: 12px;
  color: #bae6fd;
  font-weight: 600;
}

.hero-tank-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
}

.hero-tank-safety-tag {
  font-size: 11px;
  color: #86efac;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hero-tank-link {
  font-size: 11.5px;
  font-weight: 700;
  color: #93c5fd;
  background: rgba(147, 197, 253, 0.14);
  border: 1px solid rgba(147, 197, 253, 0.3);
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.hero-tank-link:hover {
  background: rgba(147, 197, 253, 0.28);
  color: #ffffff;
  border-color: rgba(147, 197, 253, 0.6);
}

@media (max-width: 1050px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

/* ==========================================================================
   BARRA DE CONTROLES: INTERVALOS (1H, 2H, 4H, 6H) Y VISTAS
   ========================================================================== */
.controls-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.control-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.control-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tabs {
  display: flex;
  background: var(--line);
  padding: 4px;
  border-radius: 10px;
  gap: 3px;
  flex-wrap: wrap;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 13px;
  border-radius: 7px;
  font-weight: 650;
  font-size: 12px;
  transition: all 0.15s ease;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  background: var(--panel);
  color: var(--blue);
  box-shadow: 0 2px 7px rgba(23, 43, 68, 0.1);
}

.tab-interval.active {
  background: var(--blue);
  color: #ffffff;
}

/* ==========================================================================
   SELECTOR Y NAVEGADOR DE MES
   ========================================================================== */
.month-nav-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.month-chip-interactive {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.month-chip-interactive:hover {
  border-color: rgba(36, 119, 232, 0.45);
}

.month-input-val {
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.month-selector-block {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.month-selector-block.highlight-month {
  background: rgba(36, 119, 232, 0.08);
  border-color: rgba(36, 119, 232, 0.35);
}

.hour-interval-block {
  transition: opacity 0.2s ease;
}

/* ==========================================================================
   MÉTRICAS KPI
   ========================================================================== */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.metric-icon {
  height: 34px;
  width: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
}

.icon-blue { background: rgba(36, 119, 232, 0.12); color: #2477e8; }
.icon-cyan { background: rgba(24, 178, 207, 0.14); color: #1398b7; }
.icon-orange { background: rgba(240, 163, 58, 0.15); color: #ce841b; }
.icon-green { background: rgba(22, 163, 74, 0.14); color: #16a34a; }
.icon-purple { background: rgba(124, 58, 237, 0.13); color: #7c3aed; }

.metric-value {
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 760;
  letter-spacing: -0.8px;
  margin: 12px 0 4px;
  white-space: nowrap;
}

.metric-value span {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}

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

/* ==========================================================================
   GRILLAS PRINCIPALES
   ========================================================================== */
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(310px, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.finance-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(0, 1.85fr);
  gap: 16px;
  margin-top: 16px;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.card h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 3px;
}

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

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

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

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

/* ==========================================================================
   INSPECTOR EN VIVO DEL TRAMO
   ========================================================================== */
.slot-inspector {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.slot-inspector strong {
  color: var(--ink);
}

.slot-inspector .slot-badges {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-weight: 700;
  font-size: 12px;
}

/* ==========================================================================
   GRÁFICOS (CANVAS)
   ========================================================================== */
.chart-wrap {
  height: 260px;
  position: relative;
  width: 100%;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.chart-note {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 11px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

/* ==========================================================================
   TABLA DE HORARIOS DETALLADA ("DE TAL HORA A TAL HORA")
   ========================================================================== */
.schedule-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-alt);
}

.schedule-title {
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.schedule-table-wrap {
  max-height: 220px;
  overflow-y: auto;
}

table.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

table.schedule-table th,
table.schedule-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

table.schedule-table th {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 1;
}

table.schedule-table tr:hover td {
  background: rgba(36, 119, 232, 0.06);
}

.badge-cons { color: var(--blue); font-weight: 700; }
.badge-ref { color: var(--cyan); font-weight: 700; }
.badge-gain { color: var(--green); font-weight: 700; }
.badge-cost { color: var(--red); font-weight: 700; }

/* ==========================================================================
   VISUALIZADOR DEL ESTANQUE
   ========================================================================== */
.tank-card {
  display: flex;
  flex-direction: column;
}

.tank-info {
  display: flex;
  align-items: center;
  gap: 32px;
  flex: 1;
  padding: 14px 4px;
}

/* Cilindro visual del estanque - Gran Escala (320px x 380px) */
.tank-visual {
  height: 380px;
  width: 320px;
  border: 4px solid #7dd3fc;
  border-radius: 24px 24px 34px 34px;
  position: relative;
  overflow: hidden;
  background: var(--panel-alt);
  flex-shrink: 0;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.08);
}

.tank-water {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 68%;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 45%, #1d4ed8 100%);
  transition: height 0.4s ease;
  box-shadow: 0 -2px 12px rgba(56, 189, 248, 0.5);
}

.tank-water-wave {
  position: absolute;
  top: -6px;
  left: -5%;
  width: 110%;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

/* Marcadores de escala grandes y nítidos */
.tank-scale-marker {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  pointer-events: none;
  z-index: 2;
  transform: translateY(50%);
}

.tank-scale-marker.scale-90 { bottom: 90%; }
.tank-scale-marker.scale-75 { bottom: 75%; }
.tank-scale-marker.scale-50 { bottom: 50%; }
.tank-scale-marker.scale-25 { bottom: 25%; }

.tank-scale-marker .scale-line {
  flex: 1;
  height: 0;
  margin-right: 10px;
}

.tank-scale-marker.scale-90 .scale-line {
  border-top: 2px dashed #16a34a;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.tank-scale-marker.scale-75 .scale-line {
  border-top: 2px dashed #0284c7;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.tank-scale-marker.scale-50 .scale-line {
  border-top: 2px dashed #0891b2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.tank-scale-marker.scale-25 .scale-line {
  border-top: 2px dashed #e11d48;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.tank-scale-marker .scale-badge {
  font-size: 12.5px;
  font-weight: 800;
  min-width: 144px;
  text-align: center;
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 8px;
  background: rgba(16, 36, 58, 0.88);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}

.tank-scale-marker .scale-badge.badge-max {
  background: rgba(22, 163, 74, 0.92);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.tank-scale-marker .scale-badge.badge-75 {
  background: rgba(2, 132, 199, 0.92);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.tank-scale-marker .scale-badge.badge-50 {
  background: rgba(8, 145, 178, 0.92);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.tank-scale-marker .scale-badge.badge-min {
  background: rgba(225, 29, 72, 0.92);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Panel de datos lateral de alta densidad sin espacio en blanco */
.tank-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.tank-main-readout {
  display: flex;
  flex-direction: column;
}

.tank-liters-huge {
  font-size: 46px;
  font-weight: 900;
  letter-spacing: -1.5px;
  color: var(--ink);
  line-height: 1;
  display: block;
}

.tank-cap-sub {
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 6px;
  display: block;
}

.tank-progress-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.tank-progress-panel .progress {
  height: 12px;
  width: 100%;
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
  margin: 0;
}

.tank-progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tank-percent-callout {
  font-size: 14px;
  font-weight: 800;
  color: var(--blue);
}

.tank-state-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
}

.tank-state-pill.pill-good {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.tank-state-pill.pill-warning {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.tank-state-pill.pill-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #e11d48;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.tank-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.tank-stat-box {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.tank-stat-box:hover {
  border-color: rgba(36, 119, 232, 0.35);
}

.tank-stat-box small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tank-stat-box strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}

.progress {
  height: 10px;
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
  margin: 14px 0 8px;
}

.progress-fill, .progress div {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #2563eb);
  border-radius: 6px;
  transition: width 0.35s ease;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.split-line {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

.tank-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tank-bottom small {
  color: var(--muted);
  display: block;
  font-size: 11px;
}

.tank-bottom strong {
  font-size: 13.5px;
  display: block;
  margin-top: 4px;
  line-height: 1.35;
  color: var(--ink);
  word-break: break-word;
}

/* ==========================================================================
   SECCIÓN FINANCIERA: TARIFAS Y COSTOS
   ========================================================================== */
.price-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-group label {
  font-size: 12px;
  font-weight: 650;
  display: flex;
  justify-content: space-between;
}

.input-group label span {
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}

.price-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-alt);
  overflow: hidden;
}

.price-prefix, .price-suffix {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.12);
}

.price-input-wrap input {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 8px 10px;
  width: 100%;
  font-weight: 700;
  font-size: 14px;
  outline: none;
}

.fin-summary-boxes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.fin-box {
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fin-box small {
  font-size: 11px;
  color: var(--muted);
  display: block;
}

.fin-box strong {
  font-size: 16px;
  font-weight: 800;
}

.fin-box.gain strong { color: var(--green); }
.fin-box.cost strong { color: var(--red); }
.fin-box.net strong { color: var(--blue); }

/* ==========================================================================
   BOMBA, MOTOR Y EVENTOS
   ========================================================================== */
.motor-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0fbf6;
  border: 1px solid #d8f4e7;
  padding: 8px 12px;
  border-radius: 10px;
  color: #14835e;
  font-size: 12px;
  font-weight: 600;
}

body.dark .motor-status {
  background: rgba(22, 163, 74, 0.15);
  border-color: rgba(22, 163, 74, 0.35);
  color: #4ade80;
}

.motor-status .dot {
  height: 8px;
  width: 8px;
  background: #20b77f;
  border-radius: 50%;
}

.event-list {
  display: flex;
  flex-direction: column;
  max-height: 220px;
  overflow-y: auto;
}

.event {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}

.event:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.event-icon {
  height: 32px;
  width: 32px;
  border-radius: 9px;
  background: rgba(24, 178, 207, 0.14);
  color: #1285a7;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 14px;
}

.event strong { font-size: 12px; display: block; }
.event small { font-size: 11px; color: var(--muted); }
.event .liters { margin-left: auto; text-align: right; font-size: 12px; font-weight: 700; white-space: nowrap; }

/* ==========================================================================
   SIMULADOR Y BOTONES
   ========================================================================== */
.sim-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.sim-note {
  font-size: 12px;
  color: var(--muted);
  max-width: 620px;
  line-height: 1.4;
}

.sim-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.hour-select {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.btn {
  border: 0;
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-cyan { background: var(--cyan); color: white; }
.btn-cyan:hover { background: #139cb6; }
.btn-secondary { background: var(--panel-alt); border: 1px solid var(--line); color: var(--ink); }
.btn-secondary:hover { background: var(--line); }

/* ==========================================================================
   TOOLTIP FLOTANTE Y TOAST
   ========================================================================== */
.chart-tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(15, 28, 46, 0.96);
  color: #ffffff;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 100;
  display: none;
  min-width: 250px;
}

.chart-tooltip .tt-title {
  font-weight: 800;
  color: #67e8f9;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 5px;
  margin-bottom: 6px;
}

.chart-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #173b5a;
  color: white;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: none;
  max-width: 350px;
  z-index: 99;
  font-size: 12px;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  padding: 24px 0 0;
}

/* ==========================================================================
   PANEL DE SENSORES Y DETECCIÓN AUTOMÁTICA
   ========================================================================== */
.sensor-pill-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sensor-pill-btn:hover {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.quick-adjust-bar {
  display: flex;
  gap: 4px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.adjust-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.adjust-chip:hover {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.adjust-chip.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.sensor-live-panel {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
  transition: all 0.25s ease;
}

.sensor-live-panel.active {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
  box-shadow: 0 0 0 1px #10b981;
}

.pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.pulse-dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ==========================================================================
   RESPONSIVIDAD
   ========================================================================== */
@media (max-width: 1100px) {
  .app { grid-template-columns: 74px minmax(0, 1fr); }
  .sidebar { padding: 20px 10px; }
  .brand { justify-content: center; padding: 0; }
  .brand-text, .nav-label, .nav-item .nav-text, .side-bottom { display: none; }
  .nav-item { justify-content: center; padding: 12px 7px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid, .finance-grid, .lower-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app { grid-template-columns: 64px minmax(0, 1fr); }
  .sidebar { padding: 14px 6px; display: flex; }
  .brand-text, .nav-label, .nav-item .nav-text, .side-bottom { display: none; }
  .nav-item { justify-content: center; padding: 10px 4px; font-size: 18px; }
  main { padding: 16px 12px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .controls-bar { flex-direction: column; align-items: flex-start; }
}
