/* abaco — la única hoja de estilos. Sobria, legible en el celular, sin framework. */

:root {
  --fondo: #fbfaf7;
  --papel: #ffffff;
  --tinta: #1f1f1d;
  --tenue: #6b6a64;
  --linea: #e4e1d8;
  --acento: #a2461e;
  --acento-suave: #f6e6dc;
  --peligro: #8f1d1d;
  --ok: #2f6b3a;
  --mono: ui-monospace, "JetBrains Mono", "Fira Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 15px; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font-family: var(--sans);
  line-height: 1.45;
}

a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre { font-family: var(--mono); font-size: 0.92em; }

/* --- barra --- */

.barra {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.6rem 1rem;
  background: var(--papel);
  border-bottom: 1px solid var(--linea);
  flex-wrap: wrap;
}

.marca {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--tinta);
}

.barra nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.barra nav a { color: var(--tenue); padding: 0.2rem 0; border-bottom: 2px solid transparent; }
.barra nav a.activa { color: var(--tinta); border-bottom-color: var(--acento); }

main { padding: 1rem; max-width: 1400px; margin: 0 auto; }

footer {
  padding: 1.5rem 1rem;
  color: var(--tenue);
  font-size: 0.85rem;
  text-align: center;
}

/* --- títulos --- */

h1 { font-size: 1.5rem; margin: 0.5rem 0 1rem; }
h1 small, h2 small { font-size: 0.7em; color: var(--tenue); font-weight: 400; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.6rem; border-bottom: 1px solid var(--linea); padding-bottom: 0.2rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 0.5rem; }

/* --- selector de período --- */

.periodo { display: flex; gap: 0.4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.periodo a {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--linea);
  border-radius: 999px;
  background: var(--papel);
  color: var(--tenue);
}
.periodo a.activa { background: var(--acento); border-color: var(--acento); color: #fff; }

/* --- totales --- */

.totales {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}
.totales div {
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
}
.totales .valor { font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.totales .rotulo { color: var(--tenue); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* --- tablas --- */

.tabla { overflow-x: auto; background: var(--papel); border: 1px solid var(--linea); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--linea); text-align: left; vertical-align: top; white-space: nowrap; }
th { font-weight: 600; color: var(--tenue); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--fondo); }
th.grupo { text-align: center; border-left: 1px solid var(--linea); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #faf6f0; }
.n { text-align: right; font-variant-numeric: tabular-nums; }
td.vacio, li.vacio { color: var(--tenue); font-style: italic; white-space: normal; }
tr.abierta td:first-child { border-left: 3px solid var(--ok); }
.tenue { color: var(--tenue); }
table.llamadas { font-size: 0.85rem; }

/* --- ficha --- */

.ficha {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 0 0 1rem;
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 6px;
  padding: 0.8rem 1rem;
}
.ficha dt { color: var(--tenue); font-size: 0.85rem; }
.ficha dd { margin: 0; }
.prosa { white-space: pre-wrap; }

/* --- prompts --- */

.prompts { list-style: none; padding: 0; margin: 0; }
.prompts > li { margin-bottom: 1rem; padding-left: 0.8rem; border-left: 3px solid var(--acento-suave); }
.prompts .meta { color: var(--tenue); font-size: 0.85rem; margin-bottom: 0.3rem; }
pre.prompt {
  margin: 0 0 0.5rem;
  padding: 0.6rem 0.8rem;
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 20rem;
  overflow: auto;
}

/* --- formularios --- */

.filtros, .formulario {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: flex-end;
  margin: 0 0 1rem;
}
.formulario { background: var(--papel); border: 1px solid var(--linea); border-radius: 6px; padding: 0.8rem 1rem; }
.formulario.en-linea, form.en-linea { display: inline-flex; margin: 0; }
label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--tenue); }
input, select, textarea, button {
  font: inherit;
  color: var(--tinta);
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--linea);
  border-radius: 4px;
  background: #fff;
  min-width: 8rem;
}
textarea { min-width: 18rem; }
button {
  background: var(--acento);
  color: #fff;
  border-color: var(--acento);
  cursor: pointer;
  min-width: 0;
}
button:hover { filter: brightness(1.1); }
button.peligro { background: #fff; color: var(--peligro); border-color: var(--peligro); padding: 0.2rem 0.5rem; font-size: 0.85rem; }

.nota { color: var(--tenue); font-size: 0.9rem; margin: 0.2rem 0 0.8rem; }

.aviso {
  background: var(--acento-suave);
  border: 1px solid var(--acento);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
}
.aviso h2 { margin-top: 0; border: none; }

.error { max-width: 40rem; margin: 3rem auto; text-align: center; }

/* --- sesión, administración y contenido --- */

.barra form.usuario { margin-left: auto; align-items: center; gap: 0.6rem; font-size: 0.9rem; }
.login { max-width: 24rem; margin: 3rem auto; }
.formulario.vertical { flex-direction: column; align-items: stretch; }
.subnav { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; font-size: 0.95rem; }
.subnav a { color: var(--tenue); border-bottom: 2px solid transparent; }
.subnav a.activa { color: var(--tinta); border-bottom-color: var(--acento); }
pre.respuesta { background: var(--fondo); border-style: dashed; }
pre.resumen { font-family: inherit; background: none; border: none; padding: 0; }
mark.redactado {
  background: var(--acento-suave);
  color: var(--peligro);
  border-radius: 3px;
  padding: 0 0.15em;
  font-weight: 600;
}
.oculto { color: var(--tenue); font-style: italic; margin: 0 0 0.5rem; }

@media (max-width: 640px) {
  html { font-size: 14px; }
  main { padding: 0.6rem; }
  .ficha { grid-template-columns: 1fr; }
  .ficha dt { margin-top: 0.4rem; }
  textarea { min-width: 100%; }
}
