/* Vitacora · hoja de estilos
   Paleta sobria: papel cálido, tinta grafito, un solo acento verde profundo y latón para la marca. */
:root {
  --fondo: #f6f5f1;
  --superficie: #ffffff;
  --superficie-2: #faf9f6;
  --tinta: #17181c;
  --tinta-2: #3d4048;
  --suave: #6d7079;
  --linea: #e7e4dc;
  --linea-fuerte: #d6d2c7;
  --lateral: #131518;
  --lateral-2: #1c1f24;
  --lateral-texto: #9ea3ad;
  --acento: #1d5c4a;
  --acento-2: #164a3b;
  --acento-suave: #e8f0ec;
  --laton: #b08d57;
  --ok: #1f7a4d;
  --ok-suave: #e5f3eb;
  --alerta: #9a5b0b;
  --alerta-suave: #fbf0dc;
  --error: #a8261d;
  --error-suave: #fbe9e7;
  --radio: 10px;
  --radio-chico: 7px;
  --sombra: 0 1px 2px rgba(23, 24, 28, .04);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  color: var(--tinta);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); font-size: 14px; line-height: 1.45; }
[hidden] { display: none !important; }
a { color: var(--acento); }
.num, .cifra { font-variant-numeric: tabular-nums; }

/* --- Estructura: menú lateral + contenido --------------------------------------------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.lateral {
  background: var(--lateral); color: var(--lateral-texto); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 20px 14px;
}
.marca { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 0 8px 22px; }
.marca img { width: 30px; height: 30px; }
.marca b { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 21px; letter-spacing: .2px; }
.marca small { display: block; font-size: 11px; color: var(--lateral-texto); letter-spacing: .08em; text-transform: uppercase; }
.menu { display: grid; gap: 2px; }
.menu .titulo-menu { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #6b707a; padding: 16px 10px 6px; }
.menu a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radio-chico);
  color: var(--lateral-texto); text-decoration: none; font-size: 14px; font-weight: 500;
}
.menu a svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.menu a:hover { background: var(--lateral-2); color: #fff; }
.menu a.activo { background: var(--lateral-2); color: #fff; box-shadow: inset 2px 0 0 var(--laton); }
.menu .contador { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--laton); color: var(--lateral); border-radius: 999px; padding: 1px 7px; }
.persona { margin-top: auto; border-top: 1px solid #262a30; padding: 14px 8px 0; display: grid; gap: 2px; }
.persona b { color: #fff; font-weight: 600; font-size: 13px; }
.persona span { font-size: 12px; }
.persona button { margin-top: 10px; justify-self: start; background: transparent; color: var(--lateral-texto); border: 1px solid #2c3037; }
.persona button:hover { color: #fff; border-color: #444a53; }

.contenido { padding: 28px 36px 48px; min-width: 0; max-width: 1480px; }
.encabezado { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.encabezado h1 { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 28px; letter-spacing: -.2px; margin: 0; }
.encabezado p { margin: 4px 0 0; color: var(--suave); }
.encabezado .acciones { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; overflow-x: auto; }
  .marca { padding: 0 8px 0 0; }
  .marca small, .menu .titulo-menu, .persona span, .persona b { display: none; }
  .menu { display: flex; }
  .menu a { white-space: nowrap; }
  .persona { margin: 0 0 0 auto; border: none; padding: 0; }
  .persona button { margin: 0; }
  .contenido { padding: 20px 16px 40px; }
}

/* --- Bloques -------------------------------------------------------------------------- */
.panel { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); }
.panel > .cuerpo { padding: 18px 20px; }
.panel > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--linea); }
.panel > header h2 { font-size: 14px; font-weight: 600; margin: 0; }
.panel > header span { color: var(--suave); font-size: 13px; }
.panel + .panel { margin-top: 16px; }
.rejilla { display: grid; gap: 16px; }
.rejilla.dos { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.rejilla .panel + .panel { margin-top: 0; }
.ayuda { color: var(--suave); margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); }

/* --- Cifras --------------------------------------------------------------------------- */
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 16px; }
.cifra-tile { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
a.cifra-tile:hover { border-color: var(--linea-fuerte); }
.cifra-tile span { display: block; color: var(--suave); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.cifra-tile b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.cifra-tile small { color: var(--suave); }
.cifra-tile.destacada { border-top: 2px solid var(--laton); }

/* --- Controles ------------------------------------------------------------------------ */
input, select, textarea, button { font: inherit; font-size: 14px; color: var(--tinta); }
input, select, textarea { width: 100%; padding: 8px 11px; border: 1px solid var(--linea-fuerte); border-radius: var(--radio-chico); background: var(--superficie); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave); }
label.campo { display: grid; gap: 5px; font-size: 12px; font-weight: 500; color: var(--tinta-2); }

button, .boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: auto; white-space: nowrap;
  padding: 8px 14px; border-radius: var(--radio-chico); border: 1px solid transparent; cursor: pointer; font-weight: 500;
  background: var(--acento); color: #fff; text-decoration: none; transition: background .12s, border-color .12s, color .12s;
}
button:hover { background: var(--acento-2); }
button:disabled { opacity: .45; cursor: default; }
button svg { width: 15px; height: 15px; }
button.secundario { background: var(--superficie); color: var(--tinta); border-color: var(--linea-fuerte); }
button.secundario:hover { background: var(--superficie-2); border-color: #c4bfb2; }
button.fantasma { background: transparent; color: var(--tinta-2); padding: 6px 10px; }
button.fantasma:hover { background: var(--fondo); }
button.exito { background: var(--ok); }
button.exito:hover { background: #18663f; }
button.peligro { background: var(--superficie); color: var(--error); border-color: #e8c2bd; }
button.peligro:hover { background: var(--error-suave); }
button.chico { padding: 5px 10px; font-size: 13px; }
button.ancho { width: 100%; }

/* --- Estados -------------------------------------------------------------------------- */
.estado { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 9px 2px 8px; border-radius: 999px; background: #efede7; color: var(--tinta-2); white-space: nowrap; }
.estado::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.estado.enviada { background: var(--alerta-suave); color: var(--alerta); }
.estado.aprobada { background: var(--ok-suave); color: var(--ok); }
.estado.rechazada { background: var(--error-suave); color: var(--error); }
.marca-chica { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 999px; background: var(--alerta-suave); color: var(--alerta); white-space: nowrap; margin-left: 6px; }
.marca-chica.ok { background: var(--ok-suave); color: var(--ok); }
.marca-chica.neutra { background: #efede7; color: var(--suave); }

/* --- Tablas --------------------------------------------------------------------------- */
.tabla { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--suave); font-weight: 600; background: var(--superficie-2); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.fila-link { cursor: pointer; }
tbody tr.fila-link:hover td { background: var(--superficie-2); }
.num { text-align: right; white-space: nowrap; }
tfoot td { font-weight: 600; border-top: 1px solid var(--linea-fuerte); border-bottom: none; }
td.fecha { white-space: nowrap; }
td .acciones-fila { display: flex; gap: 6px; justify-content: flex-end; }
tr.con-alerta td { background: #fdf8ee; }
tr.excluido td { color: var(--suave); text-decoration: line-through; }
tr.excluido td:last-child { text-decoration: none; }
tr.inactivo td { color: var(--suave); }
.era { display: block; font-size: 12px; color: var(--suave); text-decoration: line-through; }
.positivo { color: var(--ok); }
.negativo { color: var(--error); }

/* --- Barras (gasto por categoría / camión) -------------------------------------------- */
.barras { display: grid; gap: 10px; }
.barra { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.barra .eje { height: 10px; background: #f0eee8; border-radius: 4px; overflow: hidden; }
.barra .eje i { display: block; height: 100%; background: var(--acento); border-radius: 0 4px 4px 0; }
.barra:hover .eje i { background: var(--acento-2); }
.barra .nombre { color: var(--tinta-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra .valor { font-variant-numeric: tabular-nums; font-weight: 500; }
.vacio { text-align: center; color: var(--suave); padding: 48px 20px; }

/* --- Rendiciones: lista + detalle ----------------------------------------------------- */
.dividido { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .dividido { grid-template-columns: 1fr; } }
.filtros { display: grid; gap: 8px; padding: 14px; border-bottom: 1px solid var(--linea); }
.filtros details summary { cursor: pointer; color: var(--acento); font-weight: 500; font-size: 13px; }
.filtros details[open] summary { margin-bottom: 8px; }
.filtros .fila { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filtros-acciones { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.filtros-acciones small { color: var(--suave); }
#lista-rendiciones { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 290px); overflow: auto; }
#lista-rendiciones li { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 12px 16px; border-bottom: 1px solid var(--linea); cursor: pointer; }
#lista-rendiciones li:hover { background: var(--superficie-2); }
#lista-rendiciones li.activa { background: var(--acento-suave); box-shadow: inset 3px 0 0 var(--acento); }
#lista-rendiciones .quien { font-weight: 600; }
#lista-rendiciones .monto { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
#lista-rendiciones small { color: var(--suave); font-size: 12px; }

.ficha { padding: 20px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: start; }
.ficha h2 { font-size: 20px; font-weight: 600; margin: 0 0 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; letter-spacing: -.2px; }
.ficha p { margin: 0; color: var(--suave); }
.total-grande { text-align: right; }
.total-grande b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.total-grande span { color: var(--suave); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); border-top: 1px solid var(--linea); }
.datos div { padding: 12px 20px; border-right: 1px solid var(--linea); border-bottom: 1px solid var(--linea); }
.datos span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--suave); margin-bottom: 3px; }
.comentario { margin: 0; padding: 12px 20px; background: var(--error-suave); color: var(--error); border-top: 1px solid var(--linea); }
.barra-acciones { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 20px; background: var(--superficie-2); border-radius: 0 0 var(--radio) var(--radio); }
.barra-acciones .separador { flex: 1; }

.linea-tiempo { list-style: none; margin: 0; padding: 0; }
.linea-tiempo li { position: relative; padding: 0 0 14px 22px; }
.linea-tiempo li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--linea-fuerte); }
.linea-tiempo li::after { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 1px; background: var(--linea); }
.linea-tiempo li:last-child::after { display: none; }
.linea-tiempo li.ok::before { background: var(--ok); }
.linea-tiempo li.alerta::before { background: var(--alerta); }
.linea-tiempo li.error::before { background: var(--error); }
.linea-tiempo small { display: block; color: var(--suave); font-size: 12px; }
.linea-tiempo a { margin-left: 6px; }

details.inet summary { cursor: pointer; font-weight: 600; padding: 14px 20px; }
details.inet[open] summary { border-bottom: 1px solid var(--linea); }
#asiento { padding: 14px 20px; }
#asiento .aviso { color: var(--alerta); margin: 4px 0; }
#asiento table { font-size: 13px; margin-bottom: 12px; }

/* Rendición manual y formularios */
.subida { display: block; border: 1px dashed var(--linea-fuerte); border-radius: var(--radio); padding: 18px; text-align: center; cursor: pointer; color: var(--suave); background: var(--superficie-2); }
.subida:hover { border-color: var(--acento); color: var(--acento); }
.subida input { display: none; }
#estado-ia { min-height: 1.2em; color: var(--suave); }
.grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.grilla .ancho { grid-column: 1 / -1; }
details.manual summary { cursor: pointer; font-weight: 500; color: var(--acento); }
details.manual form { display: grid; gap: 8px; margin-top: 12px; }

/* Fondos */
.formulario-deposito { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.formulario-deposito .ancho { grid-column: 1 / -1; }

/* --- Listas y personas ---------------------------------------------------------------- */
.columnas-listas { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; align-items: start; }
.columnas-listas .panel + .panel { margin-top: 0; }
@media (max-width: 700px) { .columnas-listas { grid-template-columns: 1fr; } }
.en-linea { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--linea); }
.en-linea input { flex: 1 1 150px; width: auto; }
.check { display: flex; align-items: center; gap: 6px; color: var(--tinta-2); }
.check input, td input[type=checkbox] { width: auto; accent-color: var(--acento); }
td button + button { margin-left: 6px; }
td:last-child { white-space: nowrap; }
code { background: var(--fondo); border: 1px solid var(--linea); padding: 1px 6px; border-radius: 5px; font-size: 13px; letter-spacing: 1px; }

/* --- Entrada -------------------------------------------------------------------------- */
body.entrada { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.entrada .portada { background: var(--lateral); color: #d9dce2; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.entrada .portada .marca { padding: 0; }
.entrada .portada blockquote { margin: 0; font-family: "Fraunces", Georgia, serif; font-size: 30px; line-height: 1.25; color: #fff; max-width: 460px; }
.entrada .portada blockquote em { color: var(--laton); font-style: normal; }
.entrada .portada p { color: var(--lateral-texto); max-width: 440px; }
.entrada .lado-form { display: grid; place-items: center; padding: 32px 20px; }
.caja-entrada { width: 100%; max-width: 380px; }
.caja-entrada h1 { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 26px; margin: 0 0 6px; }
.caja-entrada form { display: grid; gap: 14px; margin-top: 22px; }
.caja-entrada button[type=submit], .caja-entrada form > button { padding: 11px; }
.enlace { background: none; border: none; color: var(--acento); padding: 0; font-weight: 500; }
.enlace:hover { background: none; text-decoration: underline; }
.error { color: var(--error); margin: 0; min-height: 1.2em; }
.pasos { margin: 14px 0 0; padding-left: 20px; color: var(--tinta-2); line-height: 1.6; }
@media (max-width: 860px) { body.entrada { grid-template-columns: 1fr; } .entrada .portada { padding: 28px 24px; gap: 24px; } .entrada .portada blockquote { font-size: 22px; } }
.aviso-flotante { position: fixed; right: 24px; bottom: 24px; background: var(--lateral); color: #fff; padding: 12px 16px; border-radius: var(--radio); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); border-left: 3px solid var(--laton); z-index: 10; }

/* --- Formulario emergente (clasificar gasto) ------------------------------------------- */
dialog {
  border: 1px solid var(--linea); border-radius: var(--radio); padding: 20px 22px; width: min(520px, calc(100vw - 32px));
  background: var(--superficie); color: var(--tinta); box-shadow: 0 12px 40px rgba(23, 24, 28, .18);
}
dialog::backdrop { background: rgba(19, 21, 24, .45); }
dialog h2 { margin: 0 0 4px; font-size: 18px; }
dialog .campo { display: block; margin: 12px 0 0; }
dialog details { margin: 14px 0 0; }
dialog summary { cursor: pointer; color: var(--acento); }
dialog .barra-acciones { margin-top: 18px; }
