/* ==========================================================================
   DroneFlow — Agricultural Drone Intelligence Platform (DROM)
   Identidad Corporativa · Dark Mode + Crystal Glass UI
   Paleta Oficial:
   - Celeste Tecnológico:      #3CB4FF
   - Azul Cielo Inteligente:   #0EA5E9
   - Azul Profundo:            #0B5E8A
   - Verde Agrícola:           #43B02A
   - Verde Lima Tecnológico:   #A9F14E
   - Gris Niebla:              #E6EDF5
   - Blanco Hueso:             #FAFCFF
   Tipografía: Montserrat (Títulos / Marca) + Inter (Interfaz / Datos)
   ========================================================================== */

:root {
  /* Paleta de Identidad Corporativa */
  --cyan: #3CB4FF;
  --blue: #0EA5E9;
  --blue-deep: #0B5E8A;
  --green: #43B02A;
  --lime: #A9F14E;
  --mist: #E6EDF5;
  --bone: #FAFCFF;

  /* Superficies Modo Oscuro Profundo */
  --bg-abyss: #040C15;
  --bg-base: #071422;
  --bg-elevated: #0A1D30;
  --bg-panel: rgba(11, 32, 52, 0.62);
  --bg-panel-strong: rgba(9, 26, 43, 0.84);
  --bg-glass: rgba(255, 255, 255, 0.045);
  --bg-glass-hover: rgba(60, 180, 255, 0.09);

  /* Bordes y Reflejos Cristal */
  --line: rgba(230, 237, 245, 0.10);
  --line-strong: rgba(60, 180, 255, 0.28);
  --line-lime: rgba(169, 241, 78, 0.34);
  --glass-specular: inset 0 1px 0 0 rgba(250, 252, 255, 0.22);

  /* Texto */
  --ink: #FAFCFF;
  --ink-secondary: #C8D7E6;
  --muted: #849BB3;
  --muted-soft: #5D758E;

  /* Tokens de Forma y Movimiento */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg-abyss);
  color-scheme: dark;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-abyss);
  background-image:
    radial-gradient(circle at 14% 8%, rgba(14, 165, 233, 0.16), transparent 36%),
    radial-gradient(circle at 88% 12%, rgba(67, 176, 42, 0.13), transparent 34%),
    radial-gradient(circle at 75% 88%, rgba(11, 94, 138, 0.22), transparent 42%),
    linear-gradient(180deg, #05101C 0%, #071626 52%, #040C15 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

/* Scrollbar personalizado oscuro */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(5, 16, 28, 0.8);
}
::-webkit-scrollbar-thumb {
  background: rgba(60, 180, 255, 0.22);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(60, 180, 255, 0.42);
}

/* ==========================================================================
   1. SHELL & SIDEBAR (Navegación lateral cristal)
   ========================================================================== */
.shell {
  min-height: 100vh;
  position: relative;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 262px;
  background: linear-gradient(180deg, rgba(8, 25, 42, 0.86) 0%, rgba(5, 16, 28, 0.92) 100%);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.35), var(--glass-specular);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 16px;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 24px;
  color: var(--bone);
  text-decoration: none;
  border-bottom: 1px solid rgba(230, 237, 245, 0.07);
  margin-bottom: 14px;
}

.brand-mark {
  height: 40px;
  width: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  font-size: 0;
  background-image: url('../img/droneflow-mark.svg');
  background-size: cover;
  background-position: center;
  box-shadow:
    0 8px 20px rgba(14, 165, 233, 0.28),
    0 0 0 1px rgba(250, 252, 255, 0.22);
}

.brand b {
  display: block;
  font: 800 italic 21px/1.05 'Montserrat', sans-serif;
  letter-spacing: -0.03em;
  color: var(--bone);
}

.brand b em {
  font-style: italic;
  color: var(--lime);
}

.brand small {
  font: 600 8.5px/1.2 'Inter', sans-serif;
  letter-spacing: 0.14em;
  color: var(--cyan);
  display: block;
  margin-top: 4px;
  opacity: 0.88;
}

.nav-label {
  font: 700 10px/1 'Montserrat', sans-serif;
  letter-spacing: 0.14em;
  color: var(--muted-soft);
  padding: 10px 12px 8px;
  text-transform: uppercase;
}

.nav-label.space {
  margin-top: 14px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding-right: 2px;
}

/* Items de navegación con efecto cristal al pasar o activar */
.nav-item {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  text-decoration: none;
  color: var(--ink-secondary);
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.22s var(--ease);
  position: relative;
}

.nav-item:hover {
  background: rgba(60, 180, 255, 0.08);
  border-color: rgba(60, 180, 255, 0.18);
  color: var(--bone);
  transform: translateX(2px);
}

/* Activo: Pastilla cristal verde lima / agrícola como en el manual de marca */
.nav-item.active {
  background: linear-gradient(115deg, rgba(67, 176, 42, 0.32) 0%, rgba(169, 241, 78, 0.22) 55%, rgba(14, 165, 233, 0.20) 100%);
  border-color: rgba(169, 241, 78, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(250, 252, 255, 0.30),
    0 8px 22px -6px rgba(67, 176, 42, 0.38);
  color: var(--bone);
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 99px;
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.nav-item:hover .nav-icon {
  color: var(--cyan);
}

.nav-item.active .nav-icon {
  color: var(--lime);
}

.nav-item.disabled {
  opacity: 0.45;
  cursor: default;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 14px;
}

.demo-sidebar-note {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid rgba(169, 241, 78, 0.35);
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(67, 176, 42, 0.16), rgba(169, 241, 78, 0.08));
  box-shadow: var(--glass-specular);
  color: var(--lime);
  font: 700 10.5px 'Montserrat', sans-serif;
  letter-spacing: 0.06em;
}

.demo-sidebar-note span {
  font: 500 10.5px 'Inter', sans-serif;
  color: var(--mist);
  letter-spacing: 0;
}

.help-card {
  background: linear-gradient(145deg, rgba(14, 165, 233, 0.10), rgba(11, 94, 138, 0.18));
  border: 1px solid rgba(60, 180, 255, 0.20);
  box-shadow: var(--glass-specular);
  padding: 12px 13px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11.5px;
  transition: border-color 0.2s var(--ease);
}

.help-card:hover {
  border-color: rgba(60, 180, 255, 0.38);
}

.help-card b, .help-card small {
  display: block;
}

.help-card b {
  color: var(--bone);
  font-size: 12px;
  margin-bottom: 2px;
}

.help-card small {
  font-size: 10.5px;
  color: var(--muted);
}

.help-card > span:last-child {
  margin-left: auto;
  font-size: 18px;
  color: var(--cyan);
}

.help-dot {
  width: 8px;
  height: 8px;
  background: var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(169, 241, 78, 0.18), 0 0 10px var(--lime);
}

.company-chip {
  border-top: 1px solid var(--line);
  padding: 14px 4px 0;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.company-avatar, .top-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(60, 180, 255, 0.28), rgba(67, 176, 42, 0.32));
  border: 1px solid rgba(169, 241, 78, 0.42);
  box-shadow: var(--glass-specular);
  color: var(--bone);
  font: 700 13.5px 'Montserrat', sans-serif;
}

.company-meta {
  min-width: 0;
  flex: 1;
}

.company-meta b, .company-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-meta b {
  font-size: 12.5px;
  color: var(--bone);
}

.company-meta small {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.company-chip form {
  margin: 0;
}

/* Botón cerrar sesión cristal */
.logout {
  height: 34px;
  width: 34px;
  border-radius: 10px;
  border: 1px solid rgba(230, 237, 245, 0.14);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--glass-specular);
  color: var(--ink-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  transition: all 0.2s var(--ease);
}

.logout:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
  color: #FCA5A5;
  transform: translateY(-1px);
}

/* ==========================================================================
   2. TOPBAR & LAYOUT PRINCIPAL
   ========================================================================== */
.main {
  margin-left: 262px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 68px;
  padding: 0 34px;
  background: rgba(6, 19, 32, 0.74);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.crumb {
  font-size: 13px;
  color: var(--muted);
}

.crumb span {
  padding: 0 8px;
  color: var(--muted-soft);
}

.crumb b {
  color: var(--bone);
  font-weight: 600;
}

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

.search {
  height: 38px;
  width: 248px;
  border: 1px solid rgba(230, 237, 245, 0.14);
  background: rgba(11, 32, 52, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  color: var(--cyan);
  transition: all 0.2s var(--ease);
}

.search:focus-within {
  border-color: var(--cyan);
  background: rgba(11, 40, 66, 0.78);
  box-shadow: 0 0 0 3px rgba(60, 180, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.search input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font: 13px 'Inter', sans-serif;
  color: var(--bone);
}

.search input::placeholder {
  color: var(--muted);
}

.icon-button {
  position: relative;
  height: 38px;
  width: 38px;
  border-radius: 50%;
  border: 1px solid rgba(230, 237, 245, 0.14);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  box-shadow: var(--glass-specular);
  color: var(--ink-secondary);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s var(--ease);
}

.icon-button:hover {
  border-color: rgba(60, 180, 255, 0.42);
  background: rgba(60, 180, 255, 0.14);
  color: var(--bone);
  transform: translateY(-1px);
}

.icon-button i {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 7px;
  height: 7px;
  background: var(--lime);
  border: 1.5px solid var(--bg-base);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--lime);
}

.top-avatar {
  width: 36px;
  height: 36px;
}

.menu-toggle {
  display: none;
}

.content {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 32px 34px 40px;
  flex: 1;
}

/* ==========================================================================
   3. SISTEMA DE BOTONES EFECTO CRISTAL (Crystal Glass Buttons)
   ========================================================================== */
.button,
.text-button,
.link-button,
.row-action,
.dialog-close {
  font-family: 'Inter', sans-serif;
  transition:
    transform 0.22s var(--ease),
    box-shadow 0.22s var(--ease),
    background 0.22s var(--ease),
    border-color 0.22s var(--ease),
    color 0.22s var(--ease);
}

.button {
  position: relative;
  height: 42px;
  border-radius: var(--radius-pill);
  padding: 0 20px;
  font: 600 13.5px/1 'Montserrat', 'Inter', sans-serif;
  letter-spacing: -0.01em;
  border: 1px solid rgba(250, 252, 255, 0.24);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  overflow: hidden;
  user-select: none;
}

/* Reflejo superior tipo lente de cristal */
.button::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(250, 252, 255, 0.28) 0%, rgba(250, 252, 255, 0.03) 48%, transparent 100%);
  pointer-events: none;
}

/* Primario: Gradiente Cristal Oficial (#3CB4FF -> #0EA5E9 -> #43B02A -> #A9F14E) */
.button.primary {
  color: var(--bone);
  text-shadow: 0 1px 2px rgba(4, 12, 21, 0.45);
  background:
    linear-gradient(115deg,
      rgba(60, 180, 255, 0.88) 0%,
      rgba(14, 165, 233, 0.82) 38%,
      rgba(67, 176, 42, 0.88) 82%,
      rgba(169, 241, 78, 0.85) 100%);
  border-color: rgba(169, 241, 78, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(250, 252, 255, 0.45),
    inset 0 -1px 0 rgba(11, 94, 138, 0.45),
    0 10px 26px -6px rgba(14, 165, 233, 0.42),
    0 6px 18px -6px rgba(67, 176, 42, 0.38);
}

.button.primary:hover {
  transform: translateY(-2px);
  border-color: var(--lime);
  box-shadow:
    inset 0 1px 0 rgba(250, 252, 255, 0.65),
    0 14px 32px -6px rgba(60, 180, 255, 0.52),
    0 10px 24px -6px rgba(169, 241, 78, 0.42);
  filter: brightness(1.06);
}

.button.primary:active {
  transform: translateY(0) scale(0.985);
}

/* Secundario: Cristal Celeste Tecnológico (#3CB4FF / #0EA5E9) */
.button.secondary {
  background: linear-gradient(135deg, rgba(60, 180, 255, 0.18), rgba(11, 94, 138, 0.34));
  border: 1px solid rgba(60, 180, 255, 0.42);
  color: var(--bone);
  box-shadow:
    inset 0 1px 0 rgba(250, 252, 255, 0.25),
    0 8px 20px -6px rgba(14, 165, 233, 0.28);
}

.button.secondary:hover {
  background: linear-gradient(135deg, rgba(60, 180, 255, 0.28), rgba(14, 165, 233, 0.42));
  border-color: var(--cyan);
  transform: translateY(-1.5px);
  box-shadow:
    inset 0 1px 0 rgba(250, 252, 255, 0.38),
    0 12px 24px -6px rgba(60, 180, 255, 0.38);
}

/* Quiet / Ghost: Cristal ahumado sutil */
.button.quiet {
  background: rgba(230, 237, 245, 0.06);
  border: 1px solid rgba(230, 237, 245, 0.18);
  color: var(--ink-secondary);
  box-shadow: inset 0 1px 0 rgba(250, 252, 255, 0.14);
}

.button.quiet:hover {
  background: rgba(230, 237, 245, 0.12);
  border-color: rgba(230, 237, 245, 0.32);
  color: var(--bone);
  transform: translateY(-1px);
}

.button:focus-visible,
.link-button:focus-visible,
.text-button:focus-visible,
.row-action:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Botones de enlace tipo píldora de cristal ("Ver predios →", "Ver órdenes →") */
.text-button,
.link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(60, 180, 255, 0.28);
  background: linear-gradient(135deg, rgba(60, 180, 255, 0.12), rgba(11, 94, 138, 0.22));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(250, 252, 255, 0.18);
  color: var(--cyan);
  font: 600 11.5px/1 'Inter', sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.text-button:hover,
.link-button:hover {
  background: linear-gradient(135deg, rgba(60, 180, 255, 0.24), rgba(67, 176, 42, 0.24));
  border-color: var(--lime);
  color: var(--bone);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(250, 252, 255, 0.28),
    0 6px 16px -4px rgba(60, 180, 255, 0.32);
}

.text-button {
  margin-top: 12px;
}

.text-button span,
.link-button span {
  transition: transform 0.2s var(--ease);
}

.text-button:hover span,
.link-button:hover span {
  transform: translateX(3px);
}

/* Botones de acción en filas de tabla (micro-cristal) */
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(60, 180, 255, 0.24);
  background: rgba(60, 180, 255, 0.09);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(250, 252, 255, 0.14);
  color: var(--cyan);
  font: 600 11px/1 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
}

.row-action:hover {
  background: linear-gradient(135deg, rgba(60, 180, 255, 0.24), rgba(67, 176, 42, 0.24));
  border-color: rgba(169, 241, 78, 0.5);
  color: var(--bone);
  text-decoration: none;
  transform: translateY(-1px);
}

.row-action.archive-record:hover,
.row-action.user-disable:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
  color: #FCA5A5;
}

.row-transition {
  height: 28px;
  font: 600 11px 'Inter', sans-serif;
  color: var(--bone);
  border: 1px solid rgba(60, 180, 255, 0.28);
  border-radius: var(--radius-pill);
  padding: 0 10px;
  background: rgba(11, 35, 58, 0.78);
  backdrop-filter: blur(8px);
  cursor: pointer;
  outline: none;
}

.row-transition:hover,
.row-transition:focus {
  border-color: var(--lime);
}

/* ==========================================================================
   4. ENCABEZADOS DE SECCIÓN, KPIs & PANELES CRISTAL
   ========================================================================== */
.welcome-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 10.5px/1 'Montserrat', sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lime);
}

.eyebrow.blue {
  color: var(--cyan);
}

.eyebrow.blue::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
}

.welcome-row h1 {
  font: 800 31px/1.12 'Montserrat', sans-serif;
  letter-spacing: -0.03em;
  margin: 8px 0 6px;
  color: var(--bone);
}

.muted {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
}

.demo-inline {
  color: var(--lime);
  font-weight: 600;
}

.section-heading,
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-heading {
  margin-bottom: 14px;
}

.section-heading h2,
.panel-head h2 {
  font: 700 17px/1.2 'Montserrat', sans-serif;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
  color: var(--bone);
}

.section-heading p,
.panel-head p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

/* Tarjetas KPI y Paneles en Cristal Oscuro */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi,
.panel {
  position: relative;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-radius: var(--radius);
  box-shadow:
    0 18px 40px -18px rgba(0, 0, 0, 0.55),
    var(--glass-specular);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.kpi {
  padding: 18px 20px 16px;
  min-height: 124px;
  overflow: hidden;
}

.kpi::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(60, 180, 255, 0.14), transparent 70%);
  pointer-events: none;
}

.kpi:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow:
    0 22px 44px -16px rgba(0, 0, 0, 0.65),
    0 0 24px -8px rgba(60, 180, 255, 0.25),
    var(--glass-specular);
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
  border: 1px solid rgba(250, 252, 255, 0.16);
  box-shadow: var(--glass-specular);
}

.kpi-icon.green {
  background: rgba(67, 176, 42, 0.20);
  border-color: rgba(169, 241, 78, 0.35);
  color: var(--lime);
}

.kpi-icon.blue {
  background: rgba(14, 165, 233, 0.20);
  border-color: rgba(60, 180, 255, 0.35);
  color: var(--cyan);
}

.kpi-icon.mint {
  background: linear-gradient(135deg, rgba(67, 176, 42, 0.22), rgba(14, 165, 233, 0.22));
  border-color: rgba(169, 241, 78, 0.35);
  color: var(--lime);
}

.kpi-icon.sky {
  background: rgba(60, 180, 255, 0.18);
  border-color: rgba(60, 180, 255, 0.35);
  color: var(--cyan);
}

.kpi strong {
  display: block;
  font: 800 30px/1.1 'Montserrat', sans-serif;
  margin: 10px 0 8px;
  letter-spacing: -0.03em;
  color: var(--bone);
}

.kpi strong small {
  font: 600 13px 'Inter', sans-serif;
  color: var(--cyan);
  letter-spacing: 0;
}

.kpi-foot {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.quiet-dot {
  width: 6px;
  height: 6px;
  background: var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(169, 241, 78, 0.6);
}

/* Grids del Dashboard */
.dashboard-grid,
.bottom-grid {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 20px;
}

.panel:hover {
  border-color: rgba(60, 180, 255, 0.20);
}

.panel-head {
  margin-bottom: 16px;
}

/* Mapa y Estados vacíos */
.map-panel {
  padding-bottom: 14px;
}

.dashboard-map {
  height: 320px;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  z-index: 1;
  background: #061320;
}

/* Modo oscuro para mapas interactivos Leaflet */
.dashboard-map .leaflet-tile-pane,
#plot-map .leaflet-tile-pane {
  filter: invert(100%) hue-rotate(192deg) brightness(92%) contrast(92%) saturate(135%);
}

.leaflet-container {
  background: #061320 !important;
  font-family: 'Inter', sans-serif !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(8, 25, 42, 0.92) !important;
  backdrop-filter: blur(14px);
  color: var(--bone) !important;
  border: 1px solid rgba(60, 180, 255, 0.35);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55) !important;
}

.leaflet-control-zoom a {
  background: rgba(8, 25, 42, 0.88) !important;
  color: var(--bone) !important;
  border-color: var(--line) !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(60, 180, 255, 0.22) !important;
  color: var(--lime) !important;
}

.leaflet-control-attribution {
  background: rgba(4, 12, 21, 0.72) !important;
  color: var(--muted) !important;
}

.leaflet-control-attribution a {
  color: var(--cyan) !important;
}

.map-legend {
  display: flex;
  gap: 20px;
  padding: 12px 4px 2px;
  color: var(--ink-secondary);
  font-size: 12px;
}

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

.map-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-farm {
  background: var(--cyan);
  border: 2px solid var(--blue-deep);
  box-shadow: 0 0 8px var(--cyan);
}

.legend-plot {
  background: var(--lime);
  border: 1px solid var(--green);
  box-shadow: 0 0 8px var(--lime);
}

.dashboard-map-empty,
.empty-state {
  height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 35%, rgba(14, 165, 233, 0.10), transparent 65%),
    rgba(5, 16, 28, 0.45);
  border: 1px dashed rgba(230, 237, 245, 0.14);
  color: var(--muted);
}

.empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(60, 180, 255, 0.16), rgba(67, 176, 42, 0.18));
  border: 1px solid rgba(60, 180, 255, 0.30);
  box-shadow: var(--glass-specular);
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-size: 20px;
  margin-bottom: 6px;
}

.dashboard-map-empty b,
.empty-state b {
  color: var(--bone);
  font: 700 14px 'Montserrat', sans-serif;
}

.dashboard-map-empty > span:not(.empty-icon),
.empty-state span {
  max-width: 260px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

/* Alertas operacionales en dashboard */
.dashboard-alerts {
  margin: 0 0 18px;
  padding: 15px 18px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(11, 32, 52, 0.72));
  backdrop-filter: blur(14px);
  box-shadow: var(--glass-specular);
  color: #FDE68A;
}

.dashboard-alert-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.dashboard-alert-title > span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.25);
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: #FEF08A;
  font-weight: 700;
}

.dashboard-alerts ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0 0 0 32px;
}

.dashboard-alerts li {
  font-size: 12.5px;
  margin: 4px 0;
  color: var(--mist);
}

.dashboard-alerts small {
  margin-left: 8px;
  color: #FCD34D;
}

/* Lista de próximas operaciones y actividad reciente */
.upcoming-list {
  padding: 2px 4px 4px;
}

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 11px;
  border-bottom: 1px solid rgba(230, 237, 245, 0.07);
  color: inherit;
  text-decoration: none;
  transition: background 0.2s var(--ease);
}

.upcoming-item:hover {
  background: rgba(60, 180, 255, 0.08);
}

.upcoming-item:last-child {
  border-bottom: 0;
}

.upcoming-date {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(11, 94, 138, 0.35));
  border: 1px solid rgba(60, 180, 255, 0.32);
  color: var(--cyan);
  font: 700 12px 'Montserrat', sans-serif;
}

.upcoming-info {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.upcoming-info b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bone);
  font-size: 12.5px;
}

.upcoming-info small {
  color: var(--muted);
  font-size: 11px;
}

.priority-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.priority-high,
.priority-urgent {
  background: #FB923C;
  box-shadow: 0 0 10px #FB923C;
}

.priority-low {
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 4px 6px 8px;
}

.activity-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(230, 237, 245, 0.06);
}

.activity-list li:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(60, 180, 255, 0.15), 0 0 8px var(--cyan);
}

.activity-list li > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.activity-list b {
  color: var(--bone);
  font-size: 12.5px;
  text-transform: capitalize;
}

.activity-list small {
  color: var(--muted);
  font-size: 11px;
}

.empty-inline {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.activity-line {
  height: 26px;
  width: 2px;
  background: rgba(60, 180, 255, 0.35);
  margin-left: 5px;
}

.quick-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 8px;
}

.quick-stats > a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 10px;
  border-radius: 10px;
  color: var(--ink-secondary);
  text-decoration: none;
  border-bottom: 1px solid rgba(230, 237, 245, 0.07);
  transition: all 0.2s var(--ease);
}

.quick-stats > a:hover {
  background: rgba(60, 180, 255, 0.08);
  color: var(--bone);
  padding-left: 14px;
}

.quick-stats > a span {
  font-size: 12.5px;
}

.quick-stats > a b {
  font: 700 18px 'Montserrat', sans-serif;
  color: var(--lime);
}

/* ==========================================================================
   5. TABLAS DE OPERACIONES & ESTADOS (Módulos CRUD)
   ========================================================================== */
.operations-panel {
  padding: 20px 0 0;
  overflow: hidden;
}

.operations-panel > .panel-head {
  padding: 0 22px 6px;
}

.table-search {
  width: 230px;
  height: 36px;
}

.table-search input {
  display: block;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.data-table th {
  text-align: left;
  background: rgba(5, 16, 28, 0.55);
  color: var(--cyan);
  font: 700 10.5px/1 'Montserrat', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(230, 237, 245, 0.06);
  color: var(--ink-secondary);
  font-size: 12.5px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table td:first-child {
  color: var(--bone);
  font-weight: 600;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background 0.18s var(--ease);
}

.data-table tbody tr:hover {
  background: rgba(60, 180, 255, 0.06);
}

.loading-cell {
  text-align: center !important;
  padding: 44px 16px !important;
  color: var(--muted) !important;
  font-weight: 400 !important;
}

/* Badges de estado efecto cristal */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: rgba(230, 237, 245, 0.08);
  border: 1px solid rgba(230, 237, 245, 0.18);
  color: var(--ink-secondary);
  font: 600 11px/1.2 'Inter', sans-serif;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.status-badge.active,
.status-badge.available,
.status-badge.completed,
.status-badge.closed {
  background: rgba(67, 176, 42, 0.18);
  border-color: rgba(169, 241, 78, 0.42);
  color: var(--lime);
}

.status-badge.scheduled,
.status-badge.in_progress,
.status-badge.in_use,
.status-badge.planned,
.status-badge.imported {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(60, 180, 255, 0.42);
  color: var(--cyan);
}

.status-badge.cancelled,
.status-badge.archived,
.status-badge.retired,
.status-badge.disabled {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.24);
  color: var(--muted);
}

.status-badge.suspended,
.status-badge.maintenance,
.status-badge.unavailable {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(251, 191, 36, 0.42);
  color: #FCD34D;
}

.table-foot {
  display: flex;
  justify-content: space-between;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: rgba(5, 16, 28, 0.35);
  color: var(--muted);
  font-size: 11.5px;
}

.operation-alert {
  margin: 0 22px 14px;
  padding: 12px 15px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.38);
  border-radius: 12px;
  color: #FECACA;
  font-size: 12.5px;
}

/* ==========================================================================
   6. MODALES / DIALOGS CRISTAL & FORMULARIOS
   ========================================================================== */
.record-dialog {
  width: min(660px, calc(100% - 28px));
  max-height: 88vh;
  border: 1px solid rgba(60, 180, 255, 0.28);
  border-radius: var(--radius-lg);
  padding: 0;
  background: linear-gradient(165deg, rgba(10, 31, 51, 0.94) 0%, rgba(6, 18, 31, 0.97) 100%);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  color: var(--bone);
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.72),
    var(--glass-specular);
}

.record-dialog::backdrop {
  background: rgba(3, 10, 18, 0.72);
  backdrop-filter: blur(6px);
}

.record-dialog form {
  padding: 26px;
}

#documents-dialog,
#history-dialog {
  padding: 26px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.dialog-head h2 {
  font: 700 22px/1.15 'Montserrat', sans-serif;
  margin: 6px 0 0;
  color: var(--bone);
}

.dialog-close {
  border: 1px solid rgba(230, 237, 245, 0.18);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--glass-specular);
  border-radius: 50%;
  height: 34px;
  width: 34px;
  color: var(--ink-secondary);
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.dialog-close:hover {
  background: rgba(60, 180, 255, 0.18);
  border-color: var(--cyan);
  color: var(--bone);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 14px;
}

.form-grid label,
.geojson-label,
.report-select {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 600;
}

.form-grid .field-wide {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.geojson-label textarea,
.report-select select {
  width: 100%;
  border: 1px solid rgba(230, 237, 245, 0.16);
  border-radius: 11px;
  background: rgba(5, 16, 28, 0.65);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  padding: 10px 12px;
  font: 13px 'Inter', sans-serif;
  color: var(--bone);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.form-grid input,
.form-grid select,
.report-select select {
  height: 40px;
}

.form-grid textarea,
.geojson-label textarea {
  resize: vertical;
  min-height: 70px;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.geojson-label textarea:focus,
.report-select select:focus {
  border-color: var(--cyan);
  background: rgba(8, 25, 43, 0.85);
  box-shadow: 0 0 0 3px rgba(60, 180, 255, 0.20);
}

.map-editor {
  margin-top: 16px;
}

.map-editor[hidden] {
  display: none !important;
}

#plot-map {
  height: 230px;
  border-radius: 12px;
  border: 1px solid var(--line);
  z-index: 1;
}

.map-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.map-tools .button {
  height: 34px;
  font-size: 11.5px;
  padding: 0 14px;
}

.map-tools #map-hint {
  font-size: 11.5px;
  color: var(--muted);
}

.geojson-label textarea {
  font: 12px ui-monospace, SFMono-Regular, monospace;
}

.dialog-actions {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.documents-list {
  list-style: none;
  margin: 12px 0 18px;
  padding: 0;
  max-height: 260px;
  overflow: auto;
}

.documents-list li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.documents-list a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
}

.documents-list a:hover {
  color: var(--lime);
}

.documents-list small {
  color: var(--muted);
  font-size: 11px;
}

.document-upload,
.upload-flight {
  cursor: pointer;
}

.report-help {
  line-height: 1.6;
  margin: 0 0 18px;
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */
footer {
  height: 48px;
  border-top: 1px solid var(--line);
  padding: 0 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  background: rgba(4, 12, 21, 0.55);
}

footer span {
  color: var(--muted-soft);
}

.footer-right {
  margin-left: auto;
}

.footer-right b {
  color: var(--cyan);
}

/* ==========================================================================
   8. PANTALLAS DE ACCESO & RECUPERACIÓN (Login Dark Crystal)
   ========================================================================== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  background: var(--bg-abyss);
}

.login-art {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background-image:
    linear-gradient(155deg, rgba(6, 24, 41, 0.64) 0%, rgba(11, 94, 138, 0.38) 52%, rgba(5, 22, 38, 0.52) 100%),
    url('../img/login-agriculture.jpg?v=2');
  background-size: cover;
  background-position: center;
  color: var(--bone);
  border-right: 1px solid var(--line);
}

.login-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 70% 35%, rgba(169, 241, 78, 0.14), transparent 48%),
    linear-gradient(0deg, rgba(4, 12, 21, 0.62), transparent 55%);
}

.art-orbit {
  position: absolute;
  border: 1px solid rgba(250, 252, 255, 0.14);
  border-radius: 50%;
  z-index: 1;
}

.orbit-a {
  height: 670px;
  width: 670px;
  right: -170px;
  top: 15%;
}

.orbit-b {
  height: 490px;
  width: 490px;
  right: -80px;
  top: 25%;
}

.art-copy {
  position: relative;
  z-index: 2;
  height: 100vh;
  min-height: 650px;
  padding: 40px 9%;
  display: flex;
  flex-direction: column;
}

.brand.light {
  border-bottom: 0;
  margin-bottom: 0;
}

.art-message {
  margin: auto 0;
  padding-bottom: 24px;
}

.art-message .eyebrow {
  color: var(--lime);
  background: rgba(5, 18, 31, 0.52);
  border: 1px solid rgba(169, 241, 78, 0.38);
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(10px);
}

.art-message h1 {
  font: 800 clamp(40px, 4.8vw, 64px)/1.06 'Montserrat', sans-serif;
  letter-spacing: -0.035em;
  margin: 22px 0 18px;
  color: var(--bone);
}

.art-message h1 em {
  font-style: italic;
  background: linear-gradient(95deg, var(--cyan), var(--lime));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.art-message p {
  max-width: 410px;
  color: var(--mist);
  line-height: 1.68;
  font-size: 15px;
}

.art-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.art-badges span {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(6, 20, 34, 0.58);
  border: 1px solid rgba(250, 252, 255, 0.18);
  backdrop-filter: blur(10px);
  box-shadow: var(--glass-specular);
  font: 600 11px 'Inter', sans-serif;
  color: var(--bone);
}

.art-foot {
  font: 700 10px 'Montserrat', sans-serif;
  letter-spacing: 0.14em;
  color: var(--ink-secondary);
}

.art-foot span {
  float: right;
  color: var(--lime);
}

.login-main {
  display: grid;
  place-items: center;
  padding: 40px 28px;
  background:
    radial-gradient(circle at 80% 15%, rgba(60, 180, 255, 0.14), transparent 42%),
    radial-gradient(circle at 20% 85%, rgba(67, 176, 42, 0.12), transparent 42%);
}

.login-box {
  width: min(420px, 100%);
  padding: 34px 32px;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--line);
  box-shadow:
    0 28px 70px -20px rgba(0, 0, 0, 0.7),
    var(--glass-specular);
}

.login-box h2 {
  font: 800 29px/1.12 'Montserrat', sans-serif;
  letter-spacing: -0.03em;
  margin: 10px 0 6px;
  color: var(--bone);
}

.login-box > .muted {
  font-size: 13.5px;
  margin-bottom: 24px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-secondary);
  font-weight: 600;
}

.form-stack input {
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(230, 237, 245, 0.16);
  border-radius: 12px;
  background: rgba(4, 14, 24, 0.68);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
  font: 13.5px 'Inter', sans-serif;
  color: var(--bone);
  outline: none;
  transition: all 0.2s var(--ease);
}

.form-stack input:focus {
  border-color: var(--cyan);
  background: rgba(8, 25, 43, 0.88);
  box-shadow: 0 0 0 3px rgba(60, 180, 255, 0.22);
}

.form-stack input::placeholder {
  color: var(--muted-soft);
}

.button.full {
  width: 100%;
  margin-top: 6px;
  height: 46px;
}

.button.full span {
  margin-left: auto;
}

.login-forgot,
.recovery-back {
  display: block;
  margin-top: 16px;
  color: var(--cyan);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.login-forgot {
  text-align: right;
  margin: 12px 0 4px;
}

.login-forgot:hover,
.recovery-back:hover {
  color: var(--lime);
  text-decoration: underline;
}

.demo-divider,
.separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.demo-divider::before,
.demo-divider::after,
.separator::before,
.separator::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

/* Botón Demo Cristal Especial */
.demo-button {
  display: flex;
  align-items: center;
  gap: 12px;
  height: auto !important;
  padding: 12px 16px !important;
  border-radius: 16px !important;
  text-align: left !important;
  background: linear-gradient(135deg, rgba(60, 180, 255, 0.14), rgba(67, 176, 42, 0.16)) !important;
  border: 1px solid rgba(60, 180, 255, 0.35) !important;
  color: var(--bone) !important;
  box-shadow:
    inset 0 1px 0 rgba(250, 252, 255, 0.22),
    0 10px 24px -10px rgba(14, 165, 233, 0.35) !important;
}

.demo-button:hover {
  background: linear-gradient(135deg, rgba(60, 180, 255, 0.24), rgba(67, 176, 42, 0.28)) !important;
  border-color: var(--lime) !important;
  transform: translateY(-2px);
}

.demo-button-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: var(--bone);
  font-size: 18px;
  box-shadow: 0 6px 14px rgba(14, 165, 233, 0.35);
}

.demo-button-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.demo-button-copy b {
  font: 700 13.5px 'Montserrat', sans-serif;
  color: var(--bone);
}

.demo-button-copy small {
  color: var(--ink-secondary);
  font: 11.5px 'Inter', sans-serif;
}

.demo-arrow {
  font-size: 18px;
  color: var(--lime);
}

.register summary {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cyan);
  cursor: pointer;
  text-align: center;
}

.register form {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(4, 14, 24, 0.45);
  border-radius: 14px;
}

.login-legal {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.38);
  color: #FECACA;
  font-size: 12.5px;
  margin: 14px 0;
}

.alert.success {
  background: rgba(67, 176, 42, 0.18);
  border-color: rgba(169, 241, 78, 0.42);
  color: var(--lime);
}

.recovery-main {
  min-height: 100vh;
  grid-column: 1 / -1;
}

.recovery-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  color: var(--bone);
  font: 800 italic 23px 'Montserrat', sans-serif;
  text-decoration: none;
}

.recovery-brand em {
  color: var(--lime);
  font-style: italic;
}

.recovery-brand span:not(.brand-mark) {
  color: var(--cyan);
  font: 600 12px 'Inter', sans-serif;
  font-style: normal;
}

.login-mobile-brand,
.mobile-foot {
  display: none;
}

/* ==========================================================================
   9. RESPONSIVE (Tablet & Mobile)
   ========================================================================== */
@media (max-width: 1100px) {
  .sidebar {
    width: 232px;
  }
  .main {
    margin-left: 232px;
  }
  .content {
    padding: 26px 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.65);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  .topbar {
    height: 60px;
    padding: 0 16px;
  }
  .menu-toggle {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    color: var(--bone);
    font-size: 18px;
    cursor: pointer;
  }
  .crumb {
    margin-right: auto;
    margin-left: 12px;
    font-size: 12px;
  }
  .top-actions {
    gap: 10px;
  }
  .search {
    width: 38px;
    padding: 0;
    justify-content: center;
  }
  .search input {
    display: none;
  }
  .content {
    padding: 22px 16px 30px;
  }
  .welcome-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .welcome-row h1 {
    font-size: 25px;
  }
  .kpi-grid {
    gap: 12px;
  }
  .kpi {
    padding: 15px;
    min-height: 110px;
  }
  .kpi strong {
    font-size: 24px;
  }
  .operations-panel > .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .table-search {
    width: 100%;
  }
  .record-dialog form {
    padding: 18px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .field-wide {
    grid-column: auto;
  }
  .table-foot span:last-child {
    display: none;
  }
  footer {
    padding: 0 16px;
  }
  .footer-right {
    display: none;
  }
  .login-page {
    display: block;
  }
  .login-art {
    display: none;
  }
  .login-main {
    min-height: 100vh;
    padding: 28px 16px;
  }
  .login-box {
    padding: 26px 22px;
  }
  .login-mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
  }
  .login-mobile-brand b {
    display: block;
    font: 800 italic 21px 'Montserrat', sans-serif;
    color: var(--bone);
  }
  .login-mobile-brand b em {
    color: var(--lime);
    font-style: italic;
  }
  .login-mobile-brand span:not(.brand-mark) {
    font: 600 10.5px 'Inter', sans-serif;
    color: var(--cyan);
  }
  .mobile-foot {
    display: block;
    margin-top: 24px;
    text-align: center;
    font-size: 11px;
    color: var(--muted);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}


/* ==========================================================================
   10. TEMA CLARO OPCIONAL (data-theme="light") · Oscuro por defecto
   ========================================================================== */
html[data-theme="light"] {
  --bg-abyss: #EEF4FA;
  --bg-base: #F6FAFE;
  --bg-elevated: #FFFFFF;
  --bg-panel: rgba(250, 252, 255, 0.82);
  --bg-panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(11, 94, 138, 0.13);
  --line-strong: rgba(14, 165, 233, 0.38);
  --glass-specular: inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
  --ink: #0B253A;
  --ink-secondary: #2B4861;
  --muted: #5E7890;
  --muted-soft: #859BB0;
  --bone: #0B253A;
  color-scheme: light;
}

html[data-theme="light"] body {
  background-color: var(--bg-abyss);
  background-image:
    radial-gradient(circle at 14% 8%, rgba(60, 180, 255, 0.16), transparent 36%),
    radial-gradient(circle at 88% 12%, rgba(169, 241, 78, 0.18), transparent 34%),
    linear-gradient(180deg, #F6FAFF 0%, #E6EDF5 100%);
  color: var(--ink);
}

html[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #072338 0%, #061A2B 100%);
  --bone: #FAFCFF;
  --ink-secondary: #C8D7E6;
  --muted: #849BB3;
}

html[data-theme="light"] .topbar {
  background: rgba(250, 252, 255, 0.82);
}

html[data-theme="light"] .search {
  background: rgba(230, 237, 245, 0.75);
  border-color: rgba(11, 94, 138, 0.18);
}

html[data-theme="light"] .button.primary,
html[data-theme="light"] .demo-button-icon {
  color: #FAFCFF;
}

html[data-theme="light"] .data-table th {
  background: rgba(230, 237, 245, 0.7);
  color: var(--blue-deep);
}

html[data-theme="light"] .dashboard-map .leaflet-tile-pane,
html[data-theme="light"] #plot-map .leaflet-tile-pane {
  filter: none;
}

/* DroneFlow Marine */
.module-switch{display:flex;gap:6px;margin:18px 18px 8px;padding:4px;border:1px solid var(--line);border-radius:12px;background:rgba(2,14,24,.42)}
.module-switch a{flex:1;text-align:center;text-decoration:none;color:var(--muted);font-size:12px;font-weight:700;padding:9px 7px;border-radius:8px;transition:background .2s,color .2s}
.module-switch a:hover{color:var(--bone);background:var(--bg-glass-hover)}.module-switch a.selected{color:#EAF8FF;background:linear-gradient(135deg,rgba(60,180,255,.28),rgba(14,165,233,.12));box-shadow:inset 0 0 0 1px rgba(60,180,255,.24)}
.marine-hero{display:flex;justify-content:space-between;align-items:center;gap:24px;margin-bottom:25px;padding:24px 28px;border:1px solid rgba(60,180,255,.18);border-radius:20px;background:radial-gradient(ellipse at 90% 10%,rgba(14,165,233,.16),transparent 42%),linear-gradient(115deg,#0a2232,#081b29 62%,#092538);box-shadow:0 14px 38px rgba(0,0,0,.16)}
.marine-dashboard-filters{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;margin:-8px 0 20px;padding:14px 16px;border:1px solid var(--line);border-radius:14px;background:rgba(9,31,46,.7)}.marine-dashboard-filters label{display:grid;gap:6px;min-width:145px;color:var(--muted);font-size:10px;font-weight:700}.marine-dashboard-filters select,.marine-dashboard-filters input{min-height:38px;padding:8px 10px;color:var(--ink);background:#0a1d2b;border:1px solid var(--line-strong);border-radius:9px;font:500 12px Inter,sans-serif}.marine-dashboard-filters .button{min-height:38px}.marine-filter-reset{padding:10px 5px;color:var(--muted);font-size:11px;text-decoration:none}.marine-filter-reset:hover{color:var(--cyan)}
.marine-hero h1{margin:8px 0 5px;font-size:clamp(25px,3vw,34px)}.marine-hero p{margin:0;color:var(--muted)}.marine-hero .eyebrow{letter-spacing:.11em}
.marine-kpis{grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:20px}.marine-kpi{min-height:132px;background:linear-gradient(150deg,rgba(12,39,56,.92),rgba(7,24,37,.9));border-color:rgba(112,177,208,.13)}.marine-kpi strong{font-size:30px;letter-spacing:-.04em}.marine-kpi .kpi-foot{font-size:11px}.kpi-icon.coral{background:rgba(255,117,97,.13);color:#ff8c79}
.marine-dashboard-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(300px,1fr);gap:18px;margin-bottom:18px}.marine-dashboard-grid .panel,.marine-table-panel{min-width:0;background:linear-gradient(150deg,rgba(10,34,49,.94),rgba(7,25,38,.95));border-color:rgba(117,179,207,.13)}.marine-dashboard-grid .panel{min-height:280px}.marine-activity canvas{display:block;width:100%;height:190px;margin-top:10px}.marine-status-empty,.marine-map-empty,.marine-empty-chart{height:190px;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;gap:8px;color:var(--muted);padding:18px}.marine-status-empty>span,.marine-map-empty>span,.marine-empty-chart>span{font-size:27px;color:var(--cyan)}.marine-status-empty b,.marine-map-empty b,.marine-empty-chart b{color:var(--ink-secondary);font-size:13px}.marine-status-empty small,.marine-map-empty small,.marine-empty-chart small{max-width:310px;line-height:1.6;font-size:11px;color:var(--muted)}
.live-label{display:inline-flex;align-items:center;gap:7px;padding:6px 9px;border-radius:20px;background:rgba(67,176,42,.1);color:#9fe477;font-size:10px;font-weight:700}.live-label i{width:6px;height:6px;border-radius:50%;background:#75d456;box-shadow:0 0 9px #75d456}.marine-chart-legend{display:flex;gap:17px;flex-wrap:wrap;padding:3px 0 2px;font-size:10px;color:var(--muted)}.marine-chart-legend span{display:flex;align-items:center;gap:6px}.marine-chart-legend i{width:7px;height:7px;border-radius:50%}.marine-chart-legend .chart-blue{background:#3CB4FF}.marine-chart-legend .chart-lime{background:#A9F14E}.marine-chart-legend .chart-orange{background:#FF9F63}
.marine-map{height:245px;border-radius:12px;overflow:hidden;background:#071824}.marine-map .leaflet-tile-pane{filter:saturate(.65) hue-rotate(150deg) brightness(.78)}.marine-map .leaflet-popup-content-wrapper,.marine-map .leaflet-popup-tip{background:#0b2433;color:#e8f4fa}.marine-map .leaflet-popup-content{line-height:1.65}.marine-alert-list{display:flex;flex-direction:column}.marine-alert-row{display:grid;grid-template-columns:10px 1fr auto;gap:10px;align-items:start;padding:12px 2px;border-bottom:1px solid var(--line);color:inherit;text-decoration:none}.marine-alert-row:last-child{border:0}.marine-alert-row b,.marine-alert-row small{display:block}.marine-alert-row b{font-size:12px}.marine-alert-row small{font-size:11px;color:var(--muted);margin-top:3px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.marine-alert-row time{font-size:10px;color:var(--muted)}.severity-dot{width:8px;height:8px;border-radius:50%;margin-top:4px;background:#7da8bd}.severity-critical{background:#ff635d;box-shadow:0 0 9px rgba(255,99,93,.5)}.severity-high{background:#ff9f63}.severity-medium{background:#f4d36c}.severity-low{background:#3cb4ff}
.cage-state-bar{height:11px;display:flex;overflow:hidden;border-radius:99px;background:rgba(255,255,255,.05);margin:22px 0 19px}.cage-segment{height:100%;min-width:2px}.segment-clear{background:#43b02a}.segment-observation{background:#f4d36c}.segment-intervention{background:#ff795f}.segment-stale{background:#3cb4ff}.cage-state-legend{display:grid;grid-template-columns:1fr 1fr;gap:14px 12px}.cage-state-legend>div{display:grid;grid-template-columns:8px 1fr auto;gap:8px;align-items:center;font-size:10px;color:var(--muted)}.cage-state-legend i{width:8px;height:8px;border-radius:50%}.cage-state-legend b{font-size:12px;color:var(--ink-secondary)}
.marine-table-panel{margin-bottom:20px}.marine-state{display:inline-flex;align-items:center;white-space:nowrap;padding:4px 8px;border-radius:99px;background:rgba(60,180,255,.1);color:#8bd3ff;font-size:10px;font-weight:700}.state-completed,.state-closed,.state-resolved{background:rgba(67,176,42,.12);color:#a9e78d}.state-critical,.state-high,.state-intervention{background:rgba(255,113,95,.12);color:#ff9b8b}.state-cancelled,.state-out_of_service,.state-archived{background:rgba(132,155,179,.12);color:#a4b3c0}.state-in_progress{background:rgba(60,180,255,.16);color:#75caff}
.marine-welcome h1{font-family:Montserrat,Inter,sans-serif}.marine-record-panel{background:linear-gradient(150deg,rgba(10,34,49,.94),rgba(7,25,38,.95));border-color:rgba(117,179,207,.13)}.marine-record-panel .data-table{min-width:820px}.marine-disabled{max-width:620px;margin:7vh auto;padding:42px;text-align:center;background:radial-gradient(ellipse at 50% 0,rgba(14,165,233,.16),transparent 55%),#0a2232}.marine-disabled-icon{margin:25px auto 12px;width:66px;height:66px;display:grid;place-items:center;border:1px solid rgba(60,180,255,.3);border-radius:20px;color:var(--cyan);font-size:30px}.marine-disabled h1{margin:10px 0;font-size:27px}.marine-disabled p{color:var(--muted);line-height:1.65}.marine-disabled .button{margin-top:12px}.marine-pagination{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 0 0;font-size:11px;color:var(--muted)}.marine-pagination>div{display:flex;align-items:center;gap:12px}.marine-pagination .button{min-height:34px;padding:7px 12px;font-size:11px}.marine-pagination .button:disabled{opacity:.45;cursor:not-allowed}.marine-field-hint{display:block;margin-top:5px;color:var(--muted);font-size:10px}.marine-upload-form{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:16px}.marine-upload-form small{color:var(--muted);font-size:10px}
@media(max-width:900px){.marine-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.marine-dashboard-grid{grid-template-columns:1fr}.marine-dashboard-grid .panel{min-height:245px}}
@media(max-width:600px){.marine-hero{align-items:flex-start;flex-direction:column;padding:21px}.marine-hero .button{width:100%;justify-content:center}.marine-kpis{gap:10px}.marine-kpi{padding:14px;min-height:126px}.marine-kpi .kpi-top{font-size:10px}.marine-kpi strong{font-size:25px}.marine-dashboard-grid{gap:12px}.marine-dashboard-grid .panel{padding:15px}.marine-map{height:220px}.marine-disabled{padding:28px 20px;margin:20px auto}.module-switch{margin-inline:12px}.marine-dashboard-filters{align-items:stretch;flex-direction:column}.marine-dashboard-filters label{width:100%}.marine-dashboard-filters .button{width:100%;justify-content:center}.marine-pagination{align-items:flex-start;flex-direction:column}.marine-pagination>div{width:100%;justify-content:space-between}}
.marine-draft-dialog{width:min(860px,calc(100vw - 28px));max-height:88vh;overflow:auto}.marine-draft-dialog>p{line-height:1.6}.marine-draft-list{display:grid;gap:14px;margin-top:16px}.marine-draft-card{padding:18px;border:1px solid rgba(117,179,207,.17);border-radius:14px;background:#071d2a}.marine-draft-card header{display:flex;justify-content:space-between;gap:12px;align-items:center}.marine-draft-card header small,.marine-draft-card small{color:var(--muted);font-size:11px}.marine-draft-card pre{white-space:pre-wrap;overflow-wrap:anywhere;font:12px/1.65 Inter,sans-serif;color:var(--bone);padding:14px;background:rgba(2,12,20,.42);border-radius:10px}.marine-draft-card textarea{width:100%;min-height:220px;margin-top:8px;padding:12px;border-radius:10px;background:#06141f;border:1px solid #183b4d;color:var(--bone);font:12px/1.6 Inter,sans-serif}.marine-draft-actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:10px}.marine-draft-actions .button,.marine-draft-generate{min-height:36px;font-size:11px}.marine-settings-panel{max-width:900px}.marine-settings-panel .form-grid{padding:22px;gap:18px}.marine-settings-panel label small{display:block;margin-top:6px;color:var(--muted);font-size:11px}.marine-classification-explainer{padding:16px 18px;border:1px solid rgba(60,180,255,.2);border-radius:12px;background:rgba(7,29,42,.55);font-size:12px}.marine-classification-explainer ul{margin:10px 0 0;padding-left:18px;color:var(--muted);line-height:1.8}.operation-success{margin:0 22px 14px;padding:12px 15px;background:rgba(67,176,42,.12);border:1px solid rgba(169,241,78,.28);border-radius:12px;color:#c9f7a9;font-size:12.5px}@media(max-width:700px){.marine-draft-card header{align-items:flex-start;flex-direction:column}.marine-draft-actions .button{flex:1}}
