/* Checador Busmen: barra lateral fija + área de trabajo. Sin Tailwind (antes se compilaba en el navegador). */
:root {
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --surface-2: #EBEFF5;
  --line: #D5DCE6;
  --fg: #16213A;
  --muted: #5A6781;
  --ink: #13233F;
  --accent: #E2601C;
  --accent-dark: #C24E12;
  --accent-soft: #FCE7DA;
  --ok: #1F8A4C;   --ok-soft: #DDF3E6;
  --warn: #A86B12; --warn-soft: #FBF0D6;
  --crit: #C2362F; --crit-soft: #FADEDC;
  --info: #2563A8; --info-soft: #DCE9F7;
  --na: #6B7689;   --na-soft: #E6E9EF;
  --side: #13233F; --side-fg: #C3CDDC;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.5; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--ink); margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
a { color: var(--info); }
code, .mono { font-family: var(--mono); font-size: .9em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Layout */
.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-fg); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; text-decoration: none; }
.brand img { height: 34px; width: auto; background: #fff; border-radius: 6px; padding: 3px 6px; }
.brand span { font-family: var(--display); font-weight: 800; color: #fff; font-size: 13px; letter-spacing: .06em; line-height: 1.1; }
.nav { display: block; color: var(--side-fg); text-decoration: none; font-size: 14.5px; padding: 9px 12px; border-radius: 6px; }
.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav.on { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-sep { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #7D8BA3; padding: 14px 12px 4px; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 12px 8px 0; display: grid; gap: 8px; font-size: 12.5px; color: #93A1B8; }
.side-foot b { color: #7EDCA5; font-weight: 600; }
.side-foot b.viejo { color: #F3B37A; }
.side-foot .btn { width: 100%; justify-content: center; }
.side-foot a { color: #93A1B8; }
.btn.menu-btn { display: none; }

.main { padding: 22px 28px 48px; display: grid; gap: 18px; align-content: start; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin-right: auto; }
.sub { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .app.menu-abierto .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .btn.menu-btn { display: inline-flex; }
  .main { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* Controles */
.btn { display: inline-flex; align-items: center; gap: 6px; font: 600 14px var(--body); padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.pri:hover { background: var(--accent-dark); }
.btn.danger { color: var(--crit); border-color: var(--crit); background: var(--surface); }
.btn.danger:hover { background: var(--crit-soft); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.side-btn { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.18); }
.btn:disabled { opacity: .55; cursor: wait; }
label.f { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
input[type=date], input[type=month], input[type=text], input[type=search], select {
  font: 14px var(--body); padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--info-soft); border-color: var(--info); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { font: 13.5px var(--body); padding: 7px 12px; border: 0; border-right: 1px solid var(--line); background: none; color: var(--fg); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: #fff; font-weight: 600; }
.seg button .n { font-family: var(--mono); font-size: 12px; opacity: .75; margin-left: 4px; }

/* Paneles y KPIs */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; min-width: 0; align-content: start; }
.panel.flush { padding: 0; overflow: hidden; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; text-decoration: none; color: inherit; }
a.kpi:hover { border-color: var(--muted); }
.kpi .k { font-family: var(--mono); font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.kpi .v { font-family: var(--display); font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi .d { font-size: 13px; color: var(--muted); }
.kpi.ok .v { color: var(--ok); } .kpi.warn .v { color: var(--warn); } .kpi.crit .v { color: var(--crit); } .kpi.info .v { color: var(--info); }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Avisos */
.alert { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 10px 14px; border-radius: 6px; border: 1px solid transparent; }
.alert.crit { background: var(--crit-soft); color: var(--crit); border-color: color-mix(in srgb, var(--crit) 25%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--info-soft); color: var(--info); }
.banner-ro { background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 6px; }

/* Chips y etiquetas de estado */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.c-ok { background: var(--ok-soft); color: var(--ok); } .c-crit { background: var(--crit-soft); color: var(--crit); }
.c-warn { background: var(--warn-soft); color: var(--warn); } .c-info { background: var(--info-soft); color: var(--info); }
.c-na { background: var(--na-soft); color: var(--na); }
.pill { display: inline-block; font: 700 11.5px var(--mono); padding: 1px 8px; border-radius: 4px; white-space: nowrap; line-height: 1.6; }
.p-ok { background: var(--ok-soft); color: var(--ok); }
.p-retardo { background: var(--warn-soft); color: var(--warn); }
.p-excedido { background: var(--accent-soft); color: var(--accent-dark); }
.p-incompleto { background: var(--crit-soft); color: var(--accent-dark); }
.p-turno { background: var(--info-soft); color: var(--info); }
.p-incidencia { background: var(--info-soft); color: var(--info); }
.p-falta { background: var(--crit-soft); color: var(--crit); }
.p-na { background: var(--na-soft); color: var(--na); }
.pill-mini { font-size: 10px; padding: 0 5px; margin-left: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); align-items: center; }

/* Barras horizontales */
.bars { display: grid; gap: 9px; }
.brow { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 52px; gap: 10px; align-items: center; font-size: 13px; }
.brow > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btrack { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.btrack b { display: block; height: 100%; border-radius: 5px; }
.brow .pc { font-family: var(--mono); text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Tarjetas de checadores */
.devs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.dev { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; align-content: start; }
.dev.off { border-color: var(--crit); box-shadow: inset 0 3px 0 var(--crit); }
.dev .top { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.dev .name { font-weight: 700; font-size: 14px; }
.dev .ip { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.dev dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 13px; }
.dev dt { color: var(--muted); }
.dev dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.dev .err { font-size: 12px; color: var(--crit); word-break: break-word; }
.dev .probar { justify-self: start; }
.dev .diag { border-top: 1px dashed var(--line); padding-top: 8px; display: grid; gap: 6px; }
.dev .diag dd { word-break: break-word; white-space: nowrap; }
.dev .diag .chip { font-size: 11px; }
.dev .concl { margin: 0; font-size: 12.5px; font-weight: 600; }
.dev .concl.ok { color: var(--ok); } .dev .concl.warn { color: var(--warn); } .dev .concl.crit { color: var(--crit); }

/* Calendario */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: center; text-transform: uppercase; }
.cal .day { border: 1px solid var(--line); border-radius: 6px; padding: 6px 7px; min-height: 76px; display: grid; gap: 3px; align-content: start; background: var(--surface); font-size: 12px; }
.cal .day .n { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.cal .day .h { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.cal .day.vacio { border: 0; background: none; }
.cal .day.domingo { background: var(--surface-2); }

/* Huellas */
.manos { display: flex; justify-content: center; gap: 14px 12px; flex-wrap: wrap; padding: 8px 0 4px; }
.mano { position: relative; display: grid; justify-items: center; gap: 4px; padding: 0 5px 10px; }
.mano::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 52px; border: 1.5px solid var(--line);
  border-radius: 12px 12px 30px 30px; background: linear-gradient(var(--surface-2), var(--surface)); }
.mano .dedos { position: relative; display: flex; align-items: flex-end; gap: 2px; }
.mano b { position: relative; font-size: 12.5px; }
.mano b small { font: 600 11px var(--mono); color: var(--muted); margin-left: 4px; }
.dedo { width: 35px; display: grid; justify-items: center; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--muted); }
.dedo .forma { width: 28px; height: var(--alto); border: 2px dashed var(--line); border-bottom: 0; border-radius: 14px 14px 3px 3px;
  background: var(--surface); display: grid; justify-items: center; align-content: start; padding-top: 6px; position: relative;
  transition: transform .12s ease, border-color .12s ease; }
.dedo .forma svg { width: 18px; height: 18px; color: var(--line); }
.dedo .nombre { font-size: 10px; font-weight: 600; white-space: nowrap; }
.dedo.ok .forma { border: 2px solid var(--ok); border-bottom: 0; background: var(--ok); }
.dedo.ok .forma svg { color: #fff; }
.dedo.ok .nombre { color: var(--ok); }
.dedo.ok .forma::after { content: "✓"; position: absolute; top: -7px; right: -7px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); color: var(--ok); border: 1.5px solid var(--ok); font: 700 10px/13px var(--body); text-align: center; }
.dedo:hover .forma, .dedo:focus-visible .forma { transform: translateY(-3px); border-color: var(--accent); }
.dedo:hover .forma svg, .dedo:focus-visible .forma svg { color: var(--accent); }
.dedo.ok:hover .forma svg, .dedo.ok:focus-visible .forma svg { color: #fff; }
.dedo:focus-visible { outline: none; }
.dedo:focus-visible .nombre { color: var(--accent); text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .dedo .forma { transition: none; } }

/* ag-Grid (tema Quartz) */
.ag-theme-quartz {
  --ag-font-family: var(--body);
  --ag-font-size: 13.5px;
  --ag-header-background-color: var(--surface-2);
  --ag-header-foreground-color: var(--muted);
  --ag-border-color: var(--line);
  --ag-row-hover-color: #F6F8FB;
  --ag-active-color: var(--accent);
  --ag-wrapper-border-radius: 8px;
  --ag-cell-horizontal-padding: 12px;
}
.ag-theme-quartz .ag-header-cell-text { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.ag-theme-quartz .t { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ag-theme-quartz .domingo { background: var(--surface-2); }
.grid-box { height: calc(100vh - 290px); min-height: 420px; width: 100%; }

/* Tablas simples */
table.simple { border-collapse: collapse; width: 100%; font-size: 14px; }
table.simple th, table.simple td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
table.simple th { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }

/* Esqueleto de carga */
.skel { height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sh 1.4s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--side); }
.login form { background: var(--surface); border-radius: 10px; padding: 32px 28px; width: min(380px, 100%); display: grid; gap: 16px; }
.login img { height: 56px; justify-self: center; }
.login .btn { justify-content: center; padding: 10px; }
