/* Soma · Consulta — identidad «Petróleo y melocotón». Reglas en DESIGN.md. */

:root {
  --fondo: #f5f3f1;
  --panel: #ffffff;
  --panel-suave: #faf8f6;
  --tinta: #141210;
  --tinta-2: #4a4440;
  --suave: #756e67;
  --linea: #e4dfda;
  --linea-fuerte: #cfc8c0;
  --petroleo: #0e6468;
  --petroleo-hover: #0a4f52;
  --petroleo-suave: #dcebe9;
  --melocoton: #f0a078;
  --melocoton-suave: #f8d5c0;
  --ok: #3f7a4f;
  --ok-suave: #e3f0e6;
  --aviso: #9a651f;
  --aviso-suave: #f8ecd9;
  --error: #9f332d;
  --error-suave: #f6e1df;
  --privado: #3f6477;
  --privado-suave: #e2ebf0;

  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 10px;
  --sombra: 0 1px 2px rgba(20, 18, 16, 0.06);

  color-scheme: light;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--tinta);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #161514;
    --panel: #1f1d1b;
    --panel-suave: #1a1918;
    --tinta: #f1ede8;
    --tinta-2: #cfc8c0;
    --suave: #a29a91;
    --linea: #34312e;
    --linea-fuerte: #4a4642;
    --petroleo: #5fb3b0;
    --petroleo-hover: #7cc6c3;
    --petroleo-suave: #1d3433;
    --melocoton: #f0a078;
    --melocoton-suave: #4a3226;
    --ok: #86c49a;
    --ok-suave: #213027;
    --aviso: #e0ac68;
    --aviso-suave: #3a2e1e;
    --error: #e8928a;
    --error-suave: #3e2422;
    --privado: #8fb5c9;
    --privado-suave: #1f2c33;
    --sombra: none;
    color-scheme: dark;
  }
  .marca img { filter: invert(1) hue-rotate(180deg) brightness(1.1); }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); line-height: 1.45; }
a { color: var(--petroleo); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--petroleo); outline-offset: 2px; border-radius: var(--r-sm); }
code, .codigo { font-family: var(--mono); font-size: .86em; letter-spacing: .01em; }
.codigo { color: var(--tinta-2); background: var(--panel-suave); border: 1px solid var(--linea); border-radius: var(--r-sm); padding: 0 .35em; white-space: nowrap; }

h1 { font-family: var(--serif); font-weight: 400; font-size: 1.75rem; line-height: 1.2; margin: 0 0 .35rem; }
h1::after { content: ""; display: block; width: 2.5rem; height: 3px; background: var(--melocoton); border-radius: 2px; margin-top: .45rem; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .75rem; }
h3 { font-size: .95rem; font-weight: 600; margin: 0 0 .5rem; }

/* --- esqueleto --- */
.marco { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.lateral { background: var(--panel-suave); border-right: 1px solid var(--linea); padding: 1.4rem .9rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: .15rem; }
.marca { display: block; padding: 0 .55rem 1.3rem; color: var(--tinta); }
.marca:hover { text-decoration: none; }
.marca img { display: block; height: 22px; width: auto; }
.marca small { display: block; font-family: var(--serif); font-size: .95rem; color: var(--tinta-2); margin-top: .35rem; }
.lateral a.nav { position: relative; padding: .5rem .7rem; border-radius: var(--r-md); color: var(--tinta-2); font-size: .94rem; }
.lateral a.nav:hover { background: var(--panel); color: var(--tinta); text-decoration: none; }
.lateral a.nav.activo { background: var(--petroleo-suave); color: var(--tinta); font-weight: 600; }
.lateral a.nav.activo::before { content: ""; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px; border-radius: 2px; background: var(--melocoton); }
.lateral .separador { height: 1px; background: var(--linea); margin: .6rem .5rem; }
.lateral .pie { margin-top: auto; padding: .7rem; font-size: .84rem; color: var(--suave); border-top: 1px solid var(--linea); }
.lateral .pie strong { color: var(--tinta); font-weight: 600; display: block; }
.lateral .pie form { display: inline; }
.contenido { padding: 1.8rem 2.2rem 4rem; max-width: 1180px; width: 100%; }

.cabecera { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.cabecera .sub { color: var(--tinta-2); margin-top: .2rem; }
.panel .cabecera { margin-bottom: .6rem; align-items: center; }
.panel .cabecera h2 { margin: 0; }
.acciones { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.panel { background: var(--panel); border: 1px solid var(--linea); border-radius: var(--r-lg); padding: 1.15rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--sombra); }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
.rejilla-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) {
  .rejilla-2-1, .marco { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .7rem; }
  .marca { padding: 0 .5rem; } .marca small { display: none; }
  .lateral .pie { margin: 0 0 0 auto; border: 0; }
  .lateral .separador { display: none; }
  .contenido { padding: 1.2rem 1rem 3rem; }
}

/* --- botones --- */
.boton { display: inline-flex; align-items: center; gap: .35rem; min-height: 2.25rem; border: 1px solid var(--linea-fuerte); background: var(--panel); color: var(--tinta); padding: .4rem .9rem; border-radius: var(--r-md); cursor: pointer; font: inherit; font-size: .92rem; font-weight: 500; }
.boton:hover { border-color: var(--tinta-2); text-decoration: none; }
.boton.primario { background: var(--petroleo); border-color: var(--petroleo); color: #fff; }
.boton.primario:hover { background: var(--petroleo-hover); border-color: var(--petroleo-hover); }
.boton.peligro { color: var(--error); border-color: var(--error-suave); }
.boton.peligro:hover { background: var(--error-suave); border-color: var(--error); }
.boton.pequeno { min-height: 1.75rem; padding: .15rem .6rem; font-size: .82rem; }
button.enlace { background: none; border: 0; color: var(--petroleo); cursor: pointer; padding: 0; font: inherit; }
@media (prefers-color-scheme: dark) { .boton.primario { color: #0d1514; } }

/* --- tablas --- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .55rem; border-bottom: 1px solid var(--linea); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); font-weight: 600; background: var(--panel-suave); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: color-mix(in srgb, var(--petroleo-suave) 35%, transparent); }

/* --- etiquetas y marcas --- */
.etiqueta { display: inline-block; padding: .05rem .5rem; border-radius: var(--r-sm); font-size: .76rem; font-weight: 500; background: var(--petroleo-suave); color: var(--petroleo); white-space: nowrap; vertical-align: middle; }
.etiqueta.ok { background: var(--ok-suave); color: var(--ok); }
.etiqueta.aviso { background: var(--aviso-suave); color: var(--aviso); }
.etiqueta.error { background: var(--error-suave); color: var(--error); }
.etiqueta.gris { background: var(--panel-suave); color: var(--suave); border: 1px solid var(--linea); }
.etiqueta.privado { background: var(--privado-suave); color: var(--privado); }
.punto { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; vertical-align: middle; margin-right: .3rem; }
.suave { color: var(--suave); }
.vacio { color: var(--suave); font-style: italic; }

dl.datos { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
dl.datos dt { color: var(--suave); font-size: .9rem; }
dl.datos dd { margin: 0; }

/* --- notas --- */
.texto-nota { white-space: pre-wrap; margin: .5rem 0 0; font-size: 1.04rem; line-height: 1.6; color: var(--tinta); max-width: 72ch; }
.nota { border-left: 3px solid var(--petroleo); padding: .3rem 0 .3rem 1rem; margin: 1rem 0; }
.nota.personal { border-left-color: var(--aviso); }
.nota.individual { border-left-color: var(--privado); }
.nota .meta { font-size: .82rem; color: var(--suave); }
.nota .meta strong { color: var(--tinta); }
.linea-tiempo .sesion { border-bottom: 1px solid var(--linea); padding: 1rem 0; }
.linea-tiempo .sesion:first-child { padding-top: .2rem; }
.linea-tiempo .sesion:last-child { border-bottom: 0; }

/* --- formularios --- */
form.formulario { display: grid; gap: 1rem; }
form.formulario .campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem 1.25rem; }
.campo label { display: block; font-size: .85rem; font-weight: 500; color: var(--tinta-2); margin-bottom: .25rem; }
.campo.ancho { grid-column: 1 / -1; }
.campo .ayuda { font-size: .78rem; color: var(--suave); margin-top: .25rem; }
.campo .errorlist, .errorlist { color: var(--error); margin: .25rem 0 0; padding: 0; list-style: none; font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=url], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: 2.4rem; padding: .45rem .65rem; border: 1px solid var(--linea-fuerte); border-radius: var(--r-sm);
  background: var(--panel); color: var(--tinta); font: inherit;
}
textarea { resize: vertical; line-height: 1.5; }
textarea.nota-texto { min-height: 24rem; font-size: 1.04rem; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--petroleo); box-shadow: 0 0 0 3px var(--petroleo-suave); }
.campo ul { list-style: none; padding: 0; margin: 0; display: flex; gap: .4rem 1.2rem; flex-wrap: wrap; }
.campo ul li label { color: var(--tinta); font-size: .95rem; font-weight: 400; }
input[type=checkbox], input[type=radio] { accent-color: var(--petroleo); }

/* --- utilidades de listado --- */
.mensajes { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.mensajes li { padding: .6rem .9rem; border-radius: var(--r-md); background: var(--ok-suave); color: var(--ok); margin-bottom: .4rem; }
.mensajes li.error { background: var(--error-suave); color: var(--error); }
.mensajes li.warning { background: var(--aviso-suave); color: var(--aviso); }
.filtros { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filtros input[type=search] { max-width: 340px; }
.filtros select { width: auto; }
.paginacion { display: flex; gap: .75rem; justify-content: center; margin-top: 1rem; }

/* --- acceso (login, doble verificación) --- */
.acceso { max-width: 420px; margin: 9vh auto; padding: 0 1rem; }
.acceso .marca { display: flex; flex-direction: column; align-items: center; padding-bottom: 1.6rem; }
.acceso .marca img { height: 30px; }
.acceso .marca small { margin-top: .5rem; }
