/* Solutios.Copias — panel. Mobile-first, sin librerías. */

:root {
  --fondo: #f4f5f7;
  --superficie: #ffffff;
  --superficie-2: #f8f9fb;
  --texto: #1b1f24;
  --texto-suave: #5b6470;
  --borde: #e2e5ea;
  --acento: #1f5fbf;
  --acento-texto: #ffffff;

  --verde: #1d7a46;
  --verde-fondo: #e3f4ea;
  --ambar: #9a5b00;
  --ambar-fondo: #fdf0d9;
  --rojo: #b42318;
  --rojo-fondo: #fde7e5;
  --gris: #6b7280;
  --gris-fondo: #eceef1;

  --radio: 10px;
  --sombra: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0f1216;
    --superficie: #181c22;
    --superficie-2: #1e232a;
    --texto: #e7eaee;
    --texto-suave: #9aa3ae;
    --borde: #2b313a;
    --acento: #6ea2ff;
    --acento-texto: #0f1216;

    --verde: #4cc38a;
    --verde-fondo: #173226;
    --ambar: #f0b35a;
    --ambar-fondo: #3a2c14;
    --rojo: #ff8a80;
    --rojo-fondo: #3d1b19;
    --gris: #9aa3ae;
    --gris-fondo: #252a31;

    --sombra: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.45 var(--fuente);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 1.75rem 0 .6rem; }
p { margin: .4rem 0; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.suave { color: var(--texto-suave); }
.pequeno { font-size: .85rem; }

/* Cabecera y navegación */
.cabecera {
  position: sticky; top: 0; z-index: 10;
  background: var(--superficie);
  border-bottom: 1px solid var(--borde);
}
.cabecera-dentro {
  max-width: 1100px; margin: 0 auto; padding: .6rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.marca { font-weight: 700; color: var(--texto); letter-spacing: -.01em; }
.marca span { color: var(--texto-suave); font-weight: 500; }
.nav { display: flex; gap: .25rem; width: 100%; justify-content: space-between; }
.nav a {
  padding: .4rem .7rem; border-radius: 8px; color: var(--texto-suave); font-weight: 500;
}
.nav a:hover { text-decoration: none; background: var(--superficie-2); }
.nav a[aria-current="page"] { color: var(--texto); background: var(--superficie-2); }

main { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.titulo { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* Estado: punto de color + texto */
.estado {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .15rem .55rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; white-space: nowrap;
}
.estado::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.estado.verde { color: var(--verde); background: var(--verde-fondo); }
.estado.ambar { color: var(--ambar); background: var(--ambar-fondo); }
.estado.rojo  { color: var(--rojo);  background: var(--rojo-fondo); }
.estado.gris  { color: var(--gris);  background: var(--gris-fondo); }

/* Resumen de la portada */
.resumen { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.cifra {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: .6rem .75rem; box-shadow: var(--sombra);
}
.cifra b { display: block; font-size: 1.5rem; line-height: 1.1; }
.cifra.rojo b { color: var(--rojo); }
.cifra.ambar b { color: var(--ambar); }
.cifra.verde b { color: var(--verde); }
.cifra span { font-size: .8rem; color: var(--texto-suave); }

/* Listas de tarjetas (móvil) que pasan a filas en pantallas anchas */
.lista { display: grid; gap: .5rem; }
.tarjeta {
  display: block; position: relative;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: .75rem .9rem .75rem 1.1rem; box-shadow: var(--sombra); color: inherit;
}
a.tarjeta:hover { text-decoration: none; border-color: var(--acento); }
.tarjeta::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  border-radius: var(--radio) 0 0 var(--radio); background: var(--gris);
}
.tarjeta.verde::before { background: var(--verde); }
.tarjeta.ambar::before { background: var(--ambar); }
.tarjeta.rojo::before  { background: var(--rojo); }
.tarjeta-cabeza { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.tarjeta-nombre { font-weight: 650; }
.datos { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .35rem; font-size: .88rem; color: var(--texto-suave); }
.datos b { color: var(--texto); font-weight: 600; }

/* Tablas (historial, alertas en escritorio) */
.tabla-envoltorio { overflow-x: auto; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-suave); font-weight: 600; background: var(--superficie-2); }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Tareas dentro de la ficha */
details.tarea { margin-top: .5rem; }
details.tarea > summary { cursor: pointer; font-size: .88rem; color: var(--acento); }
details.tarea[open] > summary { margin-bottom: .5rem; }
.acciones { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }

/* Formularios */
form.formulario { display: grid; gap: 1rem; max-width: 34rem; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; }
label .ayuda { font-weight: 400; color: var(--texto-suave); font-size: .82rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], select, textarea {
  font: inherit; color: inherit; background: var(--superficie);
  border: 1px solid var(--borde); border-radius: 8px; padding: .55rem .7rem; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--acento); outline-offset: 2px;
}
label.casilla { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
label.casilla input { width: 1.1rem; height: 1.1rem; }
.en-linea { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.en-linea > * { flex: 1 1 10rem; }

button, .boton {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--borde); background: var(--superficie); color: var(--texto);
  border-radius: 8px; padding: .5rem .9rem; display: inline-block;
}
button:hover, .boton:hover { text-decoration: none; background: var(--superficie-2); }
button.principal, .boton.principal { background: var(--acento); border-color: var(--acento); color: var(--acento-texto); }
button.peligro { color: var(--rojo); border-color: var(--rojo); }
button.pequeno, .boton.pequeno { padding: .3rem .6rem; font-size: .85rem; }

.aviso {
  border-radius: var(--radio); padding: .75rem 1rem; margin-bottom: 1rem;
  background: var(--ambar-fondo); color: var(--texto); border: 1px solid var(--ambar);
}
.aviso.ok { background: var(--verde-fondo); border-color: var(--verde); }
.aviso.error { background: var(--rojo-fondo); border-color: var(--rojo); }
.clave {
  display: block; font-family: var(--mono); font-size: .9rem; word-break: break-all;
  background: var(--superficie); border: 1px dashed var(--borde); border-radius: 8px; padding: .6rem; margin: .5rem 0;
}
.errores { color: var(--rojo); font-size: .85rem; font-weight: 500; }
.vista-previa { font-size: .88rem; margin: 0; padding-left: 1.2rem; }
.vacio { padding: 1.5rem; text-align: center; color: var(--texto-suave); background: var(--superficie); border: 1px dashed var(--borde); border-radius: var(--radio); }

.filtros { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filtros select, .filtros input { width: auto; min-width: 12rem; }

.htmx-request .indicador { opacity: 1; }
.indicador { opacity: 0; transition: opacity .2s; }

@media (min-width: 720px) {
  h1 { font-size: 1.6rem; }
  .resumen { grid-template-columns: repeat(4, 1fr); max-width: 44rem; }
  .nav { width: auto; margin-left: auto; justify-content: flex-start; }
}
[x-cloak] { display: none !important; }
.texto-ambar { color: var(--ambar); font-weight: 600; }
.texto-rojo { color: var(--rojo); cursor: pointer; }
.cuenta {
  margin-left: auto; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .85rem; color: var(--texto-suave);
}
.cuenta[aria-current="page"] { color: var(--texto); }
.acceso { max-width: 24rem; margin: 2rem auto 0; }
.acceso .formulario { margin-top: 1rem; }
.qr { display: block; margin: 1rem auto; background: #fff; padding: 8px; border-radius: 8px; width: 200px; height: auto; }
@media (min-width: 720px) {
  .cuenta { order: 2; margin-left: 1rem; max-width: 16rem; }
}
.codigos { white-space: pre; columns: 2; column-gap: 1.5rem; font-size: 1rem; line-height: 1.7; }
@media print {
  .cabecera, .acciones, .boton { display: none; }
}
.texto-verde { color: var(--verde); }
.resultado-mal { color: var(--rojo); background: var(--rojo-fondo); padding: 0 .35rem; border-radius: 4px; }
.lado-derecho { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; flex-shrink: 0; }
