:root {
  --tinta: #1C2430;
  --tinta-suave: #5A6573;
  --papel: #FFFFFF;
  --fondo: #EEF1F4;
  --linea: #D5DBE1;
  --accion: #0F5E6B;
  --accion-hover: #0B4A55;
  --filamento: #E8A317;
  --error: #B3261E;
  --ok: #2E7D4F;
  --radio: 6px;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--tinta);
  background: var(--fondo);
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 600; }
h2 { font-size: 1.45rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
.sutil { color: var(--tinta-suave); font-size: .9rem; margin: .25rem 0; }
.error { color: var(--error); margin: 0; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--tinta-suave); }
input, select {
  font: inherit; color: var(--tinta); background: var(--papel);
  border: 1px solid var(--linea); border-radius: var(--radio); padding: .45rem .6rem;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--filamento); outline-offset: 1px;
}

button, .boton {
  font: inherit; cursor: pointer; border-radius: var(--radio); padding: .5rem .95rem;
  border: 1px solid transparent; text-decoration: none; display: inline-block; white-space: nowrap;
}
button:disabled, .boton[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.primario { background: var(--accion); color: #fff; font-weight: 600; }
.primario:hover { background: var(--accion-hover); }
.secundario { background: var(--papel); color: var(--accion); border-color: var(--linea); }
.secundario:hover { border-color: var(--accion); }
.enlace { background: none; border: 0; padding: .2rem .3rem; color: var(--tinta-suave); text-decoration: underline; }
.peligro { color: var(--error); }
.ancho { width: 100%; }
.fila { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-caja {
  width: min(380px, 100%); background: var(--papel); border-radius: 10px;
  padding: 2rem; display: flex; flex-direction: column; gap: .9rem;
  border-top: 4px solid var(--filamento);
}
.login-logo { align-self: flex-start; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.lateral {
  background: var(--tinta); color: #E7EBEF; padding: 1rem; display: flex;
  flex-direction: column; gap: .9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.lateral label { color: #AEB8C3; }
.lateral .sutil { color: #AEB8C3; }
.lateral .enlace { color: #AEB8C3; }
.marca { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: 1.05rem; }
.marca .enlace { margin-left: auto; font-weight: 400; font-size: .85rem; }
.nueva { display: flex; flex-direction: column; gap: .6rem; background: #273140; padding: .8rem; border-radius: var(--radio); }
.nueva .secundario { background: transparent; color: #E7EBEF; border-color: #4A5566; }

.ofertas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ofertas button {
  width: 100%; text-align: left; background: transparent; color: inherit; padding: .55rem .65rem;
  display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; border-radius: var(--radio);
}
.ofertas button:hover { background: #273140; }
.ofertas button[aria-current="true"] { background: #31405A; }
.ofertas .nom { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ofertas .meta { grid-column: 1 / -1; font-size: .8rem; color: #AEB8C3; }
.punto { width: .6rem; height: .6rem; border-radius: 50%; align-self: center; background: #4A5566; }
.punto.done { background: var(--ok); }
.punto.error { background: var(--error); }
.punto.running, .punto.queued { background: var(--filamento); }

.ajustes { margin-top: auto; border-top: 1px solid #364254; padding-top: .7rem; }
.ajustes summary { cursor: pointer; font-size: .9rem; }
.ajustes form { display: flex; flex-direction: column; gap: .6rem; margin-top: .6rem; }
.ajustes .secundario { background: transparent; color: #E7EBEF; border-color: #4A5566; }

.principal { padding: 1.5rem 2rem 3rem; min-width: 0; }
.vacio-grande { height: 60vh; display: grid; place-items: center; color: var(--tinta-suave); }
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ficha { display: flex; gap: .75rem; align-items: flex-end; margin: 1rem 0 1.5rem; flex-wrap: wrap; }
.ficha .crece { flex: 1 1 260px; }
.bloque { background: var(--papel); border-radius: 10px; padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.bloque h3 { margin-bottom: .6rem; }

.pdfs { list-style: none; margin: 0 0 .8rem; padding: 0; }
.pdfs li { display: flex; justify-content: space-between; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--fondo); }
.zona {
  border: 2px dashed var(--linea); border-radius: var(--radio); padding: 1.1rem; text-align: center;
  color: var(--tinta-suave); cursor: pointer; font-size: .95rem;
}
.zona input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.zona.encima, .zona:focus-within { border-color: var(--accion); color: var(--accion); }

/* The one memorable moment: while claude reads the PDFs the panel glows like a warming filament. */
.proceso {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
  padding: 1rem 1.25rem; border-radius: 10px; background: var(--papel); border-left: 4px solid var(--linea);
}
.proceso.trabajando { border-left-color: var(--filamento); animation: filamento 2.4s ease-in-out infinite; }
.proceso.ok { border-left-color: var(--ok); }
.proceso.fallo { border-left-color: var(--error); }
.proceso p { margin: 0; }
@keyframes filamento {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 163, 23, 0); }
  50% { box-shadow: 0 0 22px 2px rgba(232, 163, 23, .45); }
}
@media (prefers-reduced-motion: reduce) {
  .proceso.trabajando { animation: none; box-shadow: 0 0 0 2px rgba(232, 163, 23, .5); }
}

.tabla-scroll { overflow-x: auto; margin-top: .6rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--tinta-suave); padding: .4rem .35rem; border-bottom: 2px solid var(--linea); white-space: nowrap; }
td { border-bottom: 1px solid var(--fondo); padding: 1px; vertical-align: top; }
th.num { text-align: right; }
td input { width: 100%; border-color: transparent; background: transparent; padding: .35rem; min-width: 6rem; }
td input:hover { border-color: var(--linea); }
td input:focus { background: #FFF8E6; border-color: var(--filamento); outline: none; }
td.num input { text-align: right; min-width: 5rem; }
td.desc input { min-width: 26rem; }
td.enlace input { min-width: 7rem; }
th.desc { width: 40%; }
td.foto { text-align: center; padding-top: .4rem; color: var(--ok); }
tr.cambiada td { background: #FFFBF0; }

.aviso {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); max-width: min(560px, 92vw);
  background: var(--tinta); color: #fff; padding: .75rem 1.1rem; border-radius: var(--radio); z-index: 10;
}
.aviso.fallo { background: var(--error); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; }
  .ajustes { margin-top: 0; }
  .principal { padding: 1rem; }
}
