/* ==========================================================================
   Muniva · Backoffice municipal
   Base visual: tokens institucionales, WCAG 2.2 AA, fuentes autoalojadas.
   Radios ≤ 6 px y ningún aviso/card con acento solo en el borde izquierdo.
   ========================================================================== */

@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/SourceSans3-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/SourceSans3-Italic-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --color-primario: var(--accent, #193F9D);
  /* El hover aclara el primario con blanco en vez de oscurecerlo: el texto
     derivado de contrastText mantiene >=4,5:1 tanto con primarios claros
     (texto oscuro) como con primarios oscuros (texto blanco). */
  --color-primario-hover: color-mix(in srgb, var(--color-primario) 90%, #fff);
  --color-primario-suave: color-mix(in srgb, var(--color-primario) 10%, #fff);
  /* Variantes para texto sobre fondo claro: el primario de marca puede ser
     demasiado claro como color de texto (p. ej. el azul #0099CB). */
  --color-primario-texto: color-mix(in srgb, var(--color-primario) 70%, #000);
  --color-primario-texto-hover: color-mix(in srgb, var(--color-primario) 52%, #000);
  --color-secundario: var(--accent-2, #22223B);
  --color-sobre-primario: var(--on-accent, #fff);

  /* Neutros de muniva.es */
  --color-texto: #22223B;
  --color-texto-suave: #4A4A5E;
  --color-fondo: #ffffff;
  --color-fondo-alt: var(--surface, #f5f5f9);
  --color-borde: #E2E2EA;
  --color-borde-fuerte: #6B6B7E;

  --color-exito: #17633a;
  --color-exito-fondo: #e7f5ec;
  --color-aviso: #5c4300;
  --color-aviso-fondo: #fff4d1;
  --color-error: #b00020;
  --color-error-fondo: #fdecee;
  --color-info: #2F6FED;
  --color-info-fondo: #E5EDFD;

  --color-foco: #ffbf47;
  --color-foco-borde: #1a1d21;

  /* Chrome corporativo de la barra lateral. */
  --chrome-fondo: var(--color-primario);
  --chrome-texto: var(--color-sobre-primario);
  --chrome-texto-suave: color-mix(in srgb, var(--color-sobre-primario) 76%, transparent);
  --chrome-linea: color-mix(in srgb, var(--color-sobre-primario) 22%, transparent);
  --chrome-hover: color-mix(in srgb, var(--color-sobre-primario) 9%, transparent);
  --chrome-activo: var(--color-sobre-primario);

  --fuente-texto: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fuente-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --texto-base: 1rem;
  --texto-sm: 0.875rem;
  --texto-lg: 1.125rem;
  --h1: clamp(1.875rem, 1.4rem + 2vw, 2.5rem);
  --h2: clamp(1.5rem, 1.25rem + 1vw, 1.875rem);
  --h3: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --h4: 1.125rem;
  --interlineado: 1.5;
  --interlineado-titulos: 1.2;

  --esp-1: 0.25rem;
  --esp-2: 0.5rem;
  --esp-3: 0.75rem;
  --esp-4: 1rem;
  --esp-5: 1.5rem;
  --esp-6: 2rem;
  --esp-7: 3rem;
  --esp-8: 4rem;

  --radio: 4px;
  --radio-lg: 6px;
  --borde: 1px solid var(--color-borde);
  --sombra: 0 1px 3px rgba(26, 29, 33, 0.12);
  --ancho-contenido: 1180px;
  --ancho-lectura: 70ch;
  --objetivo-tactil: 2.75rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--esp-7); }
body {
  margin: 0; min-height: 100vh; font-family: var(--fuente-texto); font-size: var(--texto-base);
  line-height: var(--interlineado); color: var(--color-texto); background: var(--color-fondo-alt);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, picture, video, svg { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
[hidden] { display: none !important; }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--esp-3); font-weight: 700; line-height: var(--interlineado-titulos);
  color: var(--color-texto); text-wrap: balance;
}
h1 { font-size: var(--h1); }
h2 { font-size: var(--h2); }
h3 { font-size: var(--h3); }
h4 { font-size: var(--h4); }
p { margin: 0 0 var(--esp-4); max-width: var(--ancho-lectura); }
small { font-size: var(--texto-sm); }
strong, b { font-weight: 700; }
ul, ol { margin: 0 0 var(--esp-4); padding-left: var(--esp-5); max-width: var(--ancho-lectura); }
li + li { margin-top: var(--esp-1); }
code, kbd, samp, .mono { font-family: var(--fuente-mono); font-size: 0.9em; background: var(--color-fondo-alt); padding: 0.1em 0.35em; border-radius: var(--radio); }
blockquote { margin: var(--esp-5) 0; padding: var(--esp-4); border: var(--borde); border-radius: var(--radio); background: var(--color-fondo-alt); max-width: var(--ancho-lectura); }

a { color: var(--color-primario-texto); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 0.08em; }
a:hover { color: var(--color-primario-texto-hover); text-decoration-thickness: 0.15em; }
:focus-visible { outline: 3px solid var(--color-foco); outline-offset: 2px; box-shadow: 0 0 0 2px var(--color-foco-borde); border-radius: 2px; }
:focus:not(:focus-visible) { outline: none; }

.saltar-contenido {
  position: absolute; left: var(--esp-4); top: -4rem; z-index: 1000;
  padding: var(--esp-3) var(--esp-4); background: var(--color-primario);
  color: var(--color-sobre-primario); font-weight: 600; border-radius: 0 0 var(--radio) var(--radio);
  border: 1px solid var(--chrome-linea); box-shadow: 0 6px 18px rgba(7, 17, 31, .35);
}
.saltar-contenido:focus { top: 0; }
.solo-lector, .sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.contenedor { width: 100%; max-width: var(--ancho-contenido); margin-inline: auto; padding-inline: var(--esp-4); }
@media (min-width: 768px) { .contenedor { padding-inline: var(--esp-5); } }
.seccion { padding-block: var(--esp-6); }
.eyebrow { margin: 0 0 var(--esp-1); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 700; color: var(--color-texto-suave); }
.muted, .texto-suave { color: var(--color-texto-suave); }
.texto-sm { font-size: var(--texto-sm); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.centrado { text-align: center; }

/* Shell de backoffice */
.app-body { background: var(--color-fondo-alt); }
.app-shell { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--esp-3);
  padding: var(--esp-4); background: var(--chrome-fondo); color: var(--chrome-texto);
  border-right: 1px solid var(--chrome-linea);
}
.sidebar__brand { padding: var(--esp-1) var(--esp-1) var(--esp-4); border-bottom: 1px solid var(--chrome-linea); }
.brand-link { display: flex; align-items: center; gap: var(--esp-3); color: var(--chrome-texto); text-decoration: none; }
.brand-link:hover { text-decoration: none; color: var(--chrome-texto); }
.brand-mark {
  width: 2.5rem; height: 2.5rem; flex: 0 0 2.5rem; display: inline-flex; align-items: center; justify-content: center;
  background: var(--chrome-hover); border: 1px solid var(--chrome-linea); color: var(--chrome-texto); border-radius: var(--radio);
  font-weight: 800; font-size: 1.1rem;
}
.brand-mark.large { width: 4rem; height: 4rem; flex-basis: 4rem; font-size: 1.75rem; }
.brand-logo { width: 2.5rem; height: 2.5rem; flex: 0 0 2.5rem; object-fit: contain; border-radius: var(--radio); background: #fff; padding: 2px; }
.brand-logo.large { width: 4rem; height: 4rem; flex-basis: 4rem; }
.pie__brand { display: inline-flex; align-items: center; gap: var(--esp-1); font-weight: 700; }
.pie__brand img { width: 1rem; height: 1rem; }
.auth-logo { display: block; width: 10.5rem; height: auto; margin-inline: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--chrome-texto); }
.brand-text small { color: var(--chrome-texto-suave); font-weight: 400; }
.sidebar-nav { display: flex; flex-direction: column; gap: var(--esp-4); flex: 1; }
.nav-group { margin: var(--esp-2) var(--esp-2) 0; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--chrome-texto-suave); font-weight: 700; }
.sidebar-nav ul { display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 0; padding: 0; max-width: none; }
.sidebar-nav li + li { margin-top: 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: var(--esp-3); min-height: var(--objetivo-tactil);
  padding: var(--esp-2) var(--esp-3); border-radius: var(--radio);
  color: var(--chrome-texto); text-decoration: none; font-weight: 600;
}
.sidebar-nav a:hover { background: var(--chrome-hover); color: var(--chrome-texto); text-decoration: none; }
.sidebar-nav a[aria-current="page"] { background: var(--chrome-activo); color: var(--chrome-fondo); font-weight: 700; }
.sidebar-nav a[aria-current="page"] .nav-icon { color: var(--chrome-fondo); opacity: 1; }
.sidebar-nav a.nav-parent--active { background: var(--chrome-hover); }
.sidebar-nav li.nav-with-sub { position: relative; }
.sidebar-nav li.nav-with-sub > a { padding-right: 2.75rem; }
.nav-sub-details { display: block; }
.nav-sub-toggle {
  position: absolute; top: 0; right: var(--esp-1); width: 2.25rem; height: var(--objetivo-tactil);
  display: flex; align-items: center; justify-content: center;
  color: var(--chrome-texto); cursor: pointer; list-style: none;
  border-radius: var(--radio);
}
.nav-sub-toggle::-webkit-details-marker { display: none; }
.nav-sub-toggle:hover { background: var(--chrome-hover); color: var(--chrome-texto); }
.nav-sub-toggle svg { width: 1.1rem; height: 1.1rem; transition: transform .15s ease; }
.nav-sub-details[open] .nav-sub-toggle svg { transform: rotate(180deg); }
.nav-with-sub--active .nav-sub-toggle { color: var(--chrome-texto); }
.sidebar-nav li.nav-with-sub > a[aria-current="page"] ~ .nav-sub-details .nav-sub-toggle { color: var(--chrome-fondo); }
.sidebar-nav li.nav-with-sub > a[aria-current="page"] ~ .nav-sub-details .nav-sub-toggle:hover { background: color-mix(in srgb, var(--chrome-fondo) 12%, transparent); }
.nav-sub-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: -4px; border-radius: var(--radio); }
.sidebar-nav .nav-sub { gap: 1px; padding-left: calc(var(--esp-3) + 1.25rem + var(--esp-3)); }
.sidebar-nav .nav-sub a { min-height: 2rem; padding: var(--esp-1) var(--esp-3); font-size: .9rem; font-weight: 500; }
.sidebar-nav .nav-sub a[aria-current="page"] { font-weight: 700; }
.nav-icon { width: 1.25rem; height: 1.25rem; flex: 0 0 1.25rem; display: inline-flex; color: currentColor; opacity: .88; }
.nav-icon svg { width: 100%; height: 100%; }
.sidebar__footer { border-top: 1px solid var(--chrome-linea); padding-top: var(--esp-3); display: flex; flex-direction: column; gap: var(--esp-2); }
.sidebar-user { display: flex; align-items: center; gap: var(--esp-2); padding: var(--esp-1); }
.sidebar-user__text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar-user__text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--chrome-texto); }
.sidebar-user__text small { color: var(--chrome-texto-suave); }
.avatar { width: 2.25rem; height: 2.25rem; flex: 0 0 2.25rem; border-radius: var(--radio); display: inline-flex; align-items: center; justify-content: center; background: var(--chrome-hover); border: 1px solid var(--chrome-linea); color: var(--chrome-texto); font-weight: 800; }
.sidebar-logout {
  width: 100%; justify-content: flex-start; gap: var(--esp-3); min-height: var(--objetivo-tactil);
  border: 0; background: transparent; color: var(--chrome-texto-suave); padding: var(--esp-2) var(--esp-3);
}
.sidebar-logout:hover { background: var(--chrome-hover); color: var(--chrome-texto); }
.sidebar-logout .nav-icon { color: currentColor; opacity: 1; }

.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.contenido { width: 100%; max-width: var(--ancho-contenido); margin-inline: auto; padding: var(--esp-6); flex: 1; }
.pie { margin-top: auto; padding: var(--esp-4) var(--esp-6); background: var(--color-fondo); border-top: var(--borde); color: var(--color-texto-suave); }
.pie p, .pie a { color: var(--color-texto-suave); }
.pie__interior { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--esp-4); flex-wrap: wrap; max-width: var(--ancho-contenido); margin-inline: auto; }
.pie p { margin: 0; max-width: 60ch; font-size: var(--texto-sm); }


/* Página */
.main, main { min-height: 50vh; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--esp-4); flex-wrap: wrap; margin-bottom: var(--esp-5); }
.page-head > div:first-child { display: flex; flex-direction: column; gap: var(--esp-1); }
.page-head h1 { margin: 0; }
.page-actions { display: flex; gap: var(--esp-2); flex-wrap: wrap; }
.row-actions { display: flex; gap: var(--esp-2); flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.row-actions form { margin: 0; }
.breadcrumb { color: var(--color-texto-suave); font-size: var(--texto-sm); margin-bottom: var(--esp-2); }
.panel, .tarjeta {
  background: var(--color-fondo); border: var(--borde); border-radius: var(--radio-lg);
  padding: var(--esp-5); box-shadow: var(--sombra); min-width: 0; margin-bottom: var(--esp-4);
}
.panel > :last-child, .tarjeta > :last-child { margin-bottom: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--esp-3); margin-bottom: var(--esp-4); flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: var(--h4); }
.panel-head a { font-weight: 600; font-size: var(--texto-sm); }
.note { padding: var(--esp-4); border: 1px solid color-mix(in srgb, var(--color-primario) 35%, var(--color-borde)); background: var(--color-primario-suave); border-radius: var(--radio-lg); margin-bottom: var(--esp-4); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr); gap: var(--esp-4); align-items: start; }
.two-col > :only-child { grid-column: 1 / -1; }
.side-col { display: flex; flex-direction: column; gap: var(--esp-4); }
.stack { display: flex; flex-direction: column; gap: var(--esp-2); }
.section-title { margin: var(--esp-5) 0 var(--esp-3); font-size: var(--h4); }
.hint { color: var(--color-texto-suave); font-size: var(--texto-sm); margin-top: var(--esp-2); }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--esp-3); margin-bottom: var(--esp-4); }
.stat { background: var(--color-fondo); border: var(--borde); border-radius: var(--radio-lg); padding: var(--esp-4); box-shadow: var(--sombra); display: flex; flex-direction: column; gap: var(--esp-1); }
.stat strong { font-size: 1.75rem; line-height: 1.1; color: var(--color-primario-texto); }
.stat-text { font-size: var(--texto-lg) !important; overflow-wrap: anywhere; }
.stat-label { color: var(--color-texto-suave); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.stat small { color: var(--color-texto-suave); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: var(--esp-4); }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--esp-3); }
.quick-grid a { border: var(--borde); border-radius: var(--radio); padding: var(--esp-4); display: flex; flex-direction: column; gap: var(--esp-1); color: var(--color-texto); text-decoration: none; min-height: var(--objetivo-tactil); }
.quick-grid a:hover { border-color: var(--color-primario); background: var(--color-primario-suave); text-decoration: none; }
.quick-grid span { color: var(--color-texto-suave); font-size: var(--texto-sm); }
.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--esp-3); }
.activity li { display: flex; gap: var(--esp-3); align-items: flex-start; }
.activity-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--color-primario); margin-top: .45rem; flex: 0 0 .5rem; }
.activity div { display: flex; flex-direction: column; }
.activity small { color: var(--color-texto-suave); }
.module-list { display: flex; flex-direction: column; }
.module-row { display: flex; align-items: center; justify-content: space-between; gap: var(--esp-3); padding: var(--esp-3) 0; border-bottom: var(--borde); }
.module-row:last-child { border-bottom: 0; }
.module-row div { display: flex; flex-direction: column; }

/* Tablas */
.table-wrap, .tabla-contenedor { overflow-x: auto; margin-bottom: var(--esp-4); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: var(--esp-3); text-align: left; vertical-align: top; border-bottom: var(--borde); }
thead th { background: var(--color-primario); color: var(--color-sobre-primario); border-bottom: 0; }
tbody tr:nth-child(even) { background: var(--color-fondo-alt); }
tbody tr:hover { background: var(--color-primario-suave); }
td strong { display: block; }
td small { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: var(--esp-1); }
.chip { border: var(--borde); background: var(--color-fondo); border-radius: var(--radio); padding: 0.1rem 0.45rem; font-size: var(--texto-sm); }
.badge, .etiqueta { display: inline-flex; align-items: center; gap: var(--esp-1); border-radius: var(--radio); padding: 0.15rem 0.55rem; font-size: var(--texto-sm); font-weight: 650; border: 1px solid transparent; }
.badge.ok, .etiqueta--ok { background: var(--color-exito-fondo); color: var(--color-exito); border-color: color-mix(in srgb, var(--color-exito) 30%, #fff); }
.badge.muted { background: var(--color-fondo-alt); color: var(--color-texto-suave); border-color: var(--color-borde); }
.badge.bad, .etiqueta--error { background: var(--color-error-fondo); color: var(--color-error); border-color: color-mix(in srgb, var(--color-error) 30%, #fff); }
.badge.warn { background: var(--color-aviso-fondo); color: var(--color-aviso); border-color: color-mix(in srgb, var(--color-aviso) 30%, #fff); }

/* Formularios */
label { display: flex; flex-direction: column; gap: var(--esp-1); font-size: var(--texto-sm); color: var(--color-texto); font-weight: 600; }
input, select, textarea {
  display: block; width: 100%; min-height: var(--objetivo-tactil); padding: var(--esp-2) var(--esp-3);
  background: var(--color-fondo); border: 2px solid var(--color-borde-fuerte); border-radius: var(--radio);
}
input:hover, select:hover, textarea:hover { border-color: var(--color-texto); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }
input[readonly] { background: var(--color-fondo-alt); color: var(--color-texto-suave); }
textarea { min-height: 8rem; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 1.5rem; height: 1.5rem; min-height: 0; margin: 0; accent-color: var(--color-primario); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--esp-4) var(--esp-5); }
.form-grid input, .form-grid select, .form-grid textarea { max-width: none; }
.form-stack { display: flex; flex-direction: column; gap: var(--esp-4); }
.form-actions { display: flex; gap: var(--esp-2); align-items: center; flex-wrap: wrap; grid-column: 1 / -1; }
.form-actions.sticky { position: sticky; bottom: 0; background: var(--color-fondo-alt); padding: var(--esp-3) 0; border-top: var(--borde); }
.fieldset { border: var(--borde); border-radius: var(--radio); padding: var(--esp-3); grid-column: 1 / -1; }
.fieldset legend { padding: 0 var(--esp-1); color: var(--color-texto-suave); font-size: var(--texto-sm); font-weight: 700; }
.check { flex-direction: row; align-items: flex-start; gap: var(--esp-2); font-weight: 400; padding: var(--esp-1) 0; min-height: var(--objetivo-tactil); }
.check span { display: flex; flex-direction: column; }
.check small { color: var(--color-texto-suave); }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--esp-3); align-items: flex-end; }
.inline-form label { min-width: 14rem; flex: 1; }

/* Tema de colores */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: var(--esp-3); margin-bottom: var(--esp-5); }
.theme-option {
  position: relative; display: flex; flex-direction: column; gap: var(--esp-2);
  border: 2px solid var(--color-borde); border-radius: var(--radio); padding: var(--esp-3);
  background: var(--color-fondo); cursor: pointer; font-weight: 600;
}
.theme-option:hover { border-color: var(--color-borde-fuerte); }
.theme-option.is-active, .theme-option:has(input:checked) {
  border-color: var(--color-primario);
  box-shadow: 0 0 0 1px var(--color-primario);
}
.theme-option input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-option:focus-within { outline: 3px solid var(--color-foco); outline-offset: 2px; }
.theme-option__top { display: flex; align-items: center; justify-content: space-between; gap: var(--esp-2); }
.theme-option__name { font-size: var(--texto-sm); }
.theme-option__note { color: var(--color-texto-suave); font-size: var(--texto-sm); font-weight: 400; }
.theme-swatches { display: inline-flex; gap: 4px; }
.theme-swatches span { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--color-texto) 25%, transparent); }
.theme-custom { display: flex; flex-direction: column; gap: var(--esp-2); }
.theme-preview { display: flex; align-items: center; gap: var(--esp-2); color: var(--color-texto-suave); font-size: var(--texto-sm); }

/* Botones */
.btn, .button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--esp-2);
  min-height: var(--objetivo-tactil); padding: var(--esp-2) var(--esp-5);
  font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer;
  border: 2px solid var(--color-primario); border-radius: var(--radio);
  background: var(--color-primario); color: var(--color-sobre-primario);
  transition: background-color .15s ease, color .15s ease;
}
.btn:hover, .button:hover, button:hover { background: var(--color-primario-hover); border-color: var(--color-primario-hover); color: var(--color-sobre-primario); text-decoration: none; }
.btn--secundario, .button:not(.primary):not(.danger) { background: transparent; color: var(--color-primario-texto); }
.btn--secundario:hover, .button:not(.primary):not(.danger):hover { background: var(--color-primario-suave); color: var(--color-primario-texto-hover); }
.btn--peligro, .button.danger, button.danger { background: var(--color-error); border-color: var(--color-error); color: #fff; }
.btn--peligro:hover, .button.danger:hover, button.danger:hover { background: #8a001a; border-color: #8a001a; color: #fff; }
.btn.primary, .button.primary { background: var(--color-primario); color: var(--color-sobre-primario); }
.btn--sm { min-height: var(--objetivo-tactil); padding: var(--esp-1) var(--esp-3); font-size: var(--texto-sm); }
.full { width: 100%; }
.btn[disabled], .button[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.link-button { border: 0; background: transparent; min-height: 0; padding: var(--esp-1); color: var(--color-primario-texto); font-weight: 600; text-decoration: underline; }
.link-button:hover { background: transparent; color: var(--color-primario-texto-hover); }
.actions { display: flex; flex-wrap: wrap; gap: var(--esp-2); align-items: center; }

/* Avisos: borde completo, nunca solo izquierdo */
.flash, .error, .aviso { margin-bottom: var(--esp-4); padding: var(--esp-4); border: 1px solid currentColor; border-radius: var(--radio-lg); max-width: var(--ancho-lectura); }
.flash { background: var(--color-exito-fondo); color: var(--color-exito); }
.error { background: var(--color-error-fondo); color: var(--color-error); }
.aviso--info { background: var(--color-info-fondo); color: var(--color-info); }
.aviso--exito { background: var(--color-exito-fondo); color: var(--color-exito); }
.aviso--aviso { background: var(--color-aviso-fondo); color: var(--color-aviso); }
.aviso--error { background: var(--color-error-fondo); color: var(--color-error); }
.flash-link { margin-top: var(--esp-1); overflow-wrap: anywhere; font-size: var(--texto-sm); }
.flash-link a { color: inherit; }
.error-text { color: var(--color-error); }
.danger-panel { border-color: color-mix(in srgb, var(--color-error) 40%, var(--color-borde)); }

/* Avisos flotantes: se apilan sobre el contenido, no lo desplazan */
.notices {
  position: fixed; top: var(--esp-6); right: var(--esp-6); z-index: 30;
  display: flex; flex-direction: column; gap: var(--esp-2);
  width: min(26rem, calc(100vw - 2rem)); pointer-events: none;
}
.notice {
  pointer-events: auto; display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  align-items: start; gap: var(--esp-3); padding: var(--esp-3) var(--esp-4);
  background: var(--color-fondo); border: 1px solid var(--color-borde-fuerte); border-radius: var(--radio);
  color: var(--color-texto);
  box-shadow: 0 12px 28px rgba(16, 24, 40, .18);
  animation: notice-in .18s ease-out;
}
.notice--success { background: var(--color-exito-fondo); border-color: var(--color-exito); }
.notice--error { background: var(--color-error-fondo); border-color: var(--color-error); }
.notice--warning { background: var(--color-aviso-fondo); border-color: var(--color-aviso); }
.notice--info { background: var(--color-info-fondo); border-color: var(--color-info); }
.notice__icon { display: flex; color: var(--color-texto-suave); }
.notice__icon svg { width: 1.5rem; height: 1.5rem; }
.notice--success .notice__icon { color: var(--color-exito); }
.notice--error .notice__icon { color: var(--color-error); }
.notice--warning .notice__icon { color: var(--color-aviso); }
.notice--info .notice__icon { color: var(--color-info); }
.notice__body { min-width: 0; }
.notice__text { margin: 0; font-size: var(--texto-sm); font-weight: 600; overflow-wrap: anywhere; }
.notice__link { display: inline-block; margin-top: var(--esp-1); font-size: var(--texto-sm); color: inherit; overflow-wrap: anywhere; }
.notice__close {
  display: none; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; min-height: 0; padding: 0;
  border: 1px solid transparent; border-radius: var(--radio);
  background: transparent; color: var(--color-texto-suave); cursor: pointer;
}
muniva-notices:defined .notice__close { display: inline-flex; }
.notice__close:hover { background: color-mix(in srgb, var(--color-texto) 8%, transparent); color: var(--color-texto); }
.notice__close svg { width: 1rem; height: 1rem; }
.notice.is-leaving { animation: notice-out .15s ease-in forwards; }
@keyframes notice-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes notice-out { to { opacity: 0; transform: translateY(-4px); } }

/* Definiciones y permisos */
.grid { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: var(--esp-2) var(--esp-4); margin: 0; }
.grid dt { color: var(--color-texto-suave); }
.grid dd { margin: 0; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--esp-2); }
.permission { display: flex; flex-direction: column; gap: var(--esp-1); border: var(--borde); border-radius: var(--radio); padding: var(--esp-3); background: var(--color-fondo-alt); }
.permission small { color: var(--color-texto-suave); }
.permission > .badge { align-self: flex-start; }
.permission.check { flex-direction: row; align-items: flex-start; }
.session-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--esp-2); }
.session-list li { display: flex; justify-content: space-between; gap: var(--esp-3); border-bottom: var(--borde); padding-bottom: var(--esp-2); }
.session-list li:last-child { border-bottom: 0; }

/* Auth */
.auth-body { background: var(--color-fondo); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 1.2fr); }
.auth-brand {
  background: var(--color-primario);
  color: var(--color-sobre-primario); padding: var(--esp-8) var(--esp-7);
  display: flex; flex-direction: column; justify-content: center; gap: var(--esp-4);
}
.auth-brand > * { max-width: 34rem; }
.auth-brand h1 { color: var(--color-sobre-primario); }
.auth-brand p, .auth-brand li { color: var(--color-sobre-primario); opacity: .9; }
.auth-brand .eyebrow { color: var(--color-sobre-primario); opacity: .75; }
.auth-brand .brand-mark { background: color-mix(in srgb, var(--color-sobre-primario) 16%, transparent); border: 1px solid color-mix(in srgb, var(--color-sobre-primario) 38%, transparent); color: var(--color-sobre-primario); }
.auth-points { margin: var(--esp-2) 0 0; padding-left: var(--esp-5); display: flex; flex-direction: column; gap: var(--esp-2); }
.auth-panel__inner { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: var(--esp-4); width: 100%; max-width: 60rem; }
.demo-card { width: 100%; max-width: 24rem; padding: var(--esp-3) var(--esp-4); border-radius: var(--radio-lg); background: var(--color-fondo); border: var(--borde); box-shadow: 0 18px 40px rgba(17, 24, 39, 0.18); color: var(--color-texto); display: flex; flex-direction: column; gap: var(--esp-2); }
.demo-card h2 { margin: 0; font-size: 1.05rem; color: var(--color-texto); }
.demo-card h3 { margin: var(--esp-2) 0 0; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--color-texto-suave); }
.demo-card p { margin: 0; font-size: var(--texto-sm); color: var(--color-texto-suave); }
.demo-card code { background: var(--color-fondo-alt); border: 1px solid var(--color-borde); color: var(--color-texto); font-size: 12px; }
.demo-card p code { white-space: nowrap; }
.demo-card__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--esp-2); }
.demo-card__list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--esp-2); align-items: center; }
.demo-card__role { font-weight: 700; font-size: var(--texto-sm); color: var(--color-texto); }
.demo-card__mail { grid-column: 1; justify-self: start; font-size: 12px; overflow-wrap: anywhere; }
.demo-card__use { grid-column: 2; grid-row: 1 / span 2; align-self: center; border: 1px solid var(--color-primario); background: var(--color-primario); color: var(--color-sobre-primario); padding: var(--esp-1) var(--esp-2); font-size: var(--texto-sm); border-radius: var(--radio); }
.demo-card__use:hover { background: var(--color-primario-hover); border-color: var(--color-primario-hover); color: var(--color-sobre-primario); }
.demo-card__note { opacity: .85; line-height: 1.35; }
.auth-panel { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--esp-6); background: var(--color-fondo-alt); }
.auth-decor {
  position: absolute; inset: -6%; pointer-events: none;
  opacity: .55;
  filter: blur(6px);
  animation: auth-enter 1.8s ease-out both;
}
.auth-decor__piece {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--s); height: var(--s);
  border-radius: var(--radio-lg);
  background: var(--c);
  animation: auth-piece var(--d) ease-in-out var(--delay) infinite alternate;
  will-change: transform;
}
@keyframes auth-enter {
  from { opacity: 0; scale: 1.05; filter: blur(12px); }
  to { opacity: .55; scale: 1; filter: blur(6px); }
}
@keyframes auth-piece {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(var(--dx), var(--dy), 0); }
}
.auth-card, .auth-foot { position: relative; z-index: 1; }
.auth-card { flex: 1 1 20rem; width: 100%; max-width: 29rem; background: var(--color-fondo); border: var(--borde); border-radius: var(--radio-lg); padding: var(--esp-6); box-shadow: var(--sombra); display: flex; flex-direction: column; gap: var(--esp-4); }
.auth-card h2 { margin: 0; color: var(--color-texto); }
.auth-links { text-align: center; font-size: var(--texto-sm); margin: var(--esp-2) 0 0; }
.auth-foot { flex: 0 0 auto; width: 100%; color: var(--color-texto-suave); font-size: var(--texto-sm); margin-top: var(--esp-2); text-align: center; }
@media (max-width: 1180px) {
  .auth-panel__inner { flex-direction: column; flex-wrap: nowrap; align-items: center; }
  .auth-card { flex: 0 1 auto; width: 100%; max-width: 29rem; }
}
/* Utilidades */
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-4 { margin-top: var(--esp-4) !important; }
.mb-4 { margin-bottom: var(--esp-4) !important; }
.mt-6 { margin-top: var(--esp-6) !important; }
.mb-6 { margin-bottom: var(--esp-6) !important; }
.section { padding-block: var(--esp-7); }
.section--alt { background: var(--color-fondo-alt); }
.rejilla { display: grid; gap: var(--esp-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.fila { display: flex; flex-wrap: wrap; gap: var(--esp-3); align-items: center; }
.pila > * + * { margin-top: var(--esp-4); }
.campo { margin-bottom: var(--esp-5); }
.campo__ayuda { display: block; margin-bottom: var(--esp-2); font-size: var(--texto-sm); color: var(--color-texto-suave); }
.campo--error input, .campo--error select, .campo--error textarea { border-color: var(--color-error); border-width: 3px; }
.campo__error { display: block; margin-bottom: var(--esp-2); font-weight: 700; color: var(--color-error); }
.opcion { display: flex; align-items: flex-start; min-height: var(--objetivo-tactil); padding-block: var(--esp-1); }

/* Incidencias */
.filtros { padding: var(--esp-4); }
.filtros .form-grid { gap: var(--esp-3) var(--esp-4); }
.filtros .form-actions { margin-top: var(--esp-3); }
.filtros > summary {
  display: flex; align-items: center; gap: var(--esp-2); min-height: var(--objetivo-tactil);
  cursor: pointer; font-weight: 700; color: var(--color-texto); list-style: none;
}
.filtros > summary::-webkit-details-marker { display: none; }
.filtros > summary::before {
  content: ""; flex: none; width: .55rem; height: .55rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s ease;
}
.filtros[open] > summary::before { transform: rotate(45deg); }
.filtros > summary:focus-visible { outline: 2px solid var(--color-primario); outline-offset: 2px; }
.filtros[open] > summary { margin-bottom: var(--esp-3); }
.filtros__count {
  margin-left: auto; padding: .1rem .55rem; border-radius: var(--radio);
  background: var(--color-primario-suave); color: var(--color-primario-texto);
  font-size: var(--texto-sm); font-weight: 650;
}
.descripcion { white-space: pre-wrap; }
.galeria { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: var(--esp-3); max-width: none; }
.galeria li { display: flex; flex-direction: column; gap: var(--esp-1); }
.galeria img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: var(--borde); border-radius: var(--radio); background: var(--color-fondo-alt); }
.comentarios, .historial { list-style: none; margin: 0 0 var(--esp-4); padding: 0; display: flex; flex-direction: column; gap: var(--esp-3); max-width: none; }
.comentarios li { border: var(--borde); border-radius: var(--radio); padding: var(--esp-3); background: var(--color-fondo-alt); }
.comentarios p { margin: var(--esp-1) 0 0; white-space: pre-wrap; }
.historial li { display: flex; flex-direction: column; gap: 2px; border-bottom: var(--borde); padding-bottom: var(--esp-2); }
.historial li:last-child { border-bottom: 0; padding-bottom: 0; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--esp-3); flex-wrap: wrap; margin-top: var(--esp-3); }
.is-disabled { opacity: .55; pointer-events: none; }

/* Cambio rápido de estado: solo el estado actual va coloreado; las acciones
   disponibles usan el estilo neutro. */
.estado-panel { padding: var(--esp-3) var(--esp-4); margin-bottom: var(--esp-4); }
.estado-barra { display: flex; align-items: center; flex-wrap: wrap; gap: var(--esp-2); }
.estado-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-texto-suave); margin-right: var(--esp-1); }
.estado-sep { color: var(--color-texto-suave); font-weight: 700; }
.estado-form { display: inline-flex; margin: 0; padding: 0; }
.estado-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--objetivo-tactil); padding: var(--esp-1) var(--esp-3);
  border: 2px solid transparent; border-radius: var(--radio);
  font-size: var(--texto-sm); font-weight: 700; line-height: 1.2; text-decoration: none;
  background: var(--color-fondo-alt); color: var(--color-texto); box-shadow: none;
}
.estado-btn--next { background: var(--color-fondo); color: var(--color-texto); border-color: var(--color-borde-fuerte); }
.estado-btn.is-current { cursor: default; box-shadow: 0 0 0 2px var(--color-texto); }
button.estado-btn { cursor: pointer; }
button.estado-btn:hover { filter: brightness(.94); }
.estado-btn--new { background: var(--color-info-fondo); color: var(--color-info); border-color: color-mix(in srgb, var(--color-info) 45%, #fff); }
.estado-btn--in_review { background: var(--color-aviso-fondo); color: var(--color-aviso); border-color: color-mix(in srgb, var(--color-aviso) 45%, #fff); }
.estado-btn--assigned { background: var(--color-primario-suave); color: var(--color-primario); border-color: color-mix(in srgb, var(--color-primario) 45%, #fff); }
.estado-btn--in_progress { background: #fde8d7; color: #7a3e00; border-color: #c98a4b; }
.estado-btn--resolved { background: var(--color-exito-fondo); color: var(--color-exito); border-color: color-mix(in srgb, var(--color-exito) 45%, #fff); }
.estado-btn--closed { background: var(--color-fondo-alt); color: var(--color-texto-suave); border-color: var(--color-borde-fuerte); }
.estado-btn--rejected { background: var(--color-error-fondo); color: var(--color-error); border-color: color-mix(in srgb, var(--color-error) 45%, #fff); }
.estado-btn--cancelled { background: var(--color-error-fondo); color: var(--color-error); border-color: color-mix(in srgb, var(--color-error) 45%, #fff); }
.estado-btn--reopened { background: #efe6fa; color: #4b2a7a; border-color: #9a7cc0; }

@media (min-width: 981px) and (max-height: 900px) {
  .auth-brand { justify-content: flex-start; padding-block: var(--esp-5); gap: var(--esp-3); }
  .auth-points { margin-top: 0; }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--esp-2); padding: var(--esp-3) var(--esp-4); border-right: 0; border-bottom: 1px solid var(--chrome-linea); }
  .sidebar__brand { flex: 1 1 15rem; border: 0; padding: 0; }
  .sidebar-nav { flex: 1 1 100%; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: var(--esp-1); overflow-x: auto; min-width: 0; }
  .nav-group { display: none; }
  .sidebar-nav ul { flex-direction: row; flex-wrap: nowrap; }
  .sidebar-nav .nav-sub { flex-direction: row; padding-left: 0; }
  .sidebar-nav .nav-sub a { min-height: var(--objetivo-tactil); font-size: inherit; }
  .sidebar-nav li.nav-with-sub { display: flex; align-items: center; }
  .sidebar-nav li.nav-with-sub > a { padding-right: var(--esp-2); }
  .sidebar-nav .nav-sub-details { display: flex; align-items: center; }
  .sidebar-nav .nav-sub-toggle { position: static; width: auto; height: auto; padding: var(--esp-1); }
  .sidebar-nav a { padding: var(--esp-1) var(--esp-2); white-space: nowrap; }
  .sidebar__footer { flex: 0 1 auto; border: 0; padding: 0; flex-direction: row; align-items: center; }
  .sidebar-user__text { display: none; }
  .sidebar-logout { width: auto; }
  .notices { top: var(--esp-4); left: var(--esp-4); right: var(--esp-4); width: auto; }
  .contenido { padding: var(--esp-4); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .two-col { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: var(--esp-6) var(--esp-5); }
}
@media (max-width: 620px) {
  .form-grid, .permission-grid, .quick-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .pie__interior { flex-direction: column; }
  .auth-panel { padding: var(--esp-4); }
  .auth-card { padding: var(--esp-5); }
}

/* Preferencias del usuario */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .auth-decor, .auth-decor__piece { animation: none !important; }
}
@media (prefers-contrast: more) {
  :root { --color-borde: #1a1d21; --color-texto-suave: #1a1d21; --chrome-linea: color-mix(in srgb, var(--chrome-texto) 55%, transparent); --chrome-texto-suave: var(--chrome-texto); }
  .btn, .button, button, input, select, textarea { border-width: 3px; }
}
@media (forced-colors: active) {
  .btn, .button, .aviso, .tarjeta, .panel { border: 2px solid CanvasText; }
  :focus-visible { outline: 3px solid Highlight; box-shadow: none; }
}

/* Impresión */
@media print {
  :root { --color-texto: #000; --color-fondo: #fff; --color-fondo-alt: #fff; }
  body { font-size: 12pt; line-height: 1.4; }
  .sidebar, .pie, .saltar-contenido, .btn, .button, .no-imprimir, .notices { display: none !important; }
  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; word-break: break-all; }
  h1, h2, h3 { break-after: avoid; }
  table, figure, blockquote { break-inside: avoid; }
  thead th { background: #fff; color: #000; border-bottom: 2px solid #000; }
}

/* Selector de idioma */
.lang-select { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.lang-select select { width: auto; min-width: 8.5rem; padding: 0.15rem 0.45rem; font-size: var(--texto-sm); }
.lang-select--compact select { border: 0; background: transparent; color: var(--color-texto-suave); font-size: var(--texto-sm); font-weight: 700; letter-spacing: 0.06em; padding: 0.1rem 0.1rem; min-width: 0; width: auto; cursor: pointer; }
.lang-select--compact select:hover { color: var(--color-primario-texto); }
.lang-select--compact select:focus-visible { outline: 2px solid var(--color-primario); outline-offset: 2px; }
.auth-panel .lang-select { flex: 0 0 auto; width: 100%; justify-content: flex-end; }
.chip--check { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.chip--check input { margin: 0; }
.chip[aria-current="true"] { background: var(--color-primario); border-color: var(--color-primario); color: var(--color-sobre-primario); }

/* Residuos · contenedores y apertura NFC simulada */
.waste-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--esp-3); margin-bottom: var(--esp-4); }
.waste-card { background: var(--color-fondo); border: var(--borde); border-radius: var(--radio-lg); padding: var(--esp-4); box-shadow: var(--sombra); display: flex; flex-direction: column; gap: var(--esp-3); }
.waste-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--esp-3); }
.waste-card__head h2 { margin: var(--esp-1) 0 0; font-size: var(--h4); }
.waste-card .grid { margin: 0; }
.waste-card .form-actions { margin-top: auto; }
.waste-card .mono { background: transparent; padding: 0; }
.waste-sim { display: grid; grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr); gap: var(--esp-4); align-items: start; }
.waste-sim__phone { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: var(--esp-4); }
.waste-phone { position: relative; width: 190px; margin: 0 auto; padding: var(--esp-3); background: #1a1d21; border-radius: var(--radio-lg); border: 2px solid #3b3f46; }
.waste-phone__screen { position: relative; z-index: 2; min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--esp-2); background: linear-gradient(160deg, color-mix(in srgb, var(--color-primario) 88%, #000), color-mix(in srgb, var(--color-primario) 55%, #000)); color: var(--color-sobre-primario); border-radius: var(--radio); padding: var(--esp-3); text-align: center; }
.waste-phone__brand { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .78; }
.waste-phone__nfc svg { width: 46px; height: 46px; }
.waste-phone__label { font-weight: 700; }
.waste-phone__hint { font-size: 11px; line-height: 1.35; opacity: .82; }
.waste-phone__wave { position: absolute; left: 50%; top: 50%; width: 190px; height: 190px; margin: -95px 0 0 -95px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--color-primario) 55%, #fff); animation: waste-wave 2.8s ease-out infinite; z-index: 1; }
.waste-phone__wave--2 { animation-delay: .9s; }
.waste-phone__wave--3 { animation-delay: 1.8s; }
@keyframes waste-wave { 0% { transform: scale(.72); opacity: .65; } 70% { opacity: 0; } 100% { transform: scale(1.45); opacity: 0; } }
.waste-sim__button { width: 100%; }
.waste-result { border: var(--borde); border-radius: var(--radio-lg); padding: var(--esp-4); background: var(--color-fondo-alt); }
.waste-result--ok { border-color: color-mix(in srgb, var(--color-exito) 40%, var(--color-borde)); background: var(--color-exito-fondo); }
.waste-result--bad { border-color: color-mix(in srgb, var(--color-error) 35%, var(--color-borde)); background: var(--color-error-fondo); }
.waste-result h3 { margin-top: var(--esp-2); }
.waste-result .grid { margin-bottom: 0; }
.waste-legend { margin-top: var(--esp-4); }
.waste-legend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--esp-2); }
.waste-legend li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--esp-2); font-size: var(--texto-sm); }
.waste-payload { margin-top: var(--esp-4); }
.waste-payload pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--color-fondo-alt); border: var(--borde); border-radius: var(--radio); padding: var(--esp-3); }
@media (max-width: 980px) {
  .waste-grid, .waste-sim { grid-template-columns: 1fr; }
}
.waste-admin summary { cursor: pointer; font-weight: 700; color: var(--color-primario-texto); min-height: var(--objetivo-tactil); display: flex; align-items: center; }
.waste-admin summary:focus-visible { outline: 2px solid var(--color-primario); outline-offset: 2px; }
.waste-admin[open] summary { margin-bottom: var(--esp-3); }
html.js .waste-admin--on-demand:not([open]) { display: none; }


/* Login móvil: una sola sección, sin panel de marca duplicado. */
.auth-demo-mobile { display: none; }
@media (max-width: 760px) {
  .auth-shell { display: block; min-height: 100dvh; }
  .auth-brand { display: none; }
  .auth-panel {
    min-height: 100dvh;
    padding: calc(var(--esp-4) + env(safe-area-inset-top)) var(--esp-4) calc(var(--esp-4) + env(safe-area-inset-bottom));
    justify-content: flex-start;
    overflow-y: auto;
  }
  .auth-panel__inner { max-width: 29rem; gap: var(--esp-3); }
  .auth-card { padding: var(--esp-5); }
  .auth-logo { width: 9rem; }
  .auth-card h2 { font-size: var(--h3); }
  .auth-demo-mobile { display: block; border-top: var(--borde); padding-top: var(--esp-3); }
  .auth-demo-mobile summary { cursor: pointer; font-weight: 700; color: var(--color-primario-texto); min-height: var(--objetivo-tactil); display: flex; align-items: center; }
  .auth-demo-mobile p { margin: var(--esp-1) 0 var(--esp-2); font-size: var(--texto-sm); }
  .auth-demo-mobile__list { display: flex; flex-wrap: wrap; gap: var(--esp-2); }
}

/* Incidencias en vivo */
.live-status { display: inline-flex; align-items: center; gap: 0.45rem; }
.live-status::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--color-texto-suave); flex: none; }
.live-status[data-state="live"]::before { background: var(--color-exito); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-exito) 18%, transparent); }
.live-status[data-state="connecting"]::before,
.live-status[data-state="polling"]::before,
.live-status[data-state="reconnecting"]::before { background: var(--color-aviso); }
.live-status[data-state="offline"]::before { background: var(--color-error); }
tr.is-new { animation: incident-new 5s ease-out; }
@keyframes incident-new {
  0% { background: color-mix(in srgb, var(--color-exito-fondo) 85%, #fff); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  tr.is-new { animation: none; background: var(--color-exito-fondo); }
}
