@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Outfit:wght@300;400;500;600;700;800&display=swap");

:root {
  --bg: #050505;
  --accent: #f2f2f2;
  --accent-light: #ffffff;
  --text: rgba(255, 255, 255, 0.92);
  --text-muted: rgba(255, 255, 255, 0.48);
  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-highlight: rgba(255, 255, 255, 0.42);
  --glass-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --sidebar-w: 248px;
  --radius: 26px;
  --radius-sm: 18px;
  --critical: #ff6b6b;
  --warning: #d0d0d0;
  --favorable: #ffffff;
  --blur: 32px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Scrollbar liquid glass (WebKit + Firefox) */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.16));
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.28));
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:active {
  background: rgba(255, 255, 255, 0.55);
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.sidebar-nav,
.ai-chat-list,
.ai-thread,
.forecast-scroll,
.history-table-wrap,
.dash-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Outfit", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body {
  display: flex;
  min-height: 100dvh;
  position: relative;
  isolation: isolate;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 55% at 50% 0%, rgba(255, 255, 255, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 40% at 15% 80%, rgba(255, 255, 255, 0.04), transparent 50%),
    radial-gradient(ellipse 45% 35% at 90% 30%, rgba(255, 255, 255, 0.05), transparent 50%),
    #050505;
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 64px;
  box-shadow:
    inset 0 0 0 48px rgba(255, 255, 255, 0.015),
    0 0 0 80px rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.wire-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#cursor-fluid {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: normal;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.4;
  animation: drift 18s ease-in-out infinite alternate;
}

.orb-a {
  width: 42vw;
  height: 42vw;
  top: -12%;
  left: -8%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 70%);
}

.orb-b {
  width: 34vw;
  height: 34vw;
  top: 30%;
  right: -10%;
  background: radial-gradient(circle, rgba(180, 180, 180, 0.12), transparent 70%);
  animation-delay: -6s;
}

.orb-c {
  width: 38vw;
  height: 38vw;
  bottom: -18%;
  left: 28%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 70%);
  animation-delay: -11s;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(3%, 4%, 0) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .orb { animation: none; }
  body:not(.motion-ready) .sidebar,
  body:not(.motion-ready) .dash-header,
  body:not(.motion-ready) .bento > .glass-card,
  body:not(.motion-ready) .ai-layout > *,
  body:not(.motion-ready) .sat-layout > * {
    opacity: 1;
  }
}

/* Pre-entrada: evita flash antes de GSAP */
body:not(.motion-ready) .sidebar,
body:not(.motion-ready) .dash-header,
body:not(.motion-ready) .panel.is-active .bento > .glass-card,
body:not(.motion-ready) .panel.is-active .ai-layout > *,
body:not(.motion-ready) .panel.is-active .sat-layout > * {
  opacity: 0;
}

.glass-card,
.sidebar,
.dash-header {
  will-change: transform, opacity;
}

.glass-card.is-live {
  will-change: auto;
}

@media (hover: hover) and (pointer: fine) {
  .bento > .glass-card,
  .sat-side > .glass-card {
    transition: border-color 0.3s ease, box-shadow 0.45s ease;
  }

  .alerts-list .alert-item,
  .forecast-day {
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s ease, box-shadow 0.45s ease;
  }

  /* El levantamiento + tilt 3D lo maneja GSAP (dashboard-fx.js);
     aquÃ­ solo borde y sombra para no pelear con el transform inline */
  .bento > .glass-card:hover,
  .sat-side > .glass-card:hover {
    border-color: rgba(255, 255, 255, 0.32);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 var(--glass-highlight);
  }

  .alert-item:hover,
  .forecast-day:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.28);
  }

  .nav-item {
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
  }

  .nav-item:hover {
    transform: none;
  }

  .nav-item.is-active:hover {
    transform: none;
  }
}

.sidebar-nav.is-magnifying {
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar-nav.is-magnifying .nav-item {
  z-index: 1;
}

.sidebar-nav.is-magnifying .nav-icon {
  z-index: 2;
}

/* Android / pantallas chicas: menos blur = mÃ¡s FPS */
@media (max-width: 768px), (pointer: coarse) {
  :root {
    --blur: 12px;
  }

  .ambient .orb {
    display: none;
  }

  .glass-panel,
  .glass-card {
    backdrop-filter: blur(12px) saturate(130%);
    -webkit-backdrop-filter: blur(12px) saturate(130%);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }

  .glass-panel::before,
  .glass-card::before {
    opacity: 0.3;
  }

  .sidebar {
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
    border-radius: 24px;
  }

  .nav-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }
}

/* Liquid glass surface */
.glass-panel,
.glass-card {
  position: relative;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 40%, rgba(255, 255, 255, 0.08)),
    rgba(18, 18, 18, 0.45);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  overflow: hidden;
}

.glass-panel::before,
.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 28%);
  opacity: 0.55;
}

.glass-inset {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sidebar â€” liquid glass dock (estilo macOS) */
.sidebar {
  position: fixed;
  top: 14px;
  left: 14px;
  bottom: 14px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: calc(var(--sidebar-w) - 8px);
  padding: 18px 12px;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 38%, rgba(255, 255, 255, 0.09)),
    rgba(22, 22, 22, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 32px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 26%);
  opacity: 0.7;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 6px 10px;
  position: relative;
  z-index: 1;
}

.sidebar-brand img {
  width: 40px;
  height: auto;
  filter: brightness(0) invert(1);
}

.sidebar-brand span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 2px 8px;
  position: relative;
  z-index: 1;
  transform-origin: left center;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.nav-item.is-active {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 8px 20px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  color: currentColor;
  border-radius: 11px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform-origin: center center;
  will-change: transform;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
}

.nav-icon svg,
.alert-icon svg,
.day-icon svg {
  display: block;
}

.alert-icon svg,
.day-icon svg {
  width: 100%;
  height: 100%;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 6;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(12, 12, 12, 0.15), rgba(12, 12, 12, 0.55));
}

.plan-badge {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 13px;
}

.plan-badge strong {
  color: #fff;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 600;
}

.logout-btn,
.glass-btn,
.cfg-save {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.logout-btn:hover {
  background: rgba(232, 93, 93, 0.14);
  border-color: rgba(232, 93, 93, 0.4);
}

.glass-btn,
.cfg-save {
  width: auto;
  padding: 0 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  border-color: rgba(255, 255, 255, 0.28);
}

.glass-btn:hover,
.cfg-save:hover {
  transform: translateY(-1px);
}

.dash-overlay {
  display: none;
}

/* Main */
.dash-main {
  flex: 1;
  margin-left: calc(var(--sidebar-w) + 8px);
  min-width: 0;
  padding: 12px clamp(12px, 2.5vw, 28px) 28px;
}

.dash-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: 20px;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.sidebar-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: #fff;
}

.header-copy {
  flex: 1;
  min-width: 0;
}

.header-copy h1 {
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  overflow: hidden; /* mÃ¡scara para el reveal letra a letra */
}

.header-copy h1 .ch {
  display: inline-block;
  will-change: transform;
}

.header-meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 13px;
}

.dot {
  margin: 0 6px;
  opacity: 0.5;
}

.header-home {
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.25s ease;
}

.header-home:hover {
  background: rgba(255, 255, 255, 0.12);
}

.panel[hidden] {
  display: none !important;
}

/* Bento resumen */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.glass-card {
  padding: 18px;
}

.metric-hero { grid-column: span 8; min-height: 150px; }
.metric-side { grid-column: span 4; }
.chart-card { grid-column: span 8; }
.info-bars-card { grid-column: span 4; }
.sat-preview { grid-column: span 5; min-height: 260px; }
.alerts-card { grid-column: span 7; }
.forecast-card { grid-column: span 8; }
.ai-teaser { grid-column: span 4; display: flex; flex-direction: column; gap: 12px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.card-head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 11px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.metric-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

.metric-value {
  margin-top: 8px;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 650;
  letter-spacing: -0.04em;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  position: relative;
  z-index: 1;
}

.metric-unit {
  margin-left: 4px;
  font-size: 0.45em;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-hint,
.panel-lead {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  z-index: 1;
}

.spark {
  margin-top: 16px;
  height: 44px;
  border-radius: 10px;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.spark canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-wrap {
  position: relative;
  z-index: 1;
  height: 240px;
}

.info-bars {
  display: grid;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.info-bar {
  display: grid;
  gap: 6px;
}

.info-bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.info-bar-top strong {
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
}

.info-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.info-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.92));
}

.sat-preview-map {
  position: relative;
  z-index: 1;
  height: 170px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sat-meta {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  position: relative;
  z-index: 1;
}

.ghost-link {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}

.ghost-link:hover {
  text-decoration: underline;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  position: relative;
  z-index: 1;
}

.metric-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.metric-card .metric-value {
  font-size: 1.55rem;
}

.alerts-list {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.alert-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
}

.alert-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 12px;
  color: currentColor;
}

.alert-item.critica .alert-icon,
.alert-item.alta .alert-icon {
  background: rgba(232, 93, 93, 0.18);
  color: var(--critical);
}

.alert-item.media .alert-icon,
.alert-item.baja .alert-icon {
  background: rgba(255, 255, 255, 0.1);
  color: #e8e8e8;
}

.alert-item.favorable .alert-icon {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.alert-item h3 {
  font-size: 14px;
  font-weight: 600;
}

.alert-item p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.alert-sev {
  display: inline-block;
  margin-top: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.alert-item.critica .alert-sev,
.alert-item.alta .alert-sev { color: var(--critical); }
.alert-item.media .alert-sev,
.alert-item.baja .alert-sev { color: rgba(255, 255, 255, 0.7); }
.alert-item.favorable .alert-sev { color: #fff; }

.forecast-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  position: relative;
  z-index: 1;
}

.forecast-day {
  flex: 0 0 100px;
  scroll-snap-align: start;
  padding: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
}

.forecast-day .day-name {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.forecast-day .day-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: 10px auto;
  color: rgba(255, 255, 255, 0.88);
}

.forecast-day .temps {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
}

.forecast-day .temps span {
  color: var(--text-muted);
}

/* AgroIA */
.ai-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 14px;
  height: calc(100dvh - 120px);
  transition: grid-template-columns 0.4s cubic-bezier(0.2, 0, 0, 1), gap 0.4s ease;
}

.ai-layout.is-collapsed {
  grid-template-columns: 0fr 1fr;
  gap: 0;
}

.ai-rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, padding 0.3s ease, min-width 0.4s ease;
}

.ai-layout.is-collapsed .ai-rail {
  opacity: 0;
  padding: 0;
  min-width: 0;
  border: none;
  pointer-events: none;
}

.ai-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.ai-brand strong {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.ai-brand span {
  color: var(--text-muted);
  font-size: 12px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.ai-rail-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ai-rail-label {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-chat-list {
  display: grid;
  gap: 4px;
  flex: 1;
  overflow: auto;
}

.ai-chat-item {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.ai-chat-item.is-active,
.ai-chat-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.ai-rail-links {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-rail-link {
  display: block;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ai-rail-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.ai-stage {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 22px;
  overflow: hidden;
}

.ai-hero {
  flex: 1;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 12px;
  padding: 24px 12px 40px;
}

.ai-hero h2 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 650;
  letter-spacing: -0.04em;
}

.ai-hero p {
  max-width: 420px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
}

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.ai-chip {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ai-chip:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ai-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 8px 4px 18px;
  margin-bottom: 12px;
}

.ai-msg {
  max-width: min(560px, 92%);
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
}

.ai-msg.user {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.ai-msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ai-composer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding: 6px 8px 6px 10px;
  position: relative;
  z-index: 1;
}

.ai-composer input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
}

.ai-composer input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.ai-attach,
.ai-mic,
.ai-send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.ai-attach {
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
}

.ai-mic svg,
.ai-send svg {
  width: 18px;
  height: 18px;
}

.ai-send {
  background: linear-gradient(180deg, #fff, #cfcfcf);
  color: #111;
}

/* Satellite */
.sat-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
}

.sat-map-card {
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

.sat-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.seg {
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.seg.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.sat-map {
  transition: opacity 0.8s ease;
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 460px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sat-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.sat-facts {
  display: grid;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.sat-facts div {
  display: grid;
  gap: 2px;
}

.sat-facts dt {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sat-facts dd {
  font-size: 14px;
}

.sat-layers {
  list-style: none;
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.sat-layers li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.swatch-ndvi { background: #f0f0f0; }
.swatch-moisture { background: #8a8a8a; }
.swatch-parcel { background: transparent; box-shadow: inset 0 0 0 2px #fff; }

.sat-note {
  margin-top: 14px;
}

.rain-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}

.rain-stat {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.rain-stat strong {
  display: block;
  margin-top: 8px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1.25rem;
}

.crops-list {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.crop-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.crop-row h3 {
  font-size: 15px;
}

.crop-row p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.crop-state {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-table-wrap {
  overflow-x: auto;
  position: relative;
  z-index: 1;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th,
.history-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.history-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.config-form {
  display: grid;
  gap: 8px;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.config-form label {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.config-form input {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  outline: none;
}

.config-form input:focus {
  border-color: rgba(255, 255, 255, 0.45);
}

.cfg-status {
  min-height: 1.2em;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}

/* Leaflet tweaks inside glass */
.leaflet-container {
  background: #0b1510;
  font: inherit;
}

.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.45) !important;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
}

.leaflet-control-attribution a {
  color: #fff;
}

.agro-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.28);
}

/* Responsive */
@media (max-width: 1100px) {
  .metric-hero,
  .metric-side,
  .chart-card,
  .info-bars-card,
  .sat-preview,
  .alerts-card,
  .forecast-card,
  .ai-teaser {
    grid-column: span 12;
  }

  .ai-layout,
  .sat-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100dvh - 120px);
  }

  .ai-stage {
    height: 70dvh;
  }

  .ai-rail {
    order: 2;
  }
}

@media (max-width: 768px) {
  /* En mÃ³vil la navegaciÃ³n es la tab bar inferior (estilo iOS);
     la sidebar y el hamburguesa desaparecen */
  .sidebar,
  .sidebar-toggle,
  .dash-overlay {
    display: none !important;
  }

  .dash-main {
    margin-left: 0;
    padding: 10px 10px 104px;
  }

  .rain-stats {
    grid-template-columns: 1fr;
  }

  .sat-map,
  .sat-map-card {
    min-height: 300px;
  }

  .bento {
    gap: 10px;
  }
}

/* =====================================================
   AWWWARDS LAYER â€” preloader, editorial, fÃ­sica, mÃ³vil
   ===================================================== */

/* ---------- Preloader cinemÃ¡tico ---------- */
body.is-loading {
  overflow: hidden;
}

.preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  background: #050505;
  /* Nunca bloquea clics: es solo visual */
  pointer-events: none;
}

.preloader.is-done {
  display: none;
}

.preloader-wire {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
}

.preloader-center {
  position: relative;
  z-index: 1;
  padding: 0 16px;
  text-align: center;
}

.preloader-title {
  overflow: hidden;
  font-size: clamp(2.8rem, 11vw, 8.5rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.preloader-title .ch {
  display: inline-block;
  transform: translateY(115%);
  will-change: transform;
}

.preloader-sub {
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.4);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
}

.preloader-foot {
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: 30px;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.preloader-meta {
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.preloader-count {
  font-size: clamp(2rem, 6vw, 3.8rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.preloader-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.preloader-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: #fff;
}

/* ---------- Aurora de fondo ---------- */
.aurora {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140vmax;
  height: 140vmax;
  margin: -70vmax 0 0 -70vmax;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(170, 195, 225, 0.055) 55deg,
    transparent 140deg,
    rgba(255, 255, 255, 0.065) 205deg,
    transparent 290deg,
    rgba(150, 170, 205, 0.05) 330deg,
    transparent 360deg
  );
  filter: blur(60px);
  opacity: 0.85;
  animation: aurora-spin 48s linear infinite;
  will-change: transform;
}

@keyframes aurora-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Grano de pelÃ­cula ---------- */
.grain {
  position: fixed;
  inset: -100%;
  z-index: 90;
  width: 300%;
  height: 300%;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  animation: grain-shift 0.7s steps(6) infinite;
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-2%, 1%); }
  40% { transform: translate(1%, -2%); }
  60% { transform: translate(-1%, 2%); }
  80% { transform: translate(2%, -1%); }
  100% { transform: translate(0, 0); }
}

/* ---------- Ticker de clima ---------- */
.ticker {
  overflow: hidden;
  margin-bottom: 18px;
  padding: 9px 0;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 26px;
  width: max-content;
  animation: ticker-scroll 32s linear infinite;
  will-change: transform;
}

@keyframes ticker-scroll {
  to { transform: translateX(-50%); }
}

.tick {
  color: rgba(255, 255, 255, 0.55);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tick-dot {
  color: rgba(255, 255, 255, 0.25);
  font-size: 11px;
}

/* ---------- Capa editorial ---------- */
.metric-display {
  font-size: clamp(3.2rem, 6.5vw, 5.8rem);
  font-weight: 750;
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.metric-value {
  font-variant-numeric: tabular-nums;
}

.panel-index {
  margin: 2px 4px 12px;
  color: rgba(255, 255, 255, 0.38);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.hud {
  position: absolute;
  z-index: 2;
  color: rgba(255, 255, 255, 0.32);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.hud-tr {
  top: 16px;
  right: 18px;
}

/* HUD en lÃ­nea (dentro de card-head, junto al tag) */
.hud-inline {
  color: rgba(255, 255, 255, 0.32);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.chart-card .card-head h2 {
  margin-right: auto;
}

/* ---------- PÃ­ldora deslizante en la sidebar ---------- */
.sidebar-nav {
  position: relative;
}

.nav-item {
  position: relative;
  z-index: 1;
}

.nav-pill {
  position: absolute;
  left: 2px;
  right: 2px;
  top: 0;
  height: 48px;
  z-index: 0;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 8px 20px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  will-change: transform;
}

.sidebar-nav.has-pill .nav-item.is-active {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #fff;
}

/* ---------- Reflejo especular que sigue al mouse ---------- */
@media (hover: hover) and (pointer: fine) {
  .bento > .glass-card::after,
  .sat-side > .glass-card::after,
  .ai-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(
      380px circle at var(--mx, 50%) var(--my, 50%),
      rgba(255, 255, 255, 0.13),
      transparent 65%
    );
    opacity: 0;
    transition: opacity 0.35s ease;
  }

  .bento > .glass-card:hover::after,
  .sat-side > .glass-card:hover::after,
  .ai-stage:hover::after {
    opacity: 1;
  }
}

/* ---------- Controles satÃ©lite + fullscreen + NDVI ---------- */
.sat-map-wrap {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
}

.sat-map-wrap .sat-map {
  transition: opacity 0.8s ease;
  flex: 1;
}

.sat-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sat-ctrl {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 13px;
  background: rgba(12, 12, 12, 0.55);
  color: #fff;
  font: inherit;
  font-size: 19px;
  cursor: pointer;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 8px 22px rgba(0, 0, 0, 0.4);
  transition: background 0.2s ease;
}

.sat-ctrl:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sat-ctrl svg {
  width: 17px;
  height: 17px;
}

.leaflet-control-zoom {
  display: none !important;
}

.sat-map-card.is-full {
  position: fixed;
  inset: 12px;
  z-index: 80;
  min-height: 0;
}

body.sat-fullscreen {
  overflow: hidden;
}

.ndvi-legend {
  margin-top: 14px;
  position: relative;
  z-index: 1;
}

.ndvi-bar {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(90deg, #171717, #4d4d4d 35%, #9d9d9d 65%, #ffffff);
}

.ndvi-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.4);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
}

/* ---------- AgroIA: typing + timestamps ---------- */
.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
}

.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  animation: typing-bounce 1.1s ease-in-out infinite;
}

.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.ai-msg time {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.32);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
}

/* ---------- Tab bar mÃ³vil (estilo iOS) ---------- */
.tabbar {
  display: none;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 75;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sheet-overlay[hidden] {
  display: none;
}

.sheet {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 76;
  display: grid;
  gap: 6px;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 26px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05) 40%, rgba(255, 255, 255, 0.08)),
    rgba(18, 18, 18, 0.72);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  transform: translateY(115%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet.is-open {
  transform: none;
}

.sheet[hidden] {
  display: none;
}

.sheet-grip {
  width: 44px;
  height: 5px;
  margin: 0 auto 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}

.sheet-item {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.sheet-item:active {
  background: rgba(255, 255, 255, 0.14);
}

@media (max-width: 768px) {
  .tabbar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 70;
    display: flex;
    justify-content: space-around;
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 26px;
    background:
      linear-gradient(165deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05) 40%, rgba(255, 255, 255, 0.09)),
      rgba(16, 16, 16, 0.6);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
  }

  .tab-item {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 0 4px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 10px;
    cursor: pointer;
  }

  .tab-item.is-active {
    color: #fff;
  }

  .tab-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 27px;
    border-radius: 10px;
    transition: background 0.25s ease;
  }

  .tab-item.is-active .tab-icon {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .tab-icon svg {
    width: 18px;
    height: 18px;
  }

  /* Ticker mÃ¡s compacto en mÃ³vil */
  .ticker {
    margin-bottom: 12px;
  }

  /* Menos efectos = menos lag en mÃ³vil */
  .grain,
  .aurora,
  .ambient,
  .wire-bg,
  .preloader-wire,
  .orb {
    display: none !important;
  }

  .glass-card,
  .sidebar,
  .tabbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .tabbar {
    background: rgba(16, 16, 16, 0.92);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  }

  /* Las anotaciones HUD chocan con los tÃ­tulos en pantallas chicas */
  .hud,
  .hud-inline {
    display: none;
  }

  .metric-display {
    font-size: clamp(2.8rem, 16vw, 4.2rem);
  }

  .sat-map-card.is-full {
    inset: 8px 8px 8px;
  }
}

/* ---------- Accesibilidad ---------- */
:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.65);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .grain,
  .ticker-track,
  .aurora,
  .ai-typing span {
    animation: none;
  }

  .preloader {
    display: none;
  }

  .sheet {
    transition: none;
  }

  .preloader-title .ch {
    transform: none;
  }
}

/* ================================================================
   MI PLAN — Panel de suscripción (dashboard)
================================================================ */

/* Tarjeta: plan actual */
.plan-current-card .card-head { margin-bottom: 1.2rem; }

.plan-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .plan-info-grid { grid-template-columns: repeat(2, 1fr); }
}

.plan-info-item {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.plan-info-item span { font-size: .7rem; opacity: .5; text-transform: uppercase; letter-spacing: .08em; }
.plan-info-item strong { font-size: 1.05rem; font-weight: 600; }

.plan-renewal { font-size: .75rem; opacity: .45; }

/* Tarjeta: comparativa */
.plan-compare-card { grid-column: span 2; }
@media (max-width: 900px) { .plan-compare-card { grid-column: span 1; } }

.plan-compare-grid {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 1.25rem;
}

.plan-compare-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  align-items: center;
  gap: .5rem;
  padding: .6rem .8rem;
  border-radius: 12px;
  font-size: .82rem;
  transition: background .2s;
}

.plan-compare-head {
  font-size: .68rem;
  opacity: .45;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding-bottom: .2rem;
}

.plan-compare-row:not(.plan-compare-head):hover { background: var(--glass); }

.plan-row-active {
  background: rgba(255,255,255,.1) !important;
  border: 1px solid var(--glass-border);
}

.plan-select-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text);
  font-size: .72rem;
  padding: .3rem .7rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
}
.plan-select-btn:hover:not(:disabled) { background: var(--glass-strong); }
.plan-select-btn:disabled { opacity: .35; cursor: default; }

.plan-select-btn--highlight {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.35);
  font-weight: 600;
}

.plan-popular-tag {
  font-size: .62rem;
  background: rgba(255,255,255,.18);
  border-radius: 6px;
  padding: .1rem .4rem;
  font-style: normal;
  vertical-align: middle;
}

.plan-full-link {
  font-size: .8rem;
  opacity: .65;
  padding: .5rem 1rem;
  display: inline-block;
  text-decoration: none;
}
.plan-full-link:hover { opacity: 1; }

/* Plan badge en sidebar como botón */
.plan-badge {
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: .75rem;
  opacity: .55;
  padding: 0;
  text-align: left;
  transition: opacity .2s;
}
.plan-badge:hover { opacity: 1; }
.plan-badge strong { color: var(--accent-light); }

/* ================================================================
   LIQUID LOGO PRELOADER (CSS MASK)
================================================================ */
.liquid-logo {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 100px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  --fill-pct: 0%;
}

.liquid-base {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.15; /* El logo vaco se ve oscuro y sutil */
  filter: grayscale(100%);
}

.liquid-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: var(--fill-pct);
  overflow: hidden;
  transition: height 0.1s ease-out;
  /* Animacin de entrada para que no salte de golpe */
}

/* Imagen a color que solo se ve en la parte llena */
.liquid-color {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100px; /* debe coincidir con el contenedor para alinear */
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(108, 211, 255, 0.6)) brightness(1.2);
}

/* Ola opcional para darle el toque "lquido" en el borde superior */
.liquid-wave {
  position: absolute;
  top: -4px;
  left: -100%;
  width: 200%;
  height: 8px;
  background: rgba(108, 211, 255, 0.4);
  filter: blur(2px);
  animation: liquidWaveAnim 2s infinite linear;
}

@keyframes liquidWaveAnim {
  0% { transform: translateX(0); }
  100% { transform: translateX(50%); }
}


.liquid-foot {
  left: 0;
  right: 0;
  bottom: 12%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.liquid-foot .preloader-meta {
  margin-bottom: 8px;
  font-size: 11px;
}
.liquid-foot .preloader-count {
  font-size: 3.5rem;
}
.liquid-foot .preloader-count::after {
  content: "%";
  font-size: 0.5em;
  opacity: 0.5;
  margin-left: 2px;
}

/* ======== MODAL SENSOR ESP32 ======== */
.sensor-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.sensor-modal-content {
  max-width: 480px;
  width: 90%;
  padding: 28px;
  border-radius: var(--radius);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}



/* --- AgroIA Mic Recording Animation --- */
#ai-mic.recording {
    animation: mic-pulse 1s ease-in-out infinite;
    color: #ef4444 !important;
}
@keyframes mic-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}







