/* ==========================================================================
   TRIBU · Sistema visual
   Menú verde bosque, fondo marfil, tarjetas de papel con cinta, títulos serif.
   ========================================================================== */
:root {
  --bosque: #173d32;
  --bosque-2: #1f4a3d;
  --bosque-3: #2a5a4a;
  --boton: #245d46;
  --boton-2: #2f7356;
  --marfil: #f6f0e5;
  --marfil-2: #efe7d8;
  --papel: #fbf7ee;
  --papel-borde: #e4dac6;
  --crema: #f3ead8;
  --salvia: #dde4ce;
  --salvia-2: #c9d5b5;
  --salvia-texto: #3d6a4a;
  --terracota: #ebc8b5;
  --terracota-2: #f3ddd0;
  --terracota-texto: #a2482a;
  --ambar: #f2dfb4;
  --ambar-texto: #8a5a12;
  --lavanda: #e3dcef;
  --lavanda-texto: #6a4f9c;
  --texto: #20382f;
  --texto-2: #4c5f55;
  --texto-3: #7b857d;
  --linea: #e6ddcb;
  --cinta: rgba(223, 196, 150, 0.72);
  --sombra: 0 1px 1px rgba(60, 45, 20, 0.06), 0 6px 16px -6px rgba(60, 45, 20, 0.22);
  --sombra-alta: 0 2px 3px rgba(60, 45, 20, 0.08), 0 18px 40px -12px rgba(40, 30, 10, 0.35);
  --serif: 'Libre Baskerville', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --radio: 10px;
  --menu: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); font-size: 15px; color: var(--texto); line-height: 1.45;
  background-color: var(--marfil);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, 0.55), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.38 0 0 0 0 0.25 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
h1, h2, h3, .serif { font-family: var(--serif); color: var(--bosque); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 30px; margin: 0; line-height: 1.15; }
h2 { font-size: 21px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 0 0 8px; }
a { color: var(--boton); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #c99a3c; outline-offset: 2px; border-radius: 6px; }
.oculto-visual { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ── Estructura ─────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.menu {
  width: var(--menu); flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  color: #f2ecdf; padding: 22px 14px 18px; display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(180deg, #1a4537 0%, var(--bosque) 45%, #12332a 100%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06), 4px 0 18px -8px rgba(0, 0, 0, 0.35);
}
.marca { display: flex; flex-direction: column; align-items: center; margin: 0 0 22px; text-decoration: none; color: #f6f0e5; }
.marca b { font-family: var(--serif); font-size: 30px; letter-spacing: 0.08em; font-weight: 400; }
.marca svg { margin-top: -2px; }
.menu a.item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 999px; color: #ece5d6;
  text-decoration: none; font-size: 15px; border: 1px solid transparent;
}
.menu a.item:hover { background: rgba(255, 255, 255, 0.07); }
.menu a.item[aria-current='page'] {
  background: linear-gradient(180deg, rgba(221, 228, 206, 0.32), rgba(221, 228, 206, 0.2));
  border-color: rgba(221, 228, 206, 0.35); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.menu .separador { height: 1px; background: rgba(255, 255, 255, 0.12); margin: 12px 8px; }
.menu .titulo-grupo { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: #a9bba9; margin: 4px 12px; }
.menu .pie-menu { margin-top: auto; font-size: 11.5px; color: #a9bba9; padding: 10px 12px 0; }
.contenido { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.barra {
  display: flex; align-items: center; gap: 12px; padding: 10px 26px; min-height: 56px;
  background: rgba(251, 247, 238, 0.92); border-bottom: 1px solid var(--linea); position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
.barra .grupo { display: flex; align-items: center; gap: 10px; }
.barra .divisor { width: 1px; height: 22px; background: var(--linea); }
.barra .espacio { flex: 1; }
.chip-barra {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--papel-borde);
  background: var(--papel); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--texto);
}
.chip-barra:hover { border-color: var(--salvia-2); }
.chip-barra.simple { border-color: transparent; background: none; font-weight: 500; }
.campana { position: relative; }
.campana .contador {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--terracota-texto); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.pagina { padding: 24px 28px 48px; max-width: 1380px; width: 100%; }
.barra .boton-menu { display: none; }
.aviso-demo {
  background: repeating-linear-gradient(-45deg, #f5e6c4, #f5e6c4 12px, #f0dcb0 12px, #f0dcb0 24px);
  color: #6d4a0e; font-size: 13px; font-weight: 600; text-align: center; padding: 5px 12px; border-bottom: 1px solid #e3c98f;
}

/* ── Encabezado de página ───────────────────────────────────────────────── */
.encabezado { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.encabezado p { margin: 4px 0 0; color: var(--texto-2); }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.migas { font-size: 14px; margin-bottom: 8px; }
.migas a { text-decoration: none; color: var(--texto-2); display: inline-flex; gap: 6px; align-items: center; }

/* ── Papel ──────────────────────────────────────────────────────────────── */
.papel {
  position: relative; background: var(--papel); border: 1px solid var(--papel-borde);
  border-radius: 7px 11px 8px 12px / 11px 7px 12px 8px; box-shadow: var(--sombra); padding: 18px 20px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 40%);
}
.papel + .papel, .papel + .bloque, .bloque + .papel { margin-top: 18px; }
.papel.sin-relleno { padding: 0; }
.cinta::before {
  content: ''; position: absolute; top: -9px; left: 50%; width: 58px; height: 18px; transform: translateX(-50%) rotate(-3deg);
  background: var(--cinta); box-shadow: 0 1px 2px rgba(80, 60, 20, 0.15);
  clip-path: polygon(3% 0, 97% 4%, 100% 50%, 96% 100%, 2% 96%, 0 50%);
}
.cinta.izq::before { left: 18%; transform: translateX(-50%) rotate(-6deg); }
.cinta.der::before { left: 80%; transform: translateX(-50%) rotate(5deg); }

/* KPI con borde rasgado */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin: 6px 0 22px; }
.kpi-envoltura { filter: drop-shadow(0 1px 1px rgba(60, 45, 20, 0.1)) drop-shadow(0 6px 10px rgba(60, 45, 20, 0.16)); position: relative; }
.kpi {
  display: flex; align-items: center; gap: 14px; padding: 18px 18px 16px; text-decoration: none; color: inherit; min-height: 88px;
  background: var(--papel) linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 60%);
  clip-path: polygon(0 3%, 6% 0, 14% 2%, 24% 0, 35% 2.5%, 47% 0.5%, 58% 2%, 69% 0, 81% 2%, 92% 0.5%, 100% 2.5%, 99.4% 30%, 100% 62%, 99.2% 97%,
    90% 100%, 78% 98%, 66% 100%, 55% 98.2%, 43% 100%, 31% 98%, 19% 100%, 9% 98.4%, 0 100%, 0.7% 64%, 0 32%);
  border: none; width: 100%; font: inherit; text-align: left; cursor: pointer;
}
a.kpi:hover, button.kpi:hover { background-color: #fffcf4; }
.kpi .icono { color: var(--bosque); flex: none; }
.kpi.alerta .icono { color: var(--terracota-texto); }
.kpi.morado .icono { color: var(--lavanda-texto); }
.kpi .cifra { font-family: var(--serif); font-size: 30px; line-height: 1; color: var(--bosque); font-weight: 700; }
.kpi .cifra small { font-size: 16px; color: var(--texto-2); font-weight: 400; }
.kpi .etiqueta { color: var(--texto-2); font-size: 14px; margin-top: 4px; }
.kpi .nota { color: var(--texto-3); font-size: 11.5px; }
.kpi-envoltura::after {
  content: ''; position: absolute; top: -7px; left: 32%; width: 46px; height: 15px; transform: rotate(-4deg); background: var(--cinta);
  clip-path: polygon(3% 0, 97% 4%, 100% 50%, 96% 100%, 2% 96%, 0 50%); pointer-events: none;
}
.kpi-envoltura:nth-child(2n)::after { left: 46%; transform: rotate(3deg); }

/* ── Botones ────────────────────────────────────────────────────────────── */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; border-radius: 9px; cursor: pointer;
  font-weight: 600; font-size: 14.5px; text-decoration: none; border: 1px solid #1b4a37; color: #f6f0e5; white-space: nowrap;
  background: linear-gradient(180deg, var(--boton-2) 0%, var(--boton) 52%, #1d4f3b 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.12), 0 3px 8px -3px rgba(20, 50, 35, 0.55);
  transition: transform 0.06s ease, filter 0.15s;
}
.boton:hover { filter: brightness(1.06); }
.boton:active { transform: translateY(1px); }
.boton[disabled], .boton[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.3); }
.boton.secundario {
  background: var(--papel); color: var(--bosque); border-color: #2f6a52;
  box-shadow: inset 0 1px 0 #fff, 0 2px 5px -3px rgba(20, 50, 35, 0.4);
}
.boton.suave { background: var(--salvia); color: var(--bosque); border-color: var(--salvia-2); box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
.boton.peligro { background: linear-gradient(180deg, #f6dccf, var(--terracota)); color: var(--terracota-texto); border-color: #d8a58b; box-shadow: inset 0 1px 0 rgba(255,255,255,.6); }
.boton.chico { padding: 5px 12px; font-size: 13.5px; border-radius: 8px; }
.boton.icono-solo { padding: 6px 9px; }
.boton.enlace { background: none; border: none; box-shadow: none; color: var(--boton); padding: 4px 6px; }

/* ── Pestañas y filtros ─────────────────────────────────────────────────── */
.pestanas { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.pestanas a, .pestanas button {
  padding: 7px 26px; border-radius: 8px; background: var(--papel); border: 1px solid var(--papel-borde); color: var(--texto);
  text-decoration: none; font-size: 15px; cursor: pointer; box-shadow: 0 1px 2px rgba(60, 45, 20, 0.06);
}
.pestanas [aria-selected='true'], .pestanas [aria-current='page'] {
  background: linear-gradient(180deg, var(--boton-2), var(--boton)); color: #fff; border-color: #1b4a37;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.filtros { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filtros .crece { flex: 1 1 240px; }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  border: 1px solid var(--papel-borde); background: var(--papel); border-radius: 8px; padding: 6px 14px; cursor: pointer; font-size: 14px;
  display: inline-flex; gap: 6px; align-items: center;
}
.chips button[aria-pressed='true'] { background: var(--boton); color: #fff; border-color: #1b4a37; }
.chips .n { background: var(--ambar); color: var(--ambar-texto); border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.chips button[aria-pressed='true'] .n { background: #f6f0e5; color: var(--bosque); }
.campo-busqueda { position: relative; }
.campo-busqueda svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--texto-3); }
.campo-busqueda input { padding-left: 36px; width: 100%; }
.navegador-fecha { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.navegador-fecha .fecha-titulo { font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--bosque); display: flex; gap: 10px; align-items: center; margin-right: auto; }

/* ── Formularios ────────────────────────────────────────────────────────── */
input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='date'], input[type='month'],
input[type='time'], input[type='datetime-local'], input[type='search'], input:not([type]), select, textarea {
  border: 1px solid #d9cdb5; background: #fffdf8; border-radius: 8px; padding: 8px 11px; min-height: 38px; width: 100%;
  box-shadow: inset 0 1px 2px rgba(60, 45, 20, 0.06);
}
select { width: auto; max-width: 100%; padding-right: 28px; }
.filtros select, .filtros input { width: auto; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--boton); outline: none; box-shadow: 0 0 0 3px rgba(36, 93, 70, 0.18); }
label { font-size: 13.5px; font-weight: 600; color: var(--texto-2); display: block; margin-bottom: 4px; }
.campo { margin-bottom: 12px; }
.campo .ayuda { font-size: 12.5px; color: var(--texto-3); margin-top: 3px; }
.campo.error input, .campo.error select { border-color: var(--terracota-texto); }
.campo .msj-error { color: var(--terracota-texto); font-size: 12.5px; margin-top: 3px; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }
.rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rejilla-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
fieldset { border: 1px dashed var(--papel-borde); border-radius: 10px; padding: 12px 14px 4px; margin: 0 0 14px; }
legend { font-family: var(--serif); font-weight: 700; color: var(--bosque); padding: 0 6px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--texto); }
.check input { width: 18px; height: 18px; accent-color: var(--boton); }

/* ── Tablas ─────────────────────────────────────────────────────────────── */
.tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: inherit; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tabla th { text-align: left; font-weight: 700; font-size: 13.5px; color: var(--texto); padding: 11px 12px; border-bottom: 1px solid var(--linea); white-space: nowrap; background: rgba(243, 234, 216, 0.45); }
.tabla td { padding: 10px 12px; border-bottom: 1px solid #eee5d4; vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: none; }
.tabla tbody tr.clic { cursor: pointer; }
.tabla tbody tr.clic:hover td { background: rgba(221, 228, 206, 0.28); }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla .centro { text-align: center; }
.tabla tfoot td { font-weight: 700; border-top: 2px solid var(--linea); background: rgba(243, 234, 216, 0.35); }
.pie-tabla { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; color: var(--texto-2); font-size: 13.5px; border-top: 1px solid var(--linea); }
.persona { display: flex; align-items: center; gap: 10px; font-weight: 700; font-family: var(--serif); font-size: 14.5px; color: var(--bosque); }
.persona small { display: block; font-family: var(--sans); font-weight: 400; color: var(--texto-3); font-size: 12.5px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-family: var(--sans); font-weight: 700;
  font-size: 13px; color: #fff; box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, 0.25);
}
.avatar.grande { width: 96px; height: 96px; font-size: 32px; box-shadow: 0 0 0 4px #fff, 0 3px 10px rgba(0, 0, 0, 0.25); }

/* Mensual: columna de nombre fija */
.tabla.mensual { font-size: 12.5px; }
.tabla.mensual th, .tabla.mensual td { padding: 6px 4px; text-align: center; }
.tabla.mensual th:first-child, .tabla.mensual td:first-child {
  position: sticky; left: 0; z-index: 2; text-align: left; background: var(--papel); min-width: 170px; padding-left: 12px; box-shadow: 1px 0 0 var(--linea);
}
.tabla.mensual .finde { background: rgba(235, 200, 181, 0.22); }
.tabla.mensual .feriado { background: rgba(235, 200, 181, 0.42); }
.tabla.mensual button.celda { border: none; background: none; padding: 0; cursor: pointer; }

/* ── Estados ────────────────────────────────────────────────────────────── */
.estado {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
  white-space: nowrap; background: var(--salvia); color: var(--salvia-texto);
}
.estado.ambar { background: var(--ambar); color: var(--ambar-texto); }
.estado.terracota { background: var(--terracota-2); color: var(--terracota-texto); }
.estado.lavanda { background: var(--lavanda); color: var(--lavanda-texto); }
.estado.gris { background: #ebe6dc; color: #5e645f; }
.estado.verde { background: #cfe0c5; color: #23543a; }
.estado.bosque { background: var(--bosque); color: #f6f0e5; }
.estados { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* Íconos de asistencia */
.ia { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; vertical-align: middle; }
.ia.presente { background: #d6e6cc; color: #2c6a3c; box-shadow: inset 0 0 0 1.5px #9cc08b; }
.ia.ausente { background: #fbe0cf; color: #c2541f; box-shadow: inset 0 0 0 1.5px #eaa47e; }
.ia.permiso { background: var(--lavanda); color: var(--lavanda-texto); box-shadow: inset 0 0 0 1.5px #c5b6e0; }
.ia.vacaciones { background: #d9e8ee; color: #2d6478; box-shadow: inset 0 0 0 1.5px #a7cad8; }
.ia.licencia { background: #f4dbe3; color: #8e3a57; box-shadow: inset 0 0 0 1.5px #e2a9bc; }
.ia.atraso { background: #f8e9c6; color: #a86a0b; box-shadow: inset 0 0 0 1.5px #e3bd6c; }
.ia.sinregistro { color: #a9a49a; background: none; box-shadow: none; font-size: 15px; }
.ia.sinturno { color: #b9b3a6; background: none; box-shadow: none; }
.ia.pendiente { background: #efeae0; color: #8b8577; box-shadow: inset 0 0 0 1.5px #d6cfbf; }
.ia.feriado { background: var(--terracota-2); color: var(--terracota-texto); }
.ia.mini { width: 18px; height: 18px; }
.marca-atraso { position: relative; }
.marca-atraso::after { content: ''; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%; background: #e0a42f; box-shadow: 0 0 0 1.5px #fff; }
.leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--texto-2); align-items: center; }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }

/* ── Avisos ─────────────────────────────────────────────────────────────── */
.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; font-size: 14px; background: var(--crema); border: 1px solid var(--papel-borde); }
.aviso.ambar { background: #faf0d6; border-color: #e9d29b; color: #6b4a0d; }
.aviso.terracota { background: var(--terracota-2); border-color: #e4b49a; color: #7d3519; }
.aviso.salvia { background: #e6ecd9; border-color: var(--salvia-2); color: #2f5a3c; }
.aviso svg { flex: none; margin-top: 2px; }
.aviso + .aviso { margin-top: 8px; }
.integracion { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--papel-borde); background: var(--papel); }
.integracion.real { background: var(--salvia); border-color: var(--salvia-2); }
.integracion.pendiente { background: #f6ecd2; border-color: #e3cd96; }
.integracion.simulacion { background: var(--lavanda); border-color: #cfc2e6; }

/* ── Ventanas modales, avisos flotantes ─────────────────────────────────── */
dialog.modal {
  border: none; padding: 0; border-radius: 14px; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  background: var(--papel); color: var(--texto); box-shadow: var(--sombra-alta);
}
dialog.modal.ancho { width: min(1040px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(23, 40, 32, 0.42); backdrop-filter: blur(2px); }
.modal .cab { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--linea); position: sticky; top: 0; background: var(--papel); z-index: 3; }
.modal .cab h2 { margin: 0; font-size: 20px; }
.modal .cuerpo { padding: 18px 20px; overflow-y: auto; }
.modal .pie { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--linea); flex-wrap: wrap; position: sticky; bottom: 0; background: var(--papel); }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 36px)); }
.toast { padding: 12px 16px; border-radius: 10px; box-shadow: var(--sombra-alta); background: var(--bosque); color: #f6f0e5; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.toast.error { background: #7d3519; }
.desplegable { position: absolute; right: 0; top: calc(100% + 6px); min-width: 280px; background: var(--papel); border: 1px solid var(--papel-borde); border-radius: 12px; box-shadow: var(--sombra-alta); z-index: 40; padding: 6px; }
.desplegable a, .desplegable button.opcion { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--texto); background: none; border: none; cursor: pointer; }
.desplegable a:hover, .desplegable button.opcion:hover { background: var(--crema); }
.desplegable .noti { border-bottom: 1px solid var(--linea); }
.desplegable .noti.nueva { background: rgba(221, 228, 206, 0.35); }
.desplegable .noti small { display: block; color: var(--texto-3); }
.relativo { position: relative; }

/* ── Estados de carga, vacío y error ───────────────────────────────────── */
.cargando { padding: 40px; text-align: center; color: var(--texto-3); }
.cargando::before { content: ''; display: block; width: 28px; height: 28px; margin: 0 auto 10px; border-radius: 50%; border: 3px solid var(--salvia); border-top-color: var(--boton); animation: giro 0.8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
.vacio { padding: 34px 20px; text-align: center; color: var(--texto-2); }
.vacio .serif { font-size: 18px; margin-bottom: 6px; }
.error-pantalla { padding: 30px; text-align: center; }
.esqueleto { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #efe7d6, #f7f1e4, #efe7d6); background-size: 200% 100%; animation: brillo 1.2s infinite; }
@keyframes brillo { to { background-position: -200% 0; } }

/* ── Piezas varias ──────────────────────────────────────────────────────── */
.ficha-cab { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.ficha-cab h1 { font-size: 34px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 14.5px; }
.dl dt { color: var(--texto-2); display: flex; gap: 8px; align-items: center; }
.dl dd { margin: 0; font-weight: 600; }
.lista-simple { list-style: none; padding: 0; margin: 0; }
.lista-simple li { padding: 9px 0; border-bottom: 1px solid var(--linea); display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.lista-simple li:last-child { border-bottom: none; }
.linea-tiempo { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--salvia-2); }
.linea-tiempo li { padding: 0 0 12px 16px; position: relative; font-size: 14px; }
.linea-tiempo li::before { content: ''; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--papel); border: 2px solid var(--boton); }
.linea-tiempo small { color: var(--texto-3); display: block; }
.barra-progreso { display: flex; gap: 3px; }
.barra-progreso span { flex: 1; height: 12px; border-radius: 3px; background: #e7e0d2; }
.barra-progreso span.on { background: linear-gradient(180deg, #7fb070, #5d9452); }
.barras-h { display: grid; gap: 10px; }
.barras-h .fila { display: grid; grid-template-columns: 110px 1fr 54px; gap: 10px; align-items: center; font-size: 14px; }
.barras-h .pista { height: 14px; background: #e9e3d6; border-radius: 4px; overflow: hidden; }
.barras-h .pista i { display: block; height: 100%; background: linear-gradient(90deg, #6fa262, #4f8a48); border-radius: 4px; }
.grafico-barras { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding: 10px 6px 0; border-bottom: 1px solid var(--linea); }
.grafico-barras .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 11.5px; color: var(--texto-2); }
.grafico-barras .col i { width: 100%; max-width: 56px; background: linear-gradient(180deg, #8cbd7c, #5a9450); border-radius: 4px 4px 0 0; min-height: 2px; }
.grafico-barras .col:last-child i { background: linear-gradient(180deg, #2f7356, #1d4f3b); }
.eje-barras { display: flex; gap: 14px; padding: 4px 6px; font-size: 12px; color: var(--texto-2); }
.eje-barras span { flex: 1; text-align: center; }
.pasos { display: flex; gap: 6px; flex-wrap: wrap; counter-reset: paso; margin: 4px 0 16px; }
.pasos li { list-style: none; counter-increment: paso; font-size: 12.5px; padding: 5px 10px 5px 8px; border-radius: 999px; background: #ece5d6; color: var(--texto-2); display: flex; gap: 6px; align-items: center; }
.pasos li::before { content: counter(paso); width: 18px; height: 18px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 700; font-size: 11px; }
.pasos li.hecho { background: var(--salvia); color: var(--bosque); }
.pasos li.actual { background: var(--boton); color: #fff; }
.pasos li.actual::before { color: var(--boton); }
.tarjetas-reporte { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.tarjeta-reporte { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; }
.tarjeta-reporte b { font-family: var(--serif); color: var(--bosque); display: block; }
.tarjeta-reporte small { color: var(--texto-2); }
.concepto { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px dashed var(--linea); }
.concepto .formula { grid-column: 1 / -1; font-size: 12px; color: var(--texto-3); font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.concepto .fuente { grid-column: 1 / -1; font-size: 11.5px; color: var(--texto-3); }
.total-grande { font-family: var(--serif); font-size: 26px; color: var(--bosque); font-weight: 700; }
.calendario-mes { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.agenda-mes { display: none; }
.calendario-mes .d { min-height: 64px; border-radius: 8px; background: #fffdf8; border: 1px solid var(--linea); padding: 4px 6px; font-size: 12px; }
.calendario-mes .d.fuera { opacity: 0.4; }
.calendario-mes .d.finde { background: #f8efe6; }
.calendario-mes .d .ev { display: block; margin-top: 3px; padding: 1px 5px; border-radius: 5px; background: var(--salvia); color: var(--bosque); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.calendario-mes .d .ev.pend { background: var(--ambar); color: var(--ambar-texto); }
.calendario-mes .cab-d { font-size: 12px; font-weight: 700; text-align: center; color: var(--texto-2); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .papel { width: min(420px, 100%); padding: 28px; }
.login .marca { color: var(--bosque); }
.login .marca b { font-size: 40px; }
.texto-2 { color: var(--texto-2); } .texto-3 { color: var(--texto-3); } .chico { font-size: 13px; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; } .fila-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .derecha { margin-left: auto; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; }
.matriz th { position: sticky; top: 0; }
.matriz td.centro input { width: 18px; height: 18px; accent-color: var(--boton); }

/* ── Celular y tableta ──────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .rejilla-2, .rejilla-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .menu { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-105%); transition: transform 0.22s ease; width: 270px; }
  .app.menu-abierto .menu { transform: none; }
  .app.menu-abierto .velo { position: fixed; inset: 0; background: rgba(15, 30, 24, 0.45); z-index: 55; }
  .barra .boton-menu { display: inline-flex; }
  .barra { padding: 8px 14px; gap: 8px; }
  .barra .ocultar-movil { display: none; }
  .pagina { padding: 16px 16px 40px; }
  h1 { font-size: 25px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 14px 12px; gap: 10px; min-height: 76px; }
  .kpi .cifra { font-size: 24px; }
  .pestanas a, .pestanas button { padding: 7px 14px; flex: 1; text-align: center; }
  .papel { padding: 14px; }
  .filtros select, .filtros input { flex: 1 1 140px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .modal .cuerpo { padding: 14px; }
  .tabla.apilable thead { display: none; }
  .tabla.apilable tr { display: block; border-bottom: 1px solid var(--linea); padding: 8px 4px; }
  .tabla.apilable td { display: flex; justify-content: space-between; gap: 10px; border: none; padding: 4px 8px; text-align: right; }
  .tabla.apilable td::before { content: attr(data-t); font-weight: 600; color: var(--texto-2); text-align: left; }
  .tabla.apilable td.persona-td::before { display: none; }
  .barras-h .fila { grid-template-columns: 90px 1fr 46px; }
}
@media (max-width: 340px) { .kpis { grid-template-columns: 1fr; } }

/* ── Pantallas táctiles y celulares: objetivos cómodos para el dedo ─────────
   Mínimo recomendado 44 px de alto (Apple) / 48 dp (Android). Los campos usan
   16 px de letra: con menos, el iPhone agranda la pantalla al escribir. */
@media (pointer: coarse), (max-width: 820px) {
  .boton, .chip-barra, .barra button, .campana { min-height: 44px; }
  .boton { display: inline-flex; align-items: center; justify-content: center; }
  .boton.chico { min-height: 40px; padding: 8px 14px; }
  .boton.enlace { min-height: 40px; padding: 8px 10px; }
  .boton.icono-solo, .barra .boton-menu { min-width: 44px; min-height: 44px; }
  .pestanas a, .pestanas button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  button.estado, a.estado { min-height: 36px; padding-top: 6px; padding-bottom: 6px; }
  .chips button, .chips a { min-height: 40px; }
  input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='date'], input[type='month'],
  input[type='time'], input[type='datetime-local'], input[type='search'], input:not([type]), select, textarea { min-height: 44px; font-size: 16px; }
  input[type='checkbox'], input[type='radio'] { width: 22px; height: 22px; }
  .lista-simple li { padding-top: 10px; padding-bottom: 10px; }
}
/* Calendario del equipo en celular: barras de color por día y la lista del mes debajo */
@media (max-width: 820px) {
  .calendario-mes { gap: 2px; }
  .calendario-mes .d { min-height: 48px; padding: 3px; font-size: 11px; }
  .calendario-mes .d small { display: none; }
  .calendario-mes .d .ev { font-size: 0; height: 6px; min-height: 0; padding: 0; margin-top: 2px; pointer-events: none; }
  .agenda-mes { display: block; }
  .agenda-mes li { display: flex; align-items: center; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .menu, .barra, .acciones, .aviso-demo { display: none !important; } .pagina { padding: 0; } }
