/* ═══════════════════════════════════════════════════════════════════════════
   IUSLEAD — Visual Refinement Layer (component overrides; tokens en tokens.css)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Atmósfera global ──────────────────────────────────────────────────── */
body {
  font-size: var(--text-base);
  line-height: 1.55;
  letter-spacing: -0.011em;
}

body::before {
  background:
    radial-gradient(ellipse 80% 55% at 12% -8%, rgba(15, 39, 68, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 88% 105%, rgba(201, 160, 85, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(112, 148, 240, 0.025) 0%, transparent 70%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

#content {
  z-index: 1;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* ── Topbar — barra institucional ──────────────────────────────────────── */
#topbar {
  background: linear-gradient(180deg, rgba(15, 22, 34, 0.97) 0%, rgba(9, 11, 16, 0.94) 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(201, 160, 85, 0.08), 0 8px 32px rgba(0, 0, 0, 0.28);
}

.topbar-brand img {
  border-radius: 10px;
  padding: 5px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.topbar-brand-name {
  letter-spacing: 0.06em;
  font-weight: 700;
}

.status-pill {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-widget);
  font-weight: 500;
}

.topbar-search {
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-input);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.topbar-search:focus-within {
  border-color: var(--border-gold);
  box-shadow: 0 0 0 3px var(--brand-gold-d);
}

.topbar-search input {
  font-size: var(--text-sm);
}

.topbar-btn {
  border-radius: var(--r-sm);
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.12s var(--ease);
}

.topbar-btn:hover {
  background: var(--bg-surface-h);
  color: var(--text);
}

.topbar-user-chip {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-widget);
}

/* ── Dock — precisión táctil visual ────────────────────────────────────── */
#dock {
  background: rgba(12, 14, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: var(--sh-lg), 0 0 0 0.5px rgba(201, 160, 85, 0.06);
}

.dock-item.active .dock-indicator {
  background: var(--brand-gold);
  box-shadow: 0 0 8px rgba(201, 160, 85, 0.55);
}

/* ── Encabezados de módulo unificados ──────────────────────────────────── */
.section-header,
.db-top {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.section-header::before,
.db-top::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 48px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-gold), transparent);
}

.section-title,
.db-top .section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.2;
  color: var(--text);
}

.section-desc,
.db-top .section-desc {
  font-size: var(--text-sm);
  color: var(--text-sec);
  margin-top: 4px;
  line-height: 1.5;
  max-width: 52ch;
}

/* ── KPIs — métricas ejecutivas ────────────────────────────────────────── */
.kpi-grid {
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.kpi {
  background: linear-gradient(165deg, rgba(26, 30, 40, 0.95) 0%, var(--bg-card) 55%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px 16px;
  box-shadow: var(--sh-kpi);
}

.kpi::before {
  height: 3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  opacity: 0.95;
}

.kpi.gold::before,
.kpi.orange::before {
  background: linear-gradient(90deg, var(--brand-gold), var(--brand-gold-l));
}

.kpi-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-sec);
  margin-bottom: 8px;
}

.kpi-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: var(--text-xs);
  margin-top: 6px;
}

/* ── Status widgets dashboard ──────────────────────────────────────────── */
.status-grid {
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.status-widget {
  padding: 10px 16px;
  border-radius: var(--r);
  font-size: var(--text-sm);
  background: var(--bg-widget);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
}

.status-widget-value {
  color: var(--text);
  font-weight: 600;
}

/* ── Cards — contenedores modulares ────────────────────────────────────── */
.card {
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(21, 24, 32, 0.98) 0%, var(--bg-card) 100%);
  box-shadow: var(--sh-sm);
  padding: var(--space-md);
}

.card:hover {
  border-color: var(--border-h);
  box-shadow: var(--sh);
}

.card-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.db-card-sm {
  padding: var(--space-md) !important;
}

.db-col-side .card.db-card-sm {
  background: linear-gradient(165deg, rgba(18, 22, 32, 0.98) 0%, var(--bg-card) 100%);
}

/* ── Botones — proporción 8:16 padding, altura mínima visual ───────────── */
.btn {
  padding: 9px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--r-sm);
  letter-spacing: -0.01em;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.12s var(--ease);
}

.btn-primary {
  background: linear-gradient(180deg, #7a9af5 0%, var(--blue) 100%);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 2px 8px rgba(112, 148, 240, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #8aa8f8 0%, #7a9af5 100%);
  box-shadow: 0 4px 14px rgba(112, 148, 240, 0.35);
  transform: translateY(-1px);
}

/* ── Badges — píldoras proporcionadas ──────────────────────────────────── */
.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.badge.blue   { border-color: rgba(112, 148, 240, 0.22); }
.badge.green  { border-color: rgba(94, 203, 168, 0.22); }
.badge.red    { border-color: rgba(224, 122, 122, 0.22); }
.badge.orange { border-color: rgba(212, 160, 84, 0.22); }
.badge.purple { border-color: rgba(165, 148, 232, 0.22); }
.badge.gray   { border-color: var(--border); }

/* ── Inputs y filtros ──────────────────────────────────────────────────── */
.filter-bar,
.cv-left-top,
.tk-toolbar {
  gap: var(--space-sm);
}

.filter-bar input,
.filter-bar select,
.cv-search,
.tk-search,
.cv-filters select,
.tk-toolbar select,
.db-date {
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  padding: 9px 12px;
  font-size: var(--text-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.filter-bar input:focus,
.cv-search:focus,
.tk-search:focus,
.db-date:focus,
select:focus {
  border-color: var(--border-gold);
  box-shadow: 0 0 0 3px var(--brand-gold-d);
  outline: none;
}

/* ── Dashboard — gráficos y feed ───────────────────────────────────────── */
.chart-container {
  padding: var(--space-sm) 4px 0;
}

.db-insight,
.db-feed-item {
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: var(--bg-widget);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.db-insight:hover,
.db-feed-item:hover {
  border-color: var(--border-h);
  background: var(--bg-surface);
}

.db-insight-icon {
  border-radius: 10px;
  box-shadow: var(--sh-sm);
}

.db-feed-dot {
  box-shadow: 0 0 0 3px rgba(94, 203, 168, 0.15);
}

/* ── WhatsApp ──────────────────────────────────────────────────────────── */
.wa-panel {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.wa-panel-header {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  background: rgba(73, 184, 92, 0.06);
  border-bottom-color: rgba(73, 184, 92, 0.15);
}

.wa-item {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  margin: 2px 4px;
}

.wa-item:hover {
  background: var(--bg-surface-h);
}

.wa-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: var(--text-sm);
  font-weight: 600;
}

.wa-name { font-size: var(--text-sm); font-weight: 600; }
.wa-preview { font-size: var(--text-xs); }

.wa-center-card {
  border-radius: var(--r-xl);
  box-shadow: var(--sh);
  background: linear-gradient(165deg, var(--bg-card-h) 0%, var(--bg-card) 100%);
}

.wa-connect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.wa-connect-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.wa-connect-item.ok { border-color: rgba(34, 197, 94, 0.35); }
.wa-connect-item.warn { border-color: rgba(251, 146, 60, 0.35); }

.wa-connect-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
  background: var(--orange);
}

.wa-connect-item.ok .wa-connect-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }
.wa-connect-item.warn .wa-connect-dot { background: var(--orange); box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.12); }

.wa-connect-item strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.wa-connect-item p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.wa-connect-item small {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.85;
}

/* ── Conversaciones ────────────────────────────────────────────────────── */
.cv-layout {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  border-color: var(--border);
}

.cv-left {
  background: rgba(255, 255, 255, 0.015);
}

.cv-item {
  padding: 11px 14px;
  margin: 2px 6px;
  border-radius: var(--r-sm);
  border-bottom: none;
}

.cv-item.selected {
  background: var(--blue-dim);
  box-shadow: inset 3px 0 0 var(--blue);
}

.cv-item-name {
  font-size: var(--text-sm);
  font-weight: 600;
}

.cv-center-header {
  background: var(--bg-widget);
  padding: 14px 18px;
}

.cv-center-title {
  font-size: var(--text-md);
  font-weight: 600;
}

.cv-ctx-section {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cv-ctx-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-gold);
  margin-bottom: 8px;
}

.cv-tl-body {
  border-radius: var(--r-sm);
  padding: 10px 12px;
  background: var(--bg-widget);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* ── Tickets / Casos ───────────────────────────────────────────────────── */
.tk-body {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.tk-toolbar {
  background: var(--bg-widget);
  border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 12px 14px;
}

.tk-list-row {
  transition: background 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

.tk-list-row.selected {
  background: var(--blue-dim);
  box-shadow: inset 3px 0 0 var(--blue);
}

.tk-kan-col {
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-widget);
  overflow: hidden;
}

.tk-kan-header {
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 12px;
}

.tk-kan-card {
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin: 4px 6px;
  box-shadow: var(--sh-sm);
}

.tk-kan-card:hover {
  border-color: var(--border-h);
  transform: translateY(-1px);
}

/* ── Vecinos ───────────────────────────────────────────────────────────── */
.neighbor-grid {
  gap: var(--space-md);
}

.neighbor-card {
  border-radius: var(--r-lg);
  padding: 16px 18px;
  background: linear-gradient(165deg, rgba(21, 24, 32, 0.98) 0%, var(--bg-card) 100%);
  box-shadow: var(--sh-sm);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}

.neighbor-card:hover {
  border-color: var(--border-gold);
  box-shadow: var(--sh), var(--sh-gold);
  transform: translateY(-2px);
}

.neighbor-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: var(--text-md);
  box-shadow: var(--sh-sm);
}

.neighbor-name {
  font-size: var(--text-md);
  font-weight: 600;
}

.neighbor-sector {
  font-size: var(--text-sm);
  color: var(--text-sec);
}

.neighbor-summary {
  font-size: var(--text-sm);
  color: var(--text-sec);
  padding: 8px 4px 12px;
}

/* ── Mapa en vivo ──────────────────────────────────────────────────────── */
.livemap-map-card {
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  border: 1px solid var(--border);
}

.livemap-map-host,
.livemap-map-host .leaflet-container {
  border-radius: var(--r);
  overflow: hidden;
}

.livemap-feed-item {
  border-radius: var(--r-sm);
  margin: 4px 8px;
  border: 1px solid transparent;
}

.livemap-feed-item:hover,
.livemap-feed-item.selected {
  border-color: var(--border-h);
  background: var(--bg-surface-h);
}

.livemap-legend-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-widget);
  border: 1px solid var(--border);
  font-size: var(--text-xs);
}

/* ── Analytics ───────────────────────────────────────────────────────── */
.an-card,
.an-metric-row {
  border-radius: var(--r-sm);
}

.an-metric-label {
  font-size: var(--text-sm);
  color: var(--text-sec);
}

.an-metric-val {
  font-size: var(--text-md);
  font-weight: 600;
}

/* ── Agenda ────────────────────────────────────────────────────────────── */
.agenda-item {
  padding: 14px 18px;
  border-radius: var(--r-sm);
  margin: 0 4px;
  transition: background 0.12s var(--ease);
}

.agenda-item:hover {
  background: var(--bg-surface-h);
}

.agenda-time {
  font-size: var(--text-sm);
  color: var(--brand-gold);
  font-weight: 700;
}

.agenda-title {
  font-size: var(--text-sm);
  font-weight: 600;
}

/* ── Reportes ──────────────────────────────────────────────────────────── */
.rpt-grid {
  gap: var(--space-md);
}

.rpt-card {
  border-radius: var(--r-lg);
  background: linear-gradient(165deg, rgba(21, 24, 32, 0.98) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}

.rpt-card:hover {
  border-color: var(--border-gold);
  box-shadow: var(--sh), var(--sh-gold);
  transform: translateY(-2px);
}

.rpt-card-title {
  font-size: var(--text-md);
  font-weight: 600;
}

.rpt-tag {
  background: var(--brand-gold-d);
  border-color: var(--border-gold);
  color: var(--brand-gold-l);
}

.rpt-history-row {
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

.module-icon {
  border-radius: 11px;
  box-shadow: var(--sh-sm);
}

/* ── Configuración ─────────────────────────────────────────────────────── */
.stg-layout {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.stg-sidebar {
  background: rgba(255, 255, 255, 0.012);
}

.stg-nav-item {
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  padding: 9px 12px;
  border: 1px solid transparent;
}

.stg-nav-item.active {
  background: var(--brand-gold-d);
  border-color: var(--border-gold);
  color: var(--brand-gold-l);
  font-weight: 600;
}

.stg-section-title {
  font-size: var(--text-lg);
  letter-spacing: -0.03em;
}

.stg-card {
  border-radius: var(--r);
}

.stg-export-card {
  border-radius: var(--r);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.stg-export-card:hover {
  border-color: var(--border-gold);
  box-shadow: var(--sh-sm);
}

/* ── Tablas ────────────────────────────────────────────────────────────── */
.table-wrap,
.sol-table-wrap {
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-sm);
}

.table-wrap th,
.sol-table th {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.025);
}

.table-wrap td,
.sol-table td {
  font-size: var(--text-sm);
  padding: 10px var(--space-md);
}

.table-wrap tr:hover td {
  background: var(--bg-surface);
}

/* ── Modales ───────────────────────────────────────────────────────────── */
.modal-overlay,
.ku-modal {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card,
.ku-modal-dialog,
.ficha-modal--tabs {
  border-radius: var(--r-xl);
  border: 1px solid var(--border-h);
  box-shadow: var(--sh-lg);
  background: linear-gradient(180deg, var(--bg-card-h) 0%, var(--bg-card) 100%);
}

.modal-head,
.ku-modal-head {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
}

.modal-head h3,
.ku-modal-head h3 {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.ficha-tabs {
  padding: 0 16px;
  gap: 2px;
}

.ficha-tab {
  font-size: var(--text-sm);
  padding: 12px 14px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}

.ficha-tab.active {
  color: var(--brand-gold-l);
  border-bottom-color: var(--brand-gold);
}

.ficha-resumen-dl div {
  grid-template-columns: minmax(120px, 38%) 1fr;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ficha-link-btn {
  border-radius: var(--r-sm);
  border-color: rgba(201, 160, 85, 0.35);
  background: var(--brand-gold-d);
  color: var(--brand-gold-l);
  font-size: var(--text-sm);
  padding: 9px 14px;
}

/* ── Empty states ──────────────────────────────────────────────────────── */
.empty-state {
  padding: var(--space-xl) var(--space-lg);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--bg-widget);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm), inset 0 0 0 4px var(--brand-gold-d);
  margin-bottom: var(--space-md);
}

.empty-state-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text);
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--text-sec);
  max-width: 32ch;
}

/* ── Toasts ────────────────────────────────────────────────────────────── */
#toast-container .toast {
  border-radius: var(--r);
  border: 1px solid var(--border);
  box-shadow: var(--sh-lg);
  font-size: var(--text-sm);
  backdrop-filter: blur(12px);
}

/* ── Banners demo / impersonación ──────────────────────────────────────── */
.demo-banner,
.impersonation-bar {
  border-bottom: 1px solid var(--border-gold);
  background: linear-gradient(90deg, rgba(201, 160, 85, 0.12), rgba(201, 160, 85, 0.04));
}

/* ── Seguridad ─────────────────────────────────────────────────────────── */
.sec-kpi {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.mu-users-table td .btn {
  font-size: var(--text-xs);
}

/* ── Solicitudes / Certificados ────────────────────────────────────────── */
.sol-table-main tr:hover td {
  background: var(--bg-surface);
}

.sol-badge {
  border-radius: 999px;
  font-weight: 600;
}

.cert-panel-banner,
.sol-ciudadano-banner {
  border-radius: var(--r);
  border: 1px solid var(--border-gold);
  background: var(--brand-gold-d);
}

.citizen-reports-strip {
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--bg-widget);
}

/* ── Mobile bottom nav — refinamiento visual ───────────────────────────── */
@media (max-width: 768px) {
  #mobile-bottom-nav {
    background: rgba(9, 11, 16, 0.94);
    border-top: 1px solid rgba(201, 160, 85, 0.12);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  }

  .mob-nav-item {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    gap: 4px;
  }

  .mob-nav-item.active {
    color: var(--brand-gold-l);
  }

  .mob-nav-item.active svg {
    filter: drop-shadow(0 2px 6px rgba(201, 160, 85, 0.35));
  }

  .mobile-drawer {
    background: linear-gradient(180deg, var(--bg-card-h) 0%, var(--bg-raised) 100%);
    border-color: var(--border-h);
  }

  .mobile-module-item {
    border-radius: var(--r);
    background: var(--bg-widget);
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
  }

  .mobile-module-item:active {
    border-color: var(--border-gold);
    background: var(--brand-gold-d);
  }

  .tk-list-row,
  .table-wrap tr,
  .sol-table tr {
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
  }

  .section-title,
  .db-top .section-title {
    font-size: var(--text-lg);
  }

  .kpi-value {
    font-size: var(--text-xl);
  }

  .modal-overlay,
  .ku-modal {
    background: rgba(9, 11, 16, 0.88);
  }

  .modal-card,
  .ku-modal-dialog,
  .ficha-modal--tabs,
  .auth-panel {
    border-radius: 0;
    border: none;
  }

  .modal-head,
  .ku-modal-head {
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .sec-sidebar,
  .stg-sidebar {
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Módulos secundarios — Seguridad, Knowledge, Envíos, Onboarding, Shell
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Splash ──────────────────────────────────────────────────────────────── */
#splash-screen {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, #0f2744 0%, #090b10 55%);
}

.splash-logo-mark {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--brand-navy-l), var(--brand-navy));
  box-shadow: 0 8px 32px rgba(15, 39, 68, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-size: 30px;
}

.splash-title {
  font-size: 24px;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.splash-bar {
  background: linear-gradient(90deg, var(--brand-navy), var(--brand-gold));
}

.splash-status {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Toasts ──────────────────────────────────────────────────────────────── */
#toast-container {
  gap: 8px;
}

.toast {
  min-width: 280px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: var(--r);
  background: linear-gradient(165deg, rgba(22, 26, 36, 0.98) 0%, rgba(18, 21, 28, 0.96) 100%);
  border: 1px solid var(--border-h);
  box-shadow: var(--sh-lg);
  font-size: var(--text-sm);
  color: var(--text);
  gap: 10px;
}

.toast-icon { width: 18px; height: 18px; }
.toast-msg { line-height: 1.45; }
.toast-close {
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  background: var(--bg-widget);
}

/* ── Onboarding ──────────────────────────────────────────────────────────── */
#onboarding-overlay {
  background: rgba(9, 11, 16, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.ob-card {
  border-radius: var(--r-xl);
  padding: 36px 32px;
  max-width: 440px;
  background: linear-gradient(165deg, var(--bg-card-h) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-h);
  box-shadow: var(--sh-lg), 0 0 0 1px rgba(201, 160, 85, 0.08);
}

.ob-icon {
  font-size: 40px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.ob-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.ob-desc {
  font-size: var(--text-sm);
  color: var(--text-sec);
  line-height: 1.6;
  max-width: 36ch;
  margin-inline: auto;
}

.ob-dot.active {
  background: var(--brand-gold);
  box-shadow: 0 0 10px rgba(201, 160, 85, 0.45);
}

.ob-actions .btn-primary {
  min-width: 120px;
}

/* ── Búsqueda global ─────────────────────────────────────────────────────── */
.global-search-results {
  border-radius: var(--r-lg);
  border: 1px solid var(--border-h);
  background: linear-gradient(180deg, var(--bg-card-h) 0%, var(--bg-card) 100%);
  box-shadow: var(--sh-lg);
  padding: 8px;
}

.gsr-section {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--brand-gold);
  padding: 8px 12px 6px;
}

.gsr-item {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  transition: background 0.12s var(--ease);
}

.gsr-item:hover,
.gsr-item:focus {
  background: var(--brand-gold-d);
  color: var(--text);
}

.gsr-item-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Dashboard setup banner ──────────────────────────────────────────────── */
.dash-setup-banner {
  border-radius: var(--r-lg);
  border: 1px solid var(--border-gold);
  background: linear-gradient(135deg, rgba(15, 39, 68, 0.55) 0%, var(--brand-gold-d) 100%);
  box-shadow: var(--sh-sm);
  padding: 18px 20px;
}

.dash-setup-banner h3 {
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dash-setup-step {
  border-radius: var(--r);
  padding: 12px 14px;
  background: var(--bg-widget);
  border: 1px solid var(--border);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.dash-setup-step.done {
  border-color: rgba(94, 203, 168, 0.35);
  background: var(--green-dim);
}

.dash-setup-step-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: var(--text-sm);
  font-weight: 700;
}

.dash-setup-step.done .dash-setup-step-icon {
  background: var(--green-dim);
  color: var(--green);
  box-shadow: 0 0 0 2px rgba(94, 203, 168, 0.2);
}

.dash-setup-step button {
  font-size: var(--text-xs);
  padding: 6px 12px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-sec);
}

/* ── Seguridad ───────────────────────────────────────────────────────────── */
.sec-shell {
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.sec-sidebar {
  background: rgba(255, 255, 255, 0.012);
  padding: 16px 10px;
}

.sec-sidebar .sec-nav-group {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--brand-gold);
  padding: 14px 12px 6px;
}

.sec-nav-item {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.sec-nav-item.active {
  background: var(--brand-gold-d);
  border-color: var(--border-gold);
  color: var(--brand-gold-l);
  font-weight: 600;
}

.sec-nav-item .sec-nav-badge {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 600;
}

.sec-body {
  padding: 24px 28px;
}

.sec-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.sec-desc {
  font-size: var(--text-sm);
  color: var(--text-sec);
  margin-bottom: var(--space-md);
}

.sec-kpi {
  border-radius: var(--r-lg);
  padding: 16px 18px;
  background: linear-gradient(165deg, rgba(21, 24, 32, 0.98) 0%, var(--bg-card) 100%);
  box-shadow: var(--sh-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.sec-kpi:hover {
  border-color: var(--border-gold);
  box-shadow: var(--sh-sm), var(--sh-gold);
}

.sec-kpi-value {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.sec-card {
  border-radius: var(--r-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--sh-sm);
}

.sec-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 14px 18px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.sec-row {
  padding: 11px 18px;
}

.sec-row-label {
  font-size: var(--text-sm);
}

.sec-btn {
  padding: 9px 14px;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: 500;
}

.sec-btn.primary {
  background: linear-gradient(180deg, #7a9af5 0%, var(--blue) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(112, 148, 240, 0.25);
}

.sec-btn.primary:hover {
  box-shadow: 0 4px 14px rgba(112, 148, 240, 0.35);
}

.sec-role-card {
  border-radius: var(--r-lg);
  padding: 16px;
  background: var(--bg-widget);
  border: 1px solid var(--border);
  transition: border-color 0.15s var(--ease);
}

.sec-role-card:hover {
  border-color: var(--border-gold);
}

.sec-perm-tag {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
}

.sec-tl-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sec-version-dot.current {
  box-shadow: 0 0 10px rgba(94, 203, 168, 0.45);
}

/* Usuarios municipales (mu-*) */
.mu-list-head {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.mu-users-table {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
}

.mu-users-table th {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.025);
}

.mu-users-table td {
  padding: 12px 16px;
  font-size: var(--text-sm);
}

.mu-pwd {
  color: var(--brand-gold-l);
  font-weight: 600;
}

.mu-edit-body label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.mu-once-password {
  border-radius: var(--r);
  border: 1px solid var(--border-gold);
  background: var(--brand-gold-d);
  padding: 12px 14px;
}

/* ── Cargar información (Knowledge) ──────────────────────────────────────── */
.ku-hero {
  border-radius: var(--r-xl);
  padding: 20px 22px;
  background: linear-gradient(135deg, var(--brand-gold-d) 0%, rgba(15, 39, 68, 0.25) 100%);
  border: 1px solid var(--border-gold);
  box-shadow: var(--sh-gold);
}

.ku-hero-icon {
  font-size: 2.25rem;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.ku-hero-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.ku-hero-desc {
  font-size: var(--text-sm);
  color: var(--text-sec);
}

.ku-card,
.ku-card--wide {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.ku-card-title {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.ku-count {
  background: var(--brand-gold-d);
  border: 1px solid var(--border-gold);
  color: var(--brand-gold-l);
  font-weight: 700;
  padding: 2px 8px;
}

.ku-table-wrap {
  border-radius: var(--r);
  border: 1px solid var(--border);
  overflow: hidden;
}

.ku-table th {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.025);
}

.ku-table td {
  padding: 12px 14px;
  font-size: var(--text-sm);
}

.ku-row {
  border-radius: var(--r-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--bg-widget);
  transition: border-color 0.12s var(--ease);
}

.ku-row:hover {
  border-color: var(--border-gold);
}

.ku-field label {
  color: var(--brand-gold);
  font-weight: 600;
}

.ku-field input[type="text"],
.ku-field input[type="file"] {
  border-radius: var(--r-sm);
  padding: 11px 14px;
  font-size: var(--text-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
}

.ku-field input:focus {
  border-color: var(--border-gold);
  box-shadow: 0 0 0 3px var(--brand-gold-d);
  outline: none;
}

.ku-preview-text {
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-widget);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* ── Envíos masivos (Bulk opt-in) ────────────────────────────────────────── */
.bo-panel {
  gap: var(--space-md);
}

.bo-alert {
  border-radius: var(--r);
  padding: 14px 16px;
  font-size: var(--text-sm);
  line-height: 1.55;
}

.bo-alert--ok {
  border: 1px solid rgba(94, 203, 168, 0.35);
  background: var(--green-dim);
}

.bo-alert--warn {
  border: 1px solid rgba(212, 160, 84, 0.4);
  background: var(--brand-gold-d);
}

.bo-card {
  border-radius: var(--r-lg);
  padding: 20px;
  background: linear-gradient(165deg, rgba(21, 24, 32, 0.98) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.bo-card:hover {
  border-color: var(--border-h);
  box-shadow: var(--sh);
}

.bo-card-title {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.bo-card-desc {
  font-size: var(--text-sm);
  color: var(--text-sec);
  line-height: 1.55;
}

.bo-card-desc code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-widget);
  font-size: var(--text-xs);
  color: var(--brand-gold-l);
}

.bo-textarea {
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: var(--text-sm);
  line-height: 1.55;
  border: 1px solid var(--border);
  background: var(--bg-input);
  min-height: 120px;
  resize: vertical;
}

.bo-textarea:focus {
  border-color: var(--border-gold);
  box-shadow: 0 0 0 3px var(--brand-gold-d);
  outline: none;
}

.bo-camp-row {
  border-radius: var(--r-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: var(--bg-widget);
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
}

.bo-camp-row:hover {
  border-color: var(--border-gold);
  background: var(--bg-surface-h);
}

.bo-log-list {
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  padding: 8px 12px;
  background: var(--bg-widget);
}

.bo-log-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: var(--text-sm);
}

/* ── Solicitudes / Certificados modales ──────────────────────────────────── */
.sol-modal,
.modal-card.sol-modal {
  width: min(580px, 100%);
  border-radius: var(--r-xl);
}

.sol-modal-body {
  padding: 18px 20px;
  font-size: var(--text-sm);
  line-height: 1.55;
}

.sol-modal-actions {
  padding: 0 20px 18px;
  gap: 10px;
}

.sol-badge {
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
}

.sol-entry-btn,
.sol-new-btn {
  border-radius: var(--r-sm);
  font-weight: 600;
}

/* ── WhatsApp setup overlay ──────────────────────────────────────────────── */
.wa-setup-overlay {
  background: rgba(9, 11, 16, 0.94);
}

.wa-setup-shell {
  max-width: 540px;
}

.wa-setup-progress-head h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.wa-setup-progress-track {
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-widget);
  border: 1px solid var(--border);
}

.wa-setup-progress-fill {
  background: linear-gradient(90deg, var(--brand-navy-l), var(--brand-gold));
}

.wa-setup-milestone.active .wa-setup-milestone-dot,
.wa-setup-milestone.done .wa-setup-milestone-dot {
  background: var(--brand-gold);
  box-shadow: 0 0 10px rgba(201, 160, 85, 0.45);
}

.wa-setup-card {
  border-radius: var(--r-xl);
  border: 1px solid var(--border-h);
  background: linear-gradient(180deg, var(--bg-card-h) 0%, var(--bg-card) 100%);
  box-shadow: var(--sh-lg);
}

.wa-setup-close-btn {
  border-radius: var(--r-sm);
  border-color: var(--border);
}

/* ── Concejo / Analytics cards genéricos ─────────────────────────────────── */
#concejo-content .card,
#an-main .card,
#an-side .card,
#agenda-content .card {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

#concejo-content .kpi,
#an-kpis .kpi {
  min-height: 96px;
}

/* ── Focus rings institucionales ─────────────────────────────────────────── */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(201, 160, 85, 0.45);
  outline-offset: 2px;
}

/* ── Scrollbar refinado ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 160, 85, 0.35);
}

.view.active {
  animation: viewInRefined 0.32s var(--ease-out) both;
}

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

@media (prefers-reduced-motion: reduce) {
  .view.active,
  .kpi:hover,
  .rpt-card:hover,
  .neighbor-card:hover,
  .btn-primary:hover {
    animation: none;
    transform: none;
  }
}
