/* Totus Tuus · Gestión — estilos. Paleta tomada del logo: oro y crema. */
:root {
  --oro: #9a6b00;        /* oro oscuro: contraste AA sobre blanco */
  --oro-claro: #d4a017;
  --oro-fondo: #fbf5e6;
  --tinta: #1f1a12;
  --tinta-suave: #5c5446;
  --borde: #e3dccb;
  --fondo: #f7f4ee;
  --blanco: #ffffff;
  --rojo: #b3261e;
  --rojo-fondo: #fde8e6;
  --ambar: #8a5a00;
  --ambar-fondo: #fff4d6;
  --verde: #1e6b34;
  --verde-fondo: #e4f4e8;
  --radio: 10px;
  --sombra: 0 1px 2px rgba(31, 26, 18, .06), 0 4px 16px rgba(31, 26, 18, .05);
  --serif: Garamond, "EB Garamond", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 16px; line-height: 1.5; color: var(--tinta); background: var(--fondo); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; color: var(--tinta); }
h1 { font-size: 2rem; margin: 0 0 .75rem; }
h2 { font-size: 1.4rem; margin: 0 0 .75rem; }
h3 { font-size: 1.15rem; }
a { color: var(--oro); }
a:hover { color: #6e4d00; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--oro-fondo); padding: .05em .35em; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--oro-claro); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: -999px; top: 0; background: var(--tinta); color: #fff; padding: .5rem 1rem; z-index: 100; }
.saltar:focus { left: 0; }

/* Estructura */
.app { display: flex; min-height: 100vh; }
.lateral { width: 250px; flex-shrink: 0; background: #1f1a12; color: #f3ead6; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.marca { display: flex; align-items: center; gap: .6rem; padding: 1rem; color: #f3ead6; text-decoration: none; border-bottom: 1px solid #3a3226; }
.marca img { border-radius: 8px; background: #fff; }
.marca strong { display: block; font-family: var(--serif); font-size: 1.25rem; color: #f0c75e; }
.marca small { display: block; font-size: .8rem; color: #cfc3a8; }
.lateral nav ul { list-style: none; margin: 0; padding: .5rem; }
.lateral nav a { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border-radius: 8px; color: #e9dfc8; text-decoration: none; }
.lateral nav a:hover { background: #2e271c; color: #fff; }
.lateral nav a.activo { background: #f0c75e; color: #1f1a12; font-weight: 600; }
.lateral .ico { width: 1.25rem; text-align: center; }
.lateral-pie { margin-top: auto; padding: 1rem; border-top: 1px solid #3a3226; }
.usuario-actual { display: block; color: #f3ead6; text-decoration: none; margin-bottom: .6rem; }
.usuario-actual small { display: block; color: #cfc3a8; }
.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.barra { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; background: var(--blanco); border-bottom: 1px solid var(--borde); position: sticky; top: 0; z-index: 10; }
.btn-menu { display: none; }
.buscador { display: flex; gap: .5rem; flex: 1; max-width: 560px; }
.buscador input { flex: 1; }
main { padding: 1.5rem; flex: 1; max-width: 1200px; width: 100%; }
main:focus { outline: none; }
.pie { padding: 1rem 1.5rem; color: var(--tinta-suave); font-size: .85rem; }
.banda-demo { background: #7a1f1f; color: #fff; text-align: center; padding: .4rem; font-weight: 600; font-size: .9rem; }

/* Bloques */
.encabezado { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.encabezado h1 { margin: 0; }
.acciones { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.tarjeta { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--sombra); }
.dos-columnas { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
.centrado { text-align: center; }
.angosto { max-width: 560px; }
.ayuda { color: var(--tinta-suave); font-size: .9rem; margin: .25rem 0 .75rem; }
.vacio { color: var(--tinta-suave); font-style: italic; }
.sin-info { color: var(--tinta-suave); font-style: italic; }
.resumen { color: var(--tinta-suave); margin: .5rem 0; }

/* Indicadores */
.indicadores { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.indicador { background: var(--blanco); border: 1px solid var(--borde); border-left: 5px solid var(--oro-claro); border-radius: var(--radio); padding: 1rem; display: flex; flex-direction: column; box-shadow: var(--sombra); }
.ind-valor { font-family: var(--serif); font-size: 2.2rem; font-weight: 700; line-height: 1; }
.ind-nombre { font-weight: 600; margin-top: .35rem; }
.ind-def { color: var(--tinta-suave); font-size: .85rem; }
.ind-atencion { border-left-color: var(--ambar); background: var(--ambar-fondo); }

/* Avisos y chips (siempre con texto e ícono, no solo color) */
.aviso { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.aviso-ok { background: var(--verde-fondo); border-color: #9fd2ad; color: var(--verde); }
.aviso-ok::before { content: "✓ "; font-weight: 700; }
.aviso-error { background: var(--rojo-fondo); border-color: #f0a9a3; color: var(--rojo); }
.aviso-error::before { content: "✕ "; font-weight: 700; }
.aviso-aviso { background: var(--ambar-fondo); border-color: #f0d48a; color: var(--ambar); }
.aviso-aviso::before { content: "! "; font-weight: 700; }
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.chip-ok { background: var(--verde-fondo); color: var(--verde); }
.chip-gris { background: #eeeae2; color: var(--tinta-suave); }

/* Tablas */
.tabla-envoltura { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; background: var(--blanco); margin-bottom: 1rem; }
.tabla th, .tabla td { padding: .6rem .7rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: top; }
.tabla thead th { background: var(--oro-fondo); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--tinta-suave); }
.tabla tbody tr:hover { background: #fdfaf2; }
.tabla .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabla td.centrado, .tabla th.centrado { text-align: center; }
.fila-grupo th { background: #f3efe4; font-family: var(--serif); font-size: 1.05rem; }
.tabla-permisos tbody th[scope=row] { font-weight: 400; }
.detalle-json { color: var(--tinta-suave); word-break: break-word; }
.paginacion { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

/* Formularios */
.formulario fieldset { border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; margin: 0 0 1rem; }
.formulario legend { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; padding: 0 .4rem; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.campo-ancho { grid-column: 1 / -1; }
.campo { margin-bottom: .9rem; }
.campo label, .etiqueta { display: block; font-weight: 600; margin-bottom: .3rem; }
.opcion { font-weight: 400 !important; display: flex !important; gap: .5rem; align-items: flex-start; margin: .35rem 0; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid #c9bfa8; border-radius: 8px; background: #fff; color: var(--tinta); min-height: 44px;
}
input[readonly] { background: #f3efe4; }
textarea { min-height: auto; }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--rojo); box-shadow: 0 0 0 2px var(--rojo-fondo); }
.campo-error { color: var(--rojo); font-size: .9rem; margin: .3rem 0 0; }
.campo-error::before { content: "✕ "; }
.filtros { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; margin-bottom: 1rem; }
.filtros .campo { margin: 0; min-width: 160px; flex: 1; }
.en-linea { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.en-linea .campo { margin: 0; flex: 1; min-width: 150px; }
.en-linea.compacto { gap: .4rem; align-items: center; flex-wrap: nowrap; }
.en-linea.compacto input { min-width: 70px; }
.campo-boton { flex: 0 0 auto !important; min-width: 0 !important; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 44px; padding: .5rem 1rem; border-radius: 8px; border: 1px solid #c9bfa8; background: #fff; color: var(--tinta); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--oro-fondo); color: var(--tinta); }
.btn-primario { background: var(--oro); border-color: var(--oro); color: #fff; }
.btn-primario:hover { background: #7d5700; color: #fff; }
.btn-peligro { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.btn-peligro:hover { background: #8f1d17; color: #fff; }
.btn-claro { background: transparent; }
.btn-peq { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.btn-bloque { width: 100%; }
.btn[disabled] { opacity: .6; cursor: wait; }
.lateral .btn-claro { color: #f3ead6; border-color: #5a4f3c; }
.lateral .btn-claro:hover { background: #2e271c; }

/* Ficha */
.ficha { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.ficha dt { font-weight: 600; color: var(--tinta-suave); }
.ficha dd { margin: 0; }
.foto-producto { max-width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid var(--borde); margin-bottom: 1rem; }
.descripcion { margin-top: 1rem; }
.actividad { list-style: none; padding: 0; margin: 0; }
.actividad li { padding: .5rem 0; border-bottom: 1px solid var(--borde); }
.actividad time { color: var(--tinta-suave); font-size: .9rem; }

/* Pantallas simples: ingreso e instalación */
.cuerpo-simple { background: radial-gradient(circle at top, #fffaf0, var(--fondo)); }
.caja-simple { max-width: 520px; margin: 2rem auto; padding: 2rem; background: #fff; border: 1px solid var(--borde); border-radius: 16px; box-shadow: var(--sombra); }
.caja-simple h1 { text-align: center; font-size: 1.6rem; }
.logo-grande { display: block; margin: 0 auto 1rem; width: 180px; height: auto; }

/* Celular */
@media (max-width: 860px) {
  .app { display: block; }
  .lateral { position: fixed; inset: 0 auto 0 0; width: 270px; transform: translateX(-100%); transition: transform .2s; z-index: 50; }
  .lateral.abierto { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .btn-menu { display: inline-flex; min-height: 44px; align-items: center; gap: .3rem; border: 1px solid var(--borde); background: #fff; border-radius: 8px; padding: .4rem .7rem; font: inherit; }
  .barra { padding: .6rem .75rem; }
  .buscador .btn { display: none; }
  main { padding: 1rem .75rem; }
  h1 { font-size: 1.6rem; }
  .dos-columnas { grid-template-columns: 1fr; }
  .ficha { grid-template-columns: 1fr; }
  .ficha dt { margin-top: .4rem; }
  .en-linea.compacto { flex-wrap: wrap; }
  .tabla-envoltura .tabla { min-width: 620px; }
  .tabla code { white-space: nowrap; }
  .caja-simple { margin: 0; border-radius: 0; min-height: 100vh; padding: 1.25rem; }
}
@media (max-width: 860px) and (scripting: none) {
  .lateral { position: static; transform: none; width: auto; height: auto; }
}
@media print {
  .lateral, .barra, .btn, form { display: none !important; }
  main { padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
