/* =========================================================
   SIMBIOPARK · Estilos globales
   ========================================================= */

:root {
  --bg-body: #f3f4f6;
  --bg-shell: radial-gradient(circle at 0 0, #e5edff 0, #f3f4f6 45%, #eef2ff 100%);
  --bg-panel: #ffffff;
  --border-subtle: #e5e7eb;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --primary-soft-strong: #dbeafe;
  --success: #16a34a;
  --danger: #ef4444;
  --text-main: #111827;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-pill: 8px;
  --shadow-soft: 0 18px 35px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 22px 45px rgba(15, 23, 42, 0.18);
}

/* ============ Reset básico ============ */

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

html,
body {
  margin: 0;
  padding: 0;
}

/* Tipografía global */
body, button, input, select, textarea {
    font-family: Arial, sans-serif !important;
}

/* Evitamos que los estilos internos de los HTML antiguos manden más que éstos
   (sin usar !important salvo que sea imprescindible).  */
body,
input,
select,
button,
textarea {
  font-family: inherit;
}

/* =========================================== */
/* ============ GENERAL & INICIO  ============ */
/* =========================================== */

.app-shell {
  min-height: 100vh;
  padding: 1.3rem 1.6rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-x: hidden;
}

.landing-main {
  flex: 1;
  max-width: 760px;
  margin: 1.5rem auto 0;
  width: 100%;
}

/* ── Landing sections ── */
.landing-section {
  margin-bottom: 1.75rem;
}

.landing-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.6rem 0.25rem;
}

.landing-cards-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

/* ── Landing card (lcard) ── */
.lcard {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #ffffff;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
  cursor: pointer;
}

.lcard:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  border-color: #d1d5db;
}

.lcard-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
}

.lcard-icon .material-icons {
  font-size: 22px;
  color: #fff;
}

.lcard-body {
  flex: 1;
  min-width: 0;
}

.lcard-title {
  font-size: 0.92rem;
  font-weight: 650;
  margin: 0 0 0.15rem;
  color: var(--text-main);
}

.lcard-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.35;
}

.lcard-arrow {
  font-size: 18px;
  color: #d1d5db;
  flex-shrink: 0;
  transition: color 0.2s, transform 0.2s;
}

.lcard:hover .lcard-arrow {
  color: var(--text-muted);
  transform: translateX(2px);
}

/* ── Color variants ── */
.lcard--blue .lcard-icon  { background: #2563eb; }
.lcard--green .lcard-icon { background: #16a34a; }
.lcard--amber .lcard-icon { background: #f59e0b; }
.lcard--slate .lcard-icon { background: #64748b; }

.lcard--blue:hover  { border-color: #93b4fd; }
.lcard--green:hover { border-color: #86efac; }
.lcard--amber:hover { border-color: #fcd34d; }
.lcard--slate:hover { border-color: #94a3b8; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .landing-cards-row {
    grid-template-columns: 1fr;
  }

  .lcard {
    padding: 0.85rem 1rem;
  }

  .lcard-icon {
    width: 38px;
    height: 38px;
  }

  .lcard-icon .material-icons {
    font-size: 20px;
  }
}

/* ================================= */
/* ============ TOPBAR  ============ */
/* ================================= */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.5rem;
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-bottom: 1px solid #e5e7eb;
  margin: -1.3rem -1.3rem 0;
  width: calc(100% + 2.6rem);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-pill {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 6px 15px rgba(34, 197, 94, 0.55);
}

.topbar-title {
  font-weight: 600;
  font-size: 0.98rem;
  color: #111827;
}

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

/* ── Topbar navigation ── */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-group {
  position: relative;
}

.nav-group-label {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  user-select: none;
}

.nav-group-label:hover,
.nav-group:hover .nav-group-label {
  background: #f3f4f6;
  color: #111827;
}

.nav-group-label .material-icons {
  font-size: 18px;
  color: #9ca3af;
  transition: transform 0.2s;
}

.nav-group-chevron {
  font-size: 18px;
  color: #9ca3af;
  transition: transform 0.2s;
}

.nav-group:hover .nav-group-chevron {
  transform: rotate(180deg);
}

/* Dropdown panel — hidden by default, shown on hover */
.nav-group-links {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  padding: 0.4rem 0;
  z-index: 100;
  flex-direction: column;
}

.nav-group:hover .nav-group-links {
  display: flex;
}

.nav-link {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: #f3f4f6;
  color: #111827;
}

.nav-link--active {
  background: #eef2ff;
  color: #2563eb;
  font-weight: 600;
}

/* User area (right side of topbar) */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* ============================================
   CITY SELECT — Pantalla completa al login
============================================ */
.city-select-overlay {
  position: fixed;
  inset: 0;
  background: #f1f5f9;
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.city-select-panel {
  text-align: center;
  max-width: 420px;
  width: 100%;
  padding: 2rem 1.5rem;
}
.city-select-logo {
  height: 40px;
  margin-bottom: 1.5rem;
  opacity: 0.85;
}
.city-select-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.4rem;
}
.city-select-subtitle {
  font-size: 0.95rem;
  color: #6b7280;
  margin: 0 0 1.5rem;
}
.city-select-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.city-select-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: left;
  font-family: inherit;
  font-size: 1rem;
}
.city-select-card:hover {
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(37,99,235,0.12);
}
.city-select-card-icon {
  font-size: 28px;
  color: #2563eb;
  flex-shrink: 0;
}
.city-select-card-name {
  flex: 1;
  font-weight: 600;
  color: #111827;
}
.city-select-card-arrow {
  font-size: 20px;
  color: #9ca3af;
  transition: color 0.15s;
}
.city-select-card:hover .city-select-card-arrow {
  color: #2563eb;
}
.city-select-card--admin {
  text-decoration: none;
}
.city-select-card--admin:hover .city-select-card-arrow {
  color: #6b7280;
}
.city-select-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.25rem 0;
}

/* Admin / back links in topbar */
.nav-link--admin,
.nav-link--back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.nav-link--admin {
  color: #6b7280;
  background: #f3f4f6;
}
.nav-link--admin:hover {
  color: #111827;
  background: #e5e7eb;
}
.nav-link--back {
  color: #2563eb;
  background: #eff6ff;
}
.nav-link--back:hover {
  background: #dbeafe;
}

/* City selector in topbar */
.topbar-city {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  margin-right: 0.5rem;
}
.city-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #1e40af;
  cursor: pointer;
  white-space: nowrap;
}
.city-chip:hover { background: #bfdbfe; }
.city-chevron { transition: transform 0.2s; }
.city-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 160px;
  z-index: 100;
  overflow: hidden;
}
.city-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  text-align: left;
  background: none;
  border: none;
  font-size: 0.85rem;
  color: #374151;
  cursor: pointer;
}
.city-dropdown-item:hover { background: #f3f4f6; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}
.user-chip-icon {
  font-size: 18px;
  color: #9ca3af;
}
.user-chip-role {
  font-size: 0.7rem;
  color: #9ca3af;
  background: #e5e7eb;
  border-radius: 4px;
  padding: 1px 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f3f4f6;
  border: none;
  cursor: pointer;
  color: #374151;
  transition: background 0.15s;
}
.icon-btn:hover {
  background: #e5e7eb;
}

/* Hamburger: oculto en desktop */
.topbar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #374151;
  margin-left: auto;
}

.add-keyword-btn {
    padding: 0.55rem 1.4rem;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
}

.logo-img img {
    height: 80px;
    width: auto;
    display: block;
}

.login-logo img {
    width: 200px;   /* ajústalo según tu diseño */
    height: auto;
    display: block;
    margin: 0 auto 20px auto;
}

/* ================================= */
/* ============ BOTONES ============ */
/* ================================= */
button,
.btn-primary,
.btn-secondary,
.btn-terciary {
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  border-radius: var(--radius-pill);
  padding: 0.45rem 0.95rem;
  font-weight: 500;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-secondary:hover {
  background: #d4d4d8;
}

.btn-terciary {
  background: #e5e7eb;
  color: #ffa420;
}

.btn-terciary:hover {
  background: #d4d4d8;
}
.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-main {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.4rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    border: none;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.18s ease-out;
}

/* Azul (empresas) – mismo estilo que caracterización */
.btn-primary-main {
    background: #2563eb;
    color: white;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.btn-primary-main:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* Verde (caracterización) */
.btn-accent-main {
    background: #22c55e;
    color: white;
    box-shadow: 0 10px 22px rgba(34, 197, 94, 0.25);
}

.btn-accent-main:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

/* Naranja (estadísticas) */
.btn-dash-main {
    background: #faaf62;
    color: white;
    box-shadow: 0 10px 22px rgba(34, 197, 94, 0.25);
}

.btn-dash-main:hover {
    background: #f4972e;
    transform: translateY(-1px);
}

/* Gris (inicio / navegación secundaria) */
.btn-secondary-main {
    background: #e5e7eb;
    color: #374151;
    box-shadow: none;
    text-decoration: none !important;
}

.btn-secondary-main:hover {
    background: #d1d5db;
    transform: translateY(-1px);
}

.btn-small {
    padding: 6px 18px !important;
    font-size: 0.85rem !important;
    border-radius: 10px !important;
}

/* ================================= */
/* ============ PANELES ============ */
/* ================================= */
.main-layout {
  flex: 1;
  margin-top: 0.4rem;
  max-width: 100%;
  overflow-x: hidden;
}

/* Panel “tarjeta blanca” */
.panel {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.2rem 1.4rem 1.2rem;
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: #4b5563;
}

/* Sección “Empresas” / “Caracterización” a pantalla casi completa */
.empresas-wrapper,
.carac-table-wrapper {
  margin-top: 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #f9fafb;
  overflow: clip;
}

.empresas-scroll,
.carac-table-scroll {
  max-height: 62vh;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Fila de filtros arriba de las tablas */
/* ── Filter card (collapsible on mobile) ── */
.filter-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 1rem;
  overflow: hidden;
}

.filter-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: inherit;
}

.filter-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.filter-card-chevron {
  font-size: 22px;
  color: #9ca3af;
  transition: transform 0.25s ease;
}

.filter-card.collapsed .filter-card-chevron {
  transform: rotate(-90deg);
}

.filter-card-body {
  padding: 0 20px 20px;
}

.filter-card.collapsed .filter-card-body {
  display: none;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.filter-row .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.filter-row .form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-row .form-group input,
.filter-row .form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  color: #111827;
  font-size: 15px;
  line-height: 1.3;
  box-sizing: border-box;
}

.filter-row .form-group.toggle-group {
  justify-content: flex-start;
}



/* Para empresas + caracterización */
.section-heading {
  margin-top: 1.2rem;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2937;
}

/* ================================= */
/* ============ FORMS   ============ */
/* ================================= */

textarea {
  border-radius: 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

/* Buscador ancho en index / empresas / caracterización */
.search-input {
  width: 100%;
}

/* ================================= */
/* ============ TABLAS ============ */
/* ================================= */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: #ffffff;
}

th,
td {
  padding: 0.55rem 0.75rem;
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f9fafb;
  color: #4b5563;
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}

tbody tr {
  border-bottom: 1px solid #f1f5f9;
}

tbody tr:hover {
  background: #f9fafb;
}

tbody tr.selected {
  background: #eff6ff;
}

td {
  color: #111827;
}

/* chips / pills para parques, niveles, etc. */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 500;
  background: var(--primary-soft);
  color: #1d4ed8;
}

/* ================================= */
/* ============ DRAWER  ============ */
/* ================================= */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: none;
  justify-content: flex-end;
  z-index: 40;
}

.drawer-backdrop.open {
  display: flex;
}

/* PANEL — diseño alineado con cards del landing (border-radius, sombra suave) */
.drawer-panel {
  width: min(480px, 100%);
  background: #ffffff;
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.1);
  border-radius: 16px 0 0 16px;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

/* HEADER — limpio, sin borde pesado */
.drawer-header {
  flex-shrink: 0;
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* BODY — scroll interno */
.drawer-body {
  flex: 1;
  padding: 1rem 1.5rem 1rem;
  overflow-y: auto;
}

/* FOOTER — bordes sutiles, más espacio */
.drawer-footer {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(229, 231, 235, 0.5);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.drawer-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

/* Resource detail — vista (en keyword card de empresa) */
.resource-summary {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f0f9ff;
    border-radius: 8px;
    font-size: 0.8rem;
}
.resource-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    color: #374151;
}
.resource-summary-name { font-weight: 500; }
.resource-summary-detail { color: #6b7280; }

/* Resource detail — edición (en drawer empresa) */
.resource-edit-section {
    margin-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 0.5rem;
}
.resource-edit-row {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) 1fr 1fr 1fr;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
}
.resource-edit-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.resource-edit-direction {
    font-size: 0.68rem;
    color: #9ca3af;
    text-transform: uppercase;
}
.resource-edit-row input,
.resource-edit-row select {
    padding: 5px 8px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
}
.resource-edit-row input:focus,
.resource-edit-row select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

@media (max-width: 480px) {
    .resource-edit-row {
        grid-template-columns: 1fr 1fr;
    }
    .resource-edit-label {
        grid-column: 1 / -1;
    }
}

/* Catalog table readonly (click to open drawer) */
.cat-table-readonly tbody tr {
    cursor: pointer;
}
.cat-table-readonly tbody tr:hover {
    background: #eff6ff;
}
.tipo-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}
.tipo-chip--materiales { background: #dbeafe; color: #1e40af; }
.tipo-chip--agua { background: #d1fae5; color: #065f46; }
.tipo-chip--energia { background: #fef3c7; color: #92400e; }

.drawer-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.drawer-field-block {
  margin-bottom: 0.9rem;
}

.drawer-field-block label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #374151;
}

.drawer-field-block select,
.drawer-field-block input,
.drawer-field-block textarea {
  width: 100%;
}

.drawer-content {
    height: 100%;
    overflow-y: auto;
    padding: 24px 26px;
}

.drawer-close {
    background: none !important;
    border: none !important;
    font-size: 1.4rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity .2s;
}
.drawer-close:hover {
    opacity: 0.9;
}


/* Info block — alineado con .filter-card / .keyword-card */
.drawer-info-block {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}

.drawer-info-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.drawer-info-value {
    margin-top: 2px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Sección detalle de empresa */
.detalle-empresa {
  font-size: 0.88rem;
  line-height: 1.4;
}

.detalle-empresa strong {
  font-weight: 600;
}

/* =================================== */
/* ============ KEYWORDS  ============ */
/* =================================== */

.keyword-card {
  margin-top: 0.4rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 0.8rem;
  color: #111827;
}

.keyword-card + .keyword-card {
  margin-top: 0.55rem;
}

.keyword-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.keyword-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.7rem;
  background: #e0f2fe;
  color: #0369a1;
}

.keyword-io {
  margin-top: 0.15rem;
  color: #4b5563;
}

.section-title {
    margin-top: 10px;
    margin-bottom: 8px;
    font-size: 1.15rem;
    font-weight: 700;
}

.kw-block {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.kw-chip {
    background: #dce9ff;
    padding: 4px 10px;
    border-radius: 50px;
    font-weight: 600;
    font-size: .85rem;
    display: inline-block;
    margin-bottom: 8px;
}

.kw-details {
    font-size: .88rem;
    color: #475569;
    line-height: 1.25rem;
}


/* ============ Layout específico caracterización ============ */

.carac-filters-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.carac-filters-row > div label {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 0.15rem;
  color: var(--text-muted);
}

.carac-filters-row input,
.carac-filters-row select {
  width: 100%;
}



/* =================================== */
/* ============ UTILS     ============ */
/* =================================== */


.text-muted {
  color: var(--text-muted);
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
  background: #e5e7eb;
  font-size: 0.72rem;
  color: #374151;
}

/* Scroll horizontal para tablas anchas */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Ocultar elementos secundarios en móvil */
@media (max-width: 600px) {
  .hide-on-mobile { display: none !important; }
}

/* Utility spacing classes (reemplazan inline styles) */
.mt-section { margin-top: 30px; }
.mt-sm { margin-top: 1rem; }

/* ============================================================
   SCROLL TO TOP BUTTON
============================================================ */
.scroll-top-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: var(--primary, #2563eb);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.scroll-top-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}
.scroll-top-btn .material-icons {
  font-size: 24px;
}

/* ============================================================
   DETAIL PAGE LAYOUT
============================================================ */

.detail-page { max-width: 1100px; margin: 0 auto; padding: 1rem 1.5rem; }

/* Contenedor de páginas de detalle/edición (admin y gestión) — centrado y con ancho máximo
   para que los formularios no se extiendan en pantallas grandes. */
#detalle-container { max-width: 1100px; margin: 0 auto; padding: 1rem 1.5rem; }

/* Card estrecha para formularios de un solo campo (ciudades, tamaños, ítems de catálogo).
   Se centra dentro del contenedor para que el formulario quede en medio de la pantalla. */
.detail-card-narrow { max-width: 520px; margin-left: auto; margin-right: auto; }

.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; gap: 1rem; }
.detail-header-left { flex: 1; min-width: 0; }

.detail-back { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--primary); font-weight: 500; font-size: 0.88rem; text-decoration: none; cursor: pointer; }
.detail-back:hover { text-decoration: underline; }
.detail-back.disabled { display: none; }

.detail-title { font-size: 1.4rem; font-weight: 700; color: var(--text-main); margin: 0.4rem 0 0; }
.detail-subtitle { font-size: 0.88rem; color: var(--text-muted); margin: 0.15rem 0 0; }
.detail-actions { display: flex; gap: 0.6rem; align-items: flex-start; padding-top: 0.5rem; flex-shrink: 0; }

.detail-badge-editing { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.4rem; padding: 0.15rem 0.6rem; border-radius: 6px; background: #fef3c7; color: #92400e; font-size: 0.78rem; font-weight: 600; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }

.detail-card { background: #f9fafb; border: 0.5px solid #e5e7eb; border-radius: 12px; padding: 1.15rem; }
.detail-card-white { background: #ffffff; border: 0.5px solid #e5e7eb; border-radius: 12px; padding: 1rem 1.15rem; margin-bottom: 0.75rem; }

.detail-section-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-bottom: 0.75rem; }

.detail-field { margin-bottom: 0.75rem; }
.detail-field:last-child { margin-bottom: 0; }
.detail-field-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-soft); }
.detail-field-value { font-size: 0.95rem; font-weight: 600; color: var(--text-main); margin-top: 2px; }
.detail-field input, .detail-field select, .detail-field textarea { width: 100%; margin-top: 4px; }

.detail-separator { border: none; border-top: 0.5px solid #e5e7eb; margin: 0.75rem 0; }

.detail-interest-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.detail-interest-dot--yes { background: var(--success); }
.detail-interest-dot--no { background: #d1d5db; }

.detail-resource-summary { margin-top: 0.5rem; padding: 0.5rem 0.75rem; background: #f9fafb; border-radius: 8px; font-size: 0.8rem; }
.detail-resource-row { display: flex; justify-content: space-between; padding: 0.2rem 0; color: var(--text-main); }
.detail-resource-name { font-weight: 500; }
.detail-resource-detail { color: var(--text-muted); }

.detail-resource-edit-row { display: grid; grid-template-columns: 1fr 80px 80px; gap: 0.4rem; align-items: center; margin-bottom: 0.4rem; font-size: 0.82rem; }
.detail-resource-edit-row input, .detail-resource-edit-row select { padding: 5px 8px; font-size: 0.8rem; border-radius: 6px; border: 1px solid #cbd5e1; }

.detail-add-placeholder { border: 1.5px dashed #d1d5db; border-radius: 12px; padding: 0.85rem; text-align: center; cursor: pointer; color: var(--text-muted); font-size: 0.85rem; transition: border-color 0.2s, color 0.2s; }
.detail-add-placeholder:hover { border-color: var(--primary); color: var(--primary); }

.detail-add-card { background: #f9fafb; border: 0.5px solid #e5e7eb; border-radius: 12px; padding: 1rem 1.15rem; margin-top: 0.75rem; }

.detail-io-in { color: var(--success); font-size: 0.78rem; font-weight: 600; }
.detail-io-out { color: var(--primary); font-size: 0.78rem; font-weight: 600; }

.detail-kw-badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.55rem; border-radius: 6px; font-size: 0.7rem; font-weight: 500; background: var(--primary-soft); color: #1d4ed8; }

.detail-coords-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

/* ============================================================
   RESPONSIVE
============================================================ */

/* Detail page responsive */
@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
    .detail-header { flex-direction: column; gap: 0.75rem; }
    .detail-actions { width: 100%; padding-top: 0; }
    .detail-page,
    #detalle-container { padding: 0.75rem 1rem; }
    .detail-title { font-size: 1.2rem; }
    .detail-card-narrow { max-width: 100%; }
}
@media (max-width: 480px) {
    .detail-resource-edit-row { grid-template-columns: 1fr 1fr; }
    .detail-resource-edit-row span:first-child { grid-column: 1 / -1; }
}

/* --- Tablet & mobile (≤768px) --- */
@media (max-width: 768px) {
  .app-shell {
    padding: 1rem;
  }

  /* Topbar: hamburger + menú vertical */
  .topbar {
    flex-wrap: wrap;
    padding: 0.6rem 1rem;
    margin: -1rem -1rem 0;
    width: calc(100% + 2rem);
  }
  .topbar-hamburger {
    display: flex;
  }
  .topbar-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 0.5rem;
  }
  .topbar-nav--open {
    display: flex;
  }
  .nav-group {
    border-bottom: 1px solid #f3f4f6;
    padding: 0.35rem 0;
  }
  .nav-group-label {
    padding: 0.35rem 0.5rem;
    font-size: 0.72rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    cursor: default;
  }
  .nav-group-label:hover,
  .nav-group:hover .nav-group-label {
    background: none;
  }
  .nav-group-chevron {
    display: none;
  }
  .nav-group-links {
    display: flex;
    position: static;
    flex-direction: column;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    min-width: 0;
  }
  .nav-link {
    padding: 0.5rem 0.75rem 0.5rem 1.25rem;
    font-size: 0.9rem;
    border-radius: 8px;
  }
  .nav-link--admin,
  .nav-link--back {
    margin-left: 0;
  }
  /* City chip: dentro del menú hamburger en móvil */
  .topbar-city {
    display: none;
    width: 100%;
    justify-content: center;
    padding: 0.5rem 0;
    margin-left: 0;
    border-top: 1px solid #f3f4f6;
  }
  .topbar-city--open {
    display: flex;
  }

  .topbar-user {
    display: none;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0 0.25rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 0.25rem;
  }
  .topbar-user--open {
    display: flex;
  }
  .logo-img img {
    height: 48px;
  }

  .panel {
    padding: 1rem 1.05rem;
  }

  /* Filter card: colapsada por defecto en móvil (CSS-first, evita FOUC) */
  .filter-card .filter-card-body {
    display: none;
  }
  .filter-card .filter-card-chevron {
    transform: rotate(-90deg);
  }
  .filter-card.expanded .filter-card-body {
    display: block;
  }
  .filter-card.expanded .filter-card-chevron {
    transform: rotate(0deg);
  }

  .filter-row {
    grid-template-columns: 1fr 1fr;
  }
  .filter-row .form-group,
  .filter-row .form-group label {
    text-align: left;
  }

  .carac-filters-row {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Drawer: full-width en móvil, dvh para evitar barra URL */
  .drawer-panel {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  /* Landing cards */
  .lcard {
    padding: 0.85rem 1rem;
  }

  /* Utility spacing reduced */
  .mt-section { margin-top: 18px; }

  /* Scroll-to-top: más pegado en mobile */
  .scroll-top-btn {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }

  /* Paginación: compacta en una fila */
  .pagination-wrapper {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
  }
  .pagination-left select {
    width: 52px;
    padding: 2px 4px;
  }

  /* Tablas generales */
  table {
    font-size: 0.78rem;
  }
  th, td {
    padding: 0.4rem 0.5rem;
  }

  /* Tablas: min-width para scroll horizontal legible */
  .empresas-scroll table {
    min-width: 540px;
  }

  /* Touch targets mínimos (44px) */
  button, .btn-primary, .btn-secondary, .btn-danger,
  .nav-link, select {
    min-height: 44px;
  }
  .icon-btn {
    width: 44px;
    height: 44px;
  }
}

/* --- Mobile pequeño (≤480px) --- */
@media (max-width: 480px) {
  .topbar {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    margin: -1rem -0.75rem 0;
    width: calc(100% + 1.5rem);
  }
  .topbar-title {
    font-size: 0.88rem;
  }
  .logo-img img {
    height: 36px;
  }

  /* Tablas más compactas */
  table {
    font-size: 0.72rem;
  }
  th, td {
    padding: 0.3rem 0.4rem;
  }

  /* Paginación compacta */
  .pagination-wrapper {
    font-size: 0.72rem;
  }
  .pagination-left select {
    width: 48px;
    padding: 2px 3px;
  }
  .pagination-right button {
    padding: 3px 7px !important;
    font-size: 0.72rem;
    min-height: 36px;
    min-width: 36px;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  /* Botones de acción: vertical y full-width */
  .table-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  .table-actions button,
  .table-actions .btn-primary,
  .table-actions .btn-secondary {
    width: 100%;
  }
}

/* Espacio extra bajo el subtítulo de sección */
.section-subtitle {
    margin-bottom: 1.2rem !important;
}

/


/* ----- Añadir palabra clave ----- */

.drawer-label {
    display: block;
    margin-top: 14px;
    margin-bottom: 4px;
    font-size: .9rem;
    font-weight: 600;
}

.drawer-btn {
    width: 100%;
    padding: 12px;
    margin-top: 14px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
}

.drawer-btn.blue {
    background: #2563eb;
    color: #fff;
}

.drawer-btn.close {
    background: #e2e8f0;
    color: #1e293b;
}

.drawer-separator {
    margin-top: 24px;
    margin-bottom: 16px;
    border: 0;
    height: 1px;
    background: #e2e8f0;
}

/* ============================================================
   FIX DEFINITIVO SELECTS — iOS, Safari, Chrome, Windows
   Corrige:
   - Fondo gris en opciones
   - Texto blanco tras seleccionar
   - Listas invisibles en el drawer
   ============================================================ */

/* ============================================================
   SELECTS — FIX DEFINITIVO COMPATIBLE iOS / SAFARI / CHROME
   ============================================================ */
select,
.drawer-select,
.drawer-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    font-size: 15px;
    line-height: 1.3;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

select option,
.drawer-select option,
.drawer-select option {
    background: #ffffff !important;
    color: #111827 !important;
}

/* FOCUS */
select:focus,
.drawer-select:focus,
.drawer-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* iOS safari menú interno */
@supports (-webkit-touch-callout: none) {
  select,
  .drawer-select {
      appearance: auto !important;
      -webkit-appearance: menulist !important;
  }
}
select option[value=""],
.drawer-select option[value=""] {
    color: #6b7280 !important;
}

select:invalid,
.drawer-select:invalid {
    color: #111 !important;
}

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

.kw-delete-btn {
    background: #fee2e2;
    border: none;
    color: #b91c1c;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
}

.kw-delete-btn:hover {
    background: #fecaca;
}

@media screen and (-webkit-min-device-pixel-ratio:0) {
  select {
    background-color: #ffffff !important;
    color: #111827 !important;
  }
  select option {
    background-color: #ffffff !important;
    color: #111827 !important;
  }
}

/* ============================
   INPUT BUSCAR — IGUAL QUE SELECT
============================ */
#filterSearch {
    width: 100%;
    height: 38px;
    padding: 6px 12px;
    border: 1px solid #d0d4dd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}

#filterSearch:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
}

/* ===== Cabecera extra empresa ===== */
.drawer-header-extra {
    padding: 0.8rem 1.2rem 0.2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.empresa-title-main {
    font-size: 1.35rem;
    font-weight: 700;
    color: #111827;
}

.empresa-title-sub {
    margin-top: 2px;
    font-size: .88rem;
    color: var(--text-muted);
}

/* ===== Divisor centrado ===== */
.drawer-section-divider {
    text-align: center;
    margin: 1.6rem 0 1rem;
    position: relative;
    font-size: 1.05rem;
    font-weight: 700;
}

.drawer-section-divider span {
    background: #fff;
    padding: 0 10px;
    position: relative;
    z-index: 2;
}

.drawer-section-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    height: 1px;
    width: 100%;
    background: #e2e8f0;
    z-index: 1;
}

/* ===== Subtítulos "Por etiqueta", "Por niveles" ===== */
.subsection-title {
    margin-top: 10px;
    margin-bottom: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
}

/* ===== Botones pequeños centrados ===== */
.drawer-actions-center {
    text-align: center;
    margin-top: 12px;
}

.pagination-wrapper {
    margin-top: 10px;
    padding: 8px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #374151;
}

.pagination-left select {
    padding: 4px 6px;
    border-radius: 6px;
}

.pagination-right button {
    margin-left: 4px;
    padding: 4px 10px !important;
}

#filtroNombre {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    font-size: 15px;
    line-height: 1.3;
    transition: border-color .2s, box-shadow .2s;
}

#filtroNombre:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

/* ============================================
   TOGGLE SWITCH · SIMBIOPARK STYLE
============================================ */

.toggle-group {
    display: flex;
    align-items: flex-end;
    padding-top: 12px; /* alineación con selects y inputs */
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
}

.toggle-input {
    display: none;
}

/* Slider */
.toggle-slider {
    width: 42px;
    height: 22px;
    background: #d1d5db;
    border-radius: 999px;
    position: relative;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: white;
    top: 2px;
    left: 2px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.toggle-input:checked + .toggle-slider {
    background: #2563eb;
}

.toggle-input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ============================================
   CATÁLOGOS – ESTILO UNIFICADO
============================================ */

/* Contenedor superior de cada catálogo */
.catalog-block {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 680px; /* mejor proporción que 480px */
    margin: 0 auto 1rem auto; /* centrado y separación inferior */
}

/* Input de creación / búsqueda */
.catalog-block .drawer-input {
    flex: 1 1 auto;
    height: 42px;
    font-size: 15px;
    padding: 0 0.75rem;
    border: 1px solid #d0d4dd;
    border-radius: 10px;
    outline: none;
    transition: border 0.2s ease;
}

.catalog-block .drawer-input:focus {
    border-color: #2d6bff;
}

/* Botones de añadir y buscar */
.catalog-block .btn-primary,
.catalog-block .btn-secondary {
    height: 42px;
    padding: 0 1.2rem;
    font-size: 15px;
    border-radius: 10px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Título centrado */
.catalog-panel .panel-title {
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
}

/* Separador superior de cada tabla */
.catalog-separator {
    border: 0;
    border-top: 1px solid #e5e7eb;
    margin: 1.25rem auto 1rem auto;
    width: 100%;
    max-width: 780px;
}

/* Tabla */
.cat-table {
    width: 100%;
    max-width: 780px;
    margin: 0 auto 2rem auto;
    border-collapse: collapse;
}

.cat-table thead th {
    text-align: left;
    background: #f4f6fa;
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    font-weight: 600;
}

.cat-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid #f0f1f5;
}

/* Inputs dentro de la tabla */
.cat-table input.drawer-input {
    width: 100%;
    height: 36px;
    font-size: 14px;
    padding: 0 0.6rem;
    border-radius: 8px;
}

/* Botón eliminar dentro de tabla */
.cat-table button {
    height: 34px;
    padding: 0 1rem;
    border-radius: 8px;
}

/* Tabs principales y subtabs */
.catalog-tabs,
.catalog-subtabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.catalog-tab,
.catalog-subtab {
    flex-shrink: 0;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    background: #eee;
    cursor: pointer;
    border: none;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.catalog-tab.active,
.catalog-subtab.active {
    background: #2d6bff;
    color: white;
}

.force-repaint {
    visibility: hidden !important;
}

/* ICONOS DE ORDENACIÓN EN TABLAS */

th.sort-asc::after {
  content: " ▲";
  font-size: 12px;
  opacity: 0.6;
}

th.sort-desc::after {
  content: " ▼";
  font-size: 12px;
  opacity: 0.6;
}

th {
  cursor: pointer;
}

/* =============================
   PARK FILTER – SELECT + CHIPS
   ============================= */

.park-filter-wrapper {
    margin-top: 10px;
}

/* Tom Select overrides */
.park-filter-wrapper .ts-wrapper {
    border-radius: var(--radius-md, 10px);
    font-size: 14px;
}
.park-filter-wrapper .ts-wrapper .ts-control {
    border: 1px solid #d4d8e2;
    border-radius: var(--radius-md, 10px);
    padding: 6px 10px;
    min-height: 44px;
}
.park-filter-wrapper .ts-wrapper .ts-control .item {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3743ab;
    border-radius: 20px;
    padding: 3px 8px;
    font-size: 13px;
    font-weight: 600;
}
.park-filter-wrapper .ts-wrapper .ts-control .item .remove {
    border-left: 1px solid #c7d2fe;
    color: #3743ab;
}
.park-filter-wrapper .ts-wrapper .ts-control .item .remove:hover {
    color: #1e2aa3;
    background: transparent;
}
.park-filter-wrapper .ts-dropdown {
    border-radius: var(--radius-md, 10px);
    border: 1px solid #d4d8e2;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}
.park-filter-wrapper .ts-dropdown .option {
    padding: 8px 12px;
    font-size: 14px;
}
.park-filter-wrapper .ts-dropdown .option.active {
    background: #eef2ff;
    color: #3743ab;
}

/* Botones Seleccionar/Quitar todos */
.park-filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.btn-filter-action {
    background: none;
    border: 1px solid #d4d8e2;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 13px;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-filter-action:hover {
    background: #f3f4f6;
    color: var(--text-main, #111827);
}

.panel-title-centered {
    text-align: center;
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    font-weight: 600;
    margin-bottom: 20px;
}

/* Acciones asociadas a la tabla (parte superior derecha) */
.table-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
    /* La barra (y su desplegable "Exportar GIS") debe quedar por encima del
       mapa. Elevarla a nivel de hermano del mapa supera los panes/controles de
       Leaflet (z-index hasta ~1000), evitando que el menú quede tapado. */
    position: relative;
    z-index: 1100;
}

/* Botón Tabla/Mapa: icono + texto siempre en una sola línea y ancho estable
   para que no cambie de tamaño al alternar el rótulo. */
#btnToggleMapa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    min-width: 112px;
}
#btnToggleMapa .material-icons {
    font-size: 18px;
}

.export-btn {
    padding: 6px 12px;
    white-space: nowrap;
}

.actions-col {
    text-align: center;
    width: 40px;
}
.action-delete {
    cursor: pointer;
    color: #c62828;
    font-size: 20px;
}
.action-delete:hover {
    color: #ff5252;
}

/* ============================================
   TOAST NOTIFICATIONS
============================================ */

.toast-container {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 2rem);
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.5rem;
    border-radius: var(--radius-md);
    background: #1e293b;
    color: #fff;
    font-size: 0.98rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: min(480px, calc(100vw - 2rem));
}

.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.toast-success {
    background: #065f46;
}

.toast-error {
    background: #991b1b;
}

.toast-info {
    background: #1e40af;
}

/* ============================================
   LOADING OVERLAY
============================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ============================================
   EMPTY STATE EN TABLAS
============================================ */

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem !important;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* ============================================
   MAPAS CON LEAFLET
============================================ */

.mapa-wrapper {
    height: 480px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    margin-top: 1rem;
    background: #f3f4f6;
}

.mapa-wrapper > div {
    height: 100%;
    width: 100%;
}

.mapa-simbiosis-section {
    margin-top: 1rem;
    padding: 1.5rem;
    background: var(--bg-panel);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.mapa-simbiosis-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: var(--text-main);
}

@media (max-width: 768px) {
    .mapa-wrapper {
        height: 300px;
    }
}

/* ============================================
   Menú de exportación GIS (dropdown <details>)
   ============================================ */
.export-gis {
    position: relative;
    display: inline-block;
}
.export-gis > summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    white-space: nowrap;
    list-style: none;
}
.export-gis > summary::-webkit-details-marker { display: none; }
.export-gis > summary::marker { content: ""; }
.export-gis .export-gis-caret {
    font-size: 18px;
    transition: transform 0.15s;
}
.export-gis[open] > summary .export-gis-caret {
    transform: rotate(180deg);
}
.export-gis-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 260px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md, 10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 0.4rem 0;
    /* Por encima de los panes y controles de Leaflet (z-index hasta ~1000),
       que si no tapan el desplegable cuando la vista está en modo mapa. */
    z-index: 1100;
}
.export-gis-section {
    padding: 0.35rem 0.9rem 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #6b7280);
}
.export-gis-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-main, #374151);
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}
.export-gis-item .material-icons { font-size: 18px; color: var(--text-muted, #6b7280); }
.export-gis-item:hover {
    background: #f3f4f6;
    color: var(--text-main, #111827);
}

@media (max-width: 768px) {
    .export-gis { width: 100%; }
    .export-gis > summary { width: 100%; justify-content: center; }
    .export-gis-menu {
        position: static;
        width: 100%;
        min-width: 0;
        box-shadow: none;
        margin-top: 0.4rem;
    }
}