:root {
  --fondo: #f6f7f9; --panel: #ffffff; --texto: #111827; --suave: #6b7280; --borde: #e5e7eb;
  --acento: #0f766e; --acento-texto: #ffffff; --acento-suave: #ccfbf1;
  --verde: #16a34a; --ambar: #d97706; --rojo: #dc2626; --gris: #9ca3af; --azul: #2563eb; --negro: #374151;
  --peligro-fondo: #fef2f2; --peligro-texto: #991b1b; --ok-fondo: #f0fdf4; --ok-texto: #166534;
  --radio: 12px; --sombra: 0 1px 2px rgb(0 0 0 / 6%), 0 1px 3px rgb(0 0 0 / 8%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0b0f14; --panel: #151b23; --texto: #e5e7eb; --suave: #9ca3af; --borde: #263040;
    --acento: #2dd4bf; --acento-texto: #042f2e; --acento-suave: #134e4a;
    --peligro-fondo: #3b1212; --peligro-texto: #fecaca; --ok-fondo: #0f2e1b; --ok-texto: #bbf7d0;
    --sombra: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--acento); }
h1 { font-size: 1.35rem; margin: 0 0 .75rem; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
small, .suave { color: var(--suave); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

.barra { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--borde); }
.marca { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--texto); text-decoration: none; }
.marca small { font-weight: 400; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--acento); color: var(--acento-texto); font-size: .8rem; }
nav { display: flex; gap: .25rem; margin-left: auto; }
nav a { padding: .4rem .7rem; border-radius: 8px; color: var(--texto); text-decoration: none; }
nav a.activo { background: var(--acento-suave); }
nav a.destacado { background: var(--acento); color: var(--acento-texto); font-weight: 600; }
.quien { width: 100%; font-size: .8rem; color: var(--suave); text-align: right; }
@media (min-width: 720px) { .quien { width: auto; } }

main { max-width: 980px; margin: 0 auto; padding: 1rem; }
.cargando { color: var(--suave); }
.panel { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; box-shadow: var(--sombra); margin-bottom: 1rem; }

form .campo { display: grid; gap: .25rem; margin-bottom: .85rem; }
label { font-weight: 600; font-size: .9rem; }
input, select, textarea { font: inherit; color: inherit; background: var(--fondo); border: 1px solid var(--borde); border-radius: 8px; padding: .6rem .7rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acento); outline-offset: 1px; }
.fila { display: grid; gap: .75rem; }
@media (min-width: 640px) { .fila { grid-template-columns: 1fr 1fr; } }

button, .boton { font: inherit; font-weight: 600; border: 1px solid var(--borde); background: var(--panel); color: var(--texto);
  border-radius: 8px; padding: .55rem .9rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; }
button.primario, .boton.primario { background: var(--acento); color: var(--acento-texto); border-color: transparent; }
button.peligro { color: var(--rojo); }
button:disabled { opacity: .5; cursor: not-allowed; }
.acciones { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; align-items: center; }
.grupo { display: inline-flex; gap: .35rem; align-items: center; }
.grupo select { width: auto; }

.filtros { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: .75rem; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.filtros button { white-space: nowrap; border-radius: 999px; padding: .35rem .8rem; font-weight: 500; }
.filtros button.activo { background: var(--acento-suave); border-color: var(--acento); }
.buscar { margin-bottom: .75rem; }

.lista { display: grid; gap: .6rem; }
.tarjeta { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center; background: var(--panel);
  border: 1px solid var(--borde); border-radius: var(--radio); padding: .8rem 1rem; text-decoration: none; color: var(--texto); box-shadow: var(--sombra); }
.tarjeta:hover { border-color: var(--acento); }
.tarjeta .titulo { font-weight: 600; }
.tarjeta .meta { font-size: .82rem; color: var(--suave); }
.dias { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.dias small { display: block; font-weight: 400; }

.semaforo { width: 12px; height: 12px; border-radius: 50%; background: var(--gris); flex: none; }
.s-verde { background: var(--verde); } .s-ambar { background: var(--ambar); } .s-rojo { background: var(--rojo); }
.s-gris { background: var(--gris); } .s-negro { background: var(--negro); } .s-azul { background: var(--azul); }

.etiqueta { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; margin: .15rem .25rem 0 0;
  background: var(--acento-suave); color: var(--texto); }
.etiqueta.alerta { background: #fef3c7; color: #92400e; }
@media (prefers-color-scheme: dark) { .etiqueta.alerta { background: #422006; color: #fde68a; } }

.datos { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.datos dt { color: var(--suave); }
.datos dd { margin: 0; overflow-wrap: anywhere; }

.codigo-grande { font: 700 1.7rem/1.2 ui-monospace, Consolas, monospace; letter-spacing: .06em; padding: .7rem 1rem; border-radius: 10px;
  background: var(--acento-suave); display: inline-block; margin: .25rem 0; user-select: all; }
.caja-ok { background: var(--ok-fondo); color: var(--ok-texto); border-radius: var(--radio); padding: .8rem 1rem; }
.caja-error { background: var(--peligro-fondo); color: var(--peligro-texto); border-radius: var(--radio); padding: .8rem 1rem; }
.enlace { font-size: .8rem; overflow-wrap: anywhere; color: var(--suave); }

.bitacora { list-style: none; padding: 0; margin: 0; }
.bitacora li { display: grid; grid-template-columns: 9.5rem 1fr; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--borde); font-size: .88rem; }
.bitacora .cuando { color: var(--suave); font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { color: var(--suave); font-weight: 600; }
.tabla { overflow-x: auto; }

.aviso { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); max-width: calc(100% - 2rem);
  background: var(--texto); color: var(--panel); padding: .65rem 1rem; border-radius: 10px; box-shadow: 0 4px 16px rgb(0 0 0 / 25%); z-index: 20; }
.vacio { text-align: center; color: var(--suave); padding: 2rem 1rem; }
