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

/* El atributo hidden es display:none por defecto (regla del navegador),
   pero cualquier clase de componente que fije display:flex/grid/block sobre
   ESE MISMO elemento la pisa (una regla de autor siempre gana a la del
   navegador, con independencia de la especificidad) — por eso .dropdown-menu
   y #more-filters (ambos con display:flex propio) se quedaban visibles pese
   a hidden. Esta regla global reafirma que hidden siempre gana, para que
   ningún componente futuro vuelva a toparse con el mismo bug. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-alt);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0 0 var(--space-3);
  font-weight: 600;
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--brand-primary);
}

label {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}

input,
select,
textarea {
  font: inherit;
  color: inherit;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  width: 100%;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-alt);
  color: var(--text-primary);
}

button.primary {
  background: var(--brand-primary);
  color: var(--text-inverse);
}

button.primary:hover:not(:disabled) {
  background: var(--brand-primary-hover);
}

button.danger {
  background: var(--danger-surface);
  color: var(--danger);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Paso 8.73: accesibilidad mínima desde ya — foco siempre visible, nunca
   solo color para distinguir estado. */
:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--surface-border);
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

dialog {
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
  max-width: 420px;
  width: 90%;
}

dialog::backdrop {
  background: rgba(31, 41, 51, 0.45);
}

/* Paso 8.76: región compartida de notificaciones, siempre presente en el
   DOM (aunque vacía) para que aria-live funcione desde el primer toast. */
#toast-region {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 1000;
  max-width: 360px;
}
