/* Estilos propios de RepairPro: celular primero, sin dependencias ni paso de compilación. */
:root {
  --fondo: #f4f5f7;
  --superficie: #ffffff;
  --texto: #1b1f24;
  --texto-suave: #57606a;
  --borde: #c9ced6;
  --acento: #0b5cd5;
  --acento-texto: #ffffff;
  --error-fondo: #fdecec;
  --error-texto: #8a1c1c;
  --exito-fondo: #e6f4ea;
  --exito-texto: #1d5a2e;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #14171b;
    --superficie: #1e2329;
    --texto: #e8ebef;
    --texto-suave: #a7b0ba;
    --borde: #3a424c;
    --acento: #5b9bff;
    --acento-texto: #0b1220;
    --error-fondo: #3a1d1d;
    --error-texto: #ffb4b4;
    --exito-fondo: #17301f;
    --exito-texto: #a8e0b5;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.barra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.5rem 1rem;
  background: var(--superficie);
  border-bottom: 1px solid var(--borde);
}

.marca { font-weight: 700; color: var(--texto); text-decoration: none; }

.barra-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.barra-acciones form { margin: 0; }

a { color: var(--acento); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--acento);
  outline-offset: 2px;
}

.contenido { max-width: 40rem; margin: 0 auto; padding: 1rem; }
.contenido > .tarjeta + .tarjeta, .contenido > .aviso + .tarjeta, .contenido > p + .tarjeta { margin-top: 1rem; }

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

h1 { margin: 0 0 1rem; font-size: 1.4rem; }

label { display: block; margin: 1rem 0 0.25rem; font-weight: 600; }

input[type="text"], input[type="password"], input[type="search"], input[type="url"],
select, textarea {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--texto);
  background: var(--fondo);
  border: 1px solid var(--borde);
  border-radius: 0.5rem;
}

.boton {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  margin-top: 1.25rem;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--acento-texto);
  background: var(--acento);
  border: 1px solid var(--acento);
  border-radius: 0.5rem;
  cursor: pointer;
}

.boton:disabled { opacity: 0.6; cursor: progress; }

.boton-secundario {
  width: auto;
  margin: 0;
  color: var(--texto);
  background: transparent;
  border-color: var(--borde);
}

.enlace-cancelar { display: inline-block; margin-top: 1rem; padding: 0.5rem 0; }

.ayuda { margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--texto-suave); }

.aviso { margin: 0 0 1rem; padding: 0.75rem 1rem; border-radius: 0.5rem; }
.aviso ul { margin: 0; padding-left: 1.25rem; }
.aviso p { margin: 0; }
.aviso-error { color: var(--error-texto); background: var(--error-fondo); }
.aviso-exito { color: var(--exito-texto); background: var(--exito-fondo); }

/* ---------- Biblioteca (U3) ---------- */
h2 { margin: 0 0 0.75rem; font-size: 1.15rem; }

textarea { resize: vertical; }
input[type="file"] { display: block; width: 100%; padding: 0.5rem 0; font: inherit; }

fieldset { margin: 1rem 0 0; padding: 0; border: 0; }
legend { padding: 0; font-weight: 600; }

.casilla { display: flex; align-items: center; gap: 0.5rem; margin: 0.75rem 0 0; min-height: 2.75rem; font-weight: 400; }
.casilla input { width: 1.25rem; height: 1.25rem; }

.encabezado-seccion { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.encabezado-seccion h1 { margin: 0; }

.boton-compacto { display: inline-flex; align-items: center; justify-content: center; width: auto; margin-top: 0; text-decoration: none; }
a.boton { text-align: center; text-decoration: none; }
.boton-peligro { color: #ffffff; background: #b3261e; border-color: #b3261e; }
.acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.acciones form { margin: 0; }

.resultados, .archivos { margin: 1rem 0 0; padding: 0; list-style: none; }
.resultados li + li, .archivos li + li { margin-top: 0.5rem; }
.resultado {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--texto);
  text-decoration: none;
  background: var(--fondo);
  border: 1px solid var(--borde);
  border-radius: 0.5rem;
}
.resultado:hover { border-color: var(--acento); }
.resultado-titulo { display: block; font-weight: 600; }
.resultado-detalle, .resultado-chips { display: block; font-size: 0.875rem; color: var(--texto-suave); }

.archivos li { padding: 0.75rem 1rem; background: var(--fondo); border: 1px solid var(--borde); border-radius: 0.5rem; }
.archivo-titulo { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; overflow-wrap: anywhere; }
.archivo-nota { margin-top: 0.25rem; overflow-wrap: anywhere; }
.etiqueta { padding: 0.1rem 0.5rem; font-size: 0.75rem; color: var(--texto-suave); border: 1px solid var(--borde); border-radius: 999px; }

.insignia { display: inline-block; margin-left: 0.5rem; padding: 0.1rem 0.6rem; font-size: 0.75rem; font-weight: 600; color: var(--texto-suave); border: 1px solid var(--borde); border-radius: 999px; vertical-align: middle; }

.datos { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0; }
.datos dt { font-weight: 600; color: var(--texto-suave); }
.datos dd { margin: 0; overflow-wrap: anywhere; }
.datos dd.notas { white-space: pre-wrap; }

.paginacion { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.paginacion a { padding: 0.5rem 0; }

.vacio { margin-top: 1rem; padding: 1rem; text-align: center; border: 1px dashed var(--borde); border-radius: 0.5rem; }

.error-campo { margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--error-texto); }
[aria-invalid="true"] { border-color: var(--error-texto); }

/* ---------- Casos (U5) ---------- */
.estados { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.estado-enlace {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.75rem; padding: 0 0.85rem;
  color: var(--texto); text-decoration: none; border: 1px solid var(--borde); border-radius: 999px;
}
.estado-actual { color: var(--acento-texto); background: var(--acento); border-color: var(--acento); }
.cantidad { font-size: 0.8rem; opacity: 0.85; }
.filtros { margin: 0.75rem 0 0; font-size: 0.9rem; }

/* Insignias de estado: el color acompaña al texto, nunca lo reemplaza */
.estado-recibido { color: #0b4a9e; border-color: #0b4a9e; }
.estado-diagnosticando { color: #7a4b00; border-color: #7a4b00; }
.estado-esperando-repuesto { color: #6a2a8f; border-color: #6a2a8f; }
.estado-reparado { color: #1d5a2e; border-color: #1d5a2e; }
.estado-entregado { color: var(--texto-suave); }
@media (prefers-color-scheme: dark) {
  .estado-recibido { color: #9cc2ff; border-color: #9cc2ff; }
  .estado-diagnosticando { color: #ffd08a; border-color: #ffd08a; }
  .estado-esperando-repuesto { color: #dcb6f5; border-color: #dcb6f5; }
  .estado-reparado { color: #a8e0b5; border-color: #a8e0b5; }
}

.checklist, .historial { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.checklist-item { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.checklist-item input[type="checkbox"] { flex: none; width: 1.5rem; height: 1.5rem; }
.checklist-item input[type="text"] { flex: 1 1 auto; min-width: 0; }
.casilla-quitar { display: flex; flex: none; align-items: center; gap: 0.25rem; margin: 0; font-weight: 400; }
.historial li + li { margin-top: 0.25rem; }

.etiqueta-impresa { text-align: center; }
.etiqueta-codigo { margin: 0; font-size: 3rem; font-weight: 700; letter-spacing: 0.1em; font-family: ui-monospace, monospace; }
.etiqueta-qr { display: block; max-width: 100%; height: auto; margin: 1rem auto; image-rendering: pixelated; background: #ffffff; }
.etiqueta-equipo { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }

/* Diagnóstico (U6): respuestas del árbol una por fila, grandes para el dedo (NFR6) */
.paso-texto { font-size: 1.1rem; margin: 0.75rem 0; }
.respuestas { margin: 0.5rem 0 1rem; padding: 0; list-style: none; }
.respuestas li + li { margin-top: 0.5rem; }
.boton-respuesta { display: block; width: 100%; text-align: left; padding: 0.85rem 1rem; }
.conclusion { margin: 0.75rem 0; padding: 0.75rem 1rem; border-left: 4px solid var(--acento); background: var(--fondo-suave, transparent); }
.camino { margin: 0.5rem 0; font-size: 0.9rem; }
.camino ol { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.turno { margin: 1rem 0; padding-top: 0.75rem; border-top: 1px solid var(--borde, #cccccc); }
.turno-pregunta { margin: 0 0 0.5rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.turno-respuesta { overflow-wrap: anywhere; }
.turno-respuesta p, .turno-respuesta ul, .turno-respuesta ol { margin: 0.5rem 0; }
.turno-respuesta code { font-family: ui-monospace, monospace; }
.contexto { margin: 0.5rem 0; font-size: 0.9rem; }
.voto { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

/* U7 Dashboard: accesos, periodo, rejilla de bloques y medidas (`.barra` ya es la barra de
   navegación). El ancho va por clase porque la CSP no admite estilos en línea (R14). */
.accesos { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.5rem; }
.accesos .boton { margin-top: 0; text-align: center; text-decoration: none; }
.periodos { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tablero { display: grid; gap: 1rem; margin-top: 1rem; }
.tablero h2 { margin: 0; font-size: 1.15rem; }
.ranking { margin: 0.75rem 0 0; padding: 0; list-style: none; }
.ranking li + li { margin-top: 0.5rem; }
.ranking-fila { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.75rem; align-items: center; padding: 0.5rem 0.75rem; color: var(--texto); text-decoration: none; border: 1px solid var(--borde); border-radius: 0.5rem; }
a.ranking-fila:hover { border-color: var(--acento); }
.ranking-nombre { overflow-wrap: anywhere; }
.ranking-cantidad { font-weight: 700; font-variant-numeric: tabular-nums; }
.ranking-accion { grid-column: 1 / -1; font-size: 0.9rem; }
.medida-fondo { grid-column: 1 / -1; display: block; height: 0.5rem; background: var(--fondo); border-radius: 999px; overflow: hidden; }
.medida { display: block; height: 100%; background: var(--acento); border-radius: 999px; }
.insignia-falta { color: var(--error-texto); border-color: var(--error-texto); }
.medida-0 { width: 0%; } .medida-2 { width: 2%; } .medida-4 { width: 4%; } .medida-6 { width: 6%; }
.medida-8 { width: 8%; } .medida-10 { width: 10%; } .medida-12 { width: 12%; } .medida-14 { width: 14%; }
.medida-16 { width: 16%; } .medida-18 { width: 18%; } .medida-20 { width: 20%; } .medida-22 { width: 22%; }
.medida-24 { width: 24%; } .medida-26 { width: 26%; } .medida-28 { width: 28%; } .medida-30 { width: 30%; }
.medida-32 { width: 32%; } .medida-34 { width: 34%; } .medida-36 { width: 36%; } .medida-38 { width: 38%; }
.medida-40 { width: 40%; } .medida-42 { width: 42%; } .medida-44 { width: 44%; } .medida-46 { width: 46%; }
.medida-48 { width: 48%; } .medida-50 { width: 50%; } .medida-52 { width: 52%; } .medida-54 { width: 54%; }
.medida-56 { width: 56%; } .medida-58 { width: 58%; } .medida-60 { width: 60%; } .medida-62 { width: 62%; }
.medida-64 { width: 64%; } .medida-66 { width: 66%; } .medida-68 { width: 68%; } .medida-70 { width: 70%; }
.medida-72 { width: 72%; } .medida-74 { width: 74%; } .medida-76 { width: 76%; } .medida-78 { width: 78%; }
.medida-80 { width: 80%; } .medida-82 { width: 82%; } .medida-84 { width: 84%; } .medida-86 { width: 86%; }
.medida-88 { width: 88%; } .medida-90 { width: 90%; } .medida-92 { width: 92%; } .medida-94 { width: 94%; }
.medida-96 { width: 96%; } .medida-98 { width: 98%; } .medida-100 { width: 100%; }
@media (min-width: 60rem) {
  .contenido:has(.tablero) { max-width: 64rem; }
  .tablero { grid-template-columns: 1fr 1fr; }
}

@media print {
  .barra, .no-imprimir { display: none !important; }
  body { background: #ffffff; color: #000000; }
  .contenido { max-width: none; padding: 0; }
  .etiqueta-impresa { border: 0; padding: 0; background: #ffffff; color: #000000; }
}

@media (min-width: 40rem) {
  .contenido { padding-top: 2.5rem; }
}
