:root {
  /* Colores de EQUOS (equos.marketing) */
  --ink: #17161a;
  --muted: #6a696c;
  --line: #e4e3e8;
  --bg: #f5f5f7;
  --card: #fff;
  --acc: #4200ff;
  --acc-dark: #3400cc;
  --acc-soft: #efeaff;
  --ok: #1d8556;
  --warn: #c27c0e;
  --bad: #c0392b;
  --r: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--acc); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Cabecera */
.top { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; gap: 14px; min-height: 54px; }
.brand { color: #fff; font-weight: 800; text-decoration: none; white-space: nowrap; letter-spacing: .02em; font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", sans-serif; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--acc); margin-right: 8px; vertical-align: 1px; }
h1, h2, .stat b, .login-title { font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", sans-serif; letter-spacing: -.01em; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a, .me a { color: #cfcdd6; text-decoration: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; font-size: 14px; }
.nav a:hover, .me a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a.on, .me a.on { background: var(--acc); color: #fff; }
.me { display: flex; align-items: center; gap: 4px; }
.me form { margin: 0; }
.linkbtn { background: none; border: 0; color: #cfcdd6; cursor: pointer; font: inherit; font-size: 14px; padding: 6px 8px; }
.linkbtn:hover { color: #fff; }

main.wrap { padding-top: 22px; padding-bottom: 48px; }
h1 { font-size: 22px; margin: 0 0 2px; line-height: 1.25; }
h2 { font-size: 16px; margin: 0 0 12px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.sub, .muted { color: var(--muted); }
.sub { margin: 0; }

/* Tarjetas y cifras */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { display: block; font-size: 21px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat.hi { border-color: var(--acc); background: var(--acc-soft); }

/* Botones */
.btn {
  display: inline-block; background: var(--acc); color: #fff; border: 1px solid var(--acc); border-radius: 8px;
  padding: 9px 15px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: var(--acc-dark); border-color: var(--acc-dark); }
.btn.sec:hover { background: var(--acc-soft); border-color: var(--acc-soft); color: var(--acc-dark); }
.btn.danger:hover { background: #fdecea; border-color: #efc6c0; color: var(--bad); }
.btn.sec { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.danger { background: #fff; color: var(--bad); border-color: #efc6c0; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* Tablas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card.table-wrap { padding: 4px 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover td { background: #faf9ff; }
tfoot td { font-weight: 700; border-bottom: 0; }
td small, .small { font-size: 12px; color: var(--muted); }
.nowrap { white-space: nowrap; }

/* Formularios */
.form { display: grid; gap: 14px; max-width: 600px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; font-size: 14px; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=month], input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #cdd3da; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
  min-height: 40px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--acc-soft); border-color: var(--acc); }
a:focus-visible, button:focus-visible { outline: 3px solid #b9a6ff; outline-offset: 2px; }
textarea { min-height: 84px; resize: vertical; }
.help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters > div { flex: 1 1 150px; }
.filters .f-btn { flex: 0 0 auto; }
.filters .quick { flex-basis: 100%; font-size: 13px; color: var(--muted); }

/* Mensajes */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash-ok { background: #e5f5ec; color: #145c3b; }
.flash-error, .errors { background: #fdecea; color: #8c2a1f; }
.flash-info { background: var(--acc-soft); color: #2a0a99; }
.errors { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.errors ul { margin: 0; padding-left: 18px; }

/* Barras y etiquetas */
.barbox { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.barbox small { font-variant-numeric: tabular-nums; min-width: 40px; }
.bar { flex: 1; height: 8px; background: #e9ecf0; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.bar span.warn { background: var(--warn); }
.bar span.over { background: var(--bad); }
.bar.big { height: 12px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #e9ecf0; color: var(--muted); font-weight: 600; vertical-align: middle; }
.badge.on { background: var(--acc-soft); color: var(--acc); }
.neg { color: var(--bad); }
.pos { color: var(--ok); }
.empty { color: var(--muted); text-align: center; padding: 22px 10px; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.mb { margin-bottom: 16px; }

/* Login */
.login { max-width: 400px; margin: 7vh auto 0; }
.login-title { text-align: center; margin-bottom: 16px; }


/* Buscador en desplegables */
.combo { position: relative; }
.combo-sel { position: absolute !important; opacity: 0; pointer-events: none; height: 1px !important; min-height: 0 !important; width: 1px !important; bottom: 0; left: 0; padding: 0 !important; border: 0 !important; }
.combo-in { padding-right: 30px !important; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236a696c' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right 11px center; }
.combo-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid #cdd3da; border-radius: 8px; box-shadow: 0 8px 24px rgba(20,30,40,.12); max-height: 260px; overflow-y: auto; }
.combo-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.combo-list li.act, .combo-list li:hover { background: var(--acc-soft); }
.combo-list li.sel { font-weight: 600; }
.combo-list li.combo-empty { color: var(--muted); }
.combo-list li.combo-none { color: var(--muted); cursor: default; }

/* Formulario de horas */
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.resumen { background: var(--acc-soft); color: var(--acc); font-weight: 600; padding: 10px 12px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.radios { display: flex; gap: 16px; flex-wrap: wrap; }
.radios label { font-weight: 400; font-size: 14px; display: flex; gap: 6px; align-items: center; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; display: grid; gap: 10px; }
legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.badge.warn { background: #fdf1dc; color: #8a5a06; }
.bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.bulk input[type=text] { width: auto; flex: 0 1 180px; min-height: 34px; padding: 6px 10px; }
td.chk, th.chk { width: 28px; padding-right: 0; }
.right { text-align: right; }
.tot-row td { background: #f7f8fa; }
.ganado b { font-size: 26px; }
.mesnav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mesnav input { width: auto; }

/* Marcas */
.badge.marca { background: #eef1f4; background: color-mix(in srgb, var(--mc) 14%, white); color: #33404d; color: color-mix(in srgb, var(--mc) 62%, black); }
.marcas-radio { display: flex; gap: 8px; flex-wrap: wrap; }
.mr { position: relative; margin: 0; }
.mr input { position: absolute; opacity: 0; pointer-events: none; }
.mr span { display: inline-block; padding: 9px 18px; border: 2px solid var(--line); border-radius: 999px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--muted); background: #fff; letter-spacing: .02em; }
.mr input:checked + span { border-color: var(--mc); background: var(--mc); color: var(--mt, #fff); }
.mr input:focus-visible + span { outline: 2px solid var(--mc); outline-offset: 2px; }
.mr input:disabled + span { opacity: .45; cursor: not-allowed; }
.logo-prev { max-height: 56px; max-width: 220px; display: block; margin: 6px 0; }
.avisos { display: grid; gap: 8px; margin-bottom: 16px; }
.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.aviso::before { content: "!"; font-weight: 800; width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; color: #fff; }
.aviso.warn { background: #fdf1dc; color: #6e4705; } .aviso.warn::before { background: #c27c0e; }
.aviso.error { background: #fdecea; color: #8c2a1f; } .aviso.error::before { background: #c0392b; }
.aviso.info { background: var(--acc-soft); color: #2a0a99; } .aviso.info::before { background: var(--acc); content: "i"; }
.qr { width: 220px; height: 220px; background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.codigo { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; letter-spacing: .08em; background: #f4f5f7; padding: 8px 10px; border-radius: 6px; word-break: break-all; }
.codigos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
input.otp { font-size: 24px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; fill: #6a696c; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; outline: none; }
.chart .hit:hover, .chart .hit:focus { fill: rgba(27,36,48,.05); }
.chart-wrap { position: relative; }
.tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(20,30,40,.12); padding: 8px 10px; font-size: 13px; min-width: 150px; z-index: 5; }
.tip .t { font-weight: 600; margin-bottom: 4px; }
.tip .f { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .f span { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tip .f i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; }
.tip .f b { font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
.legend i.linea { height: 3px; border-radius: 2px; vertical-align: 3px; }
.legend i.discontinua { height: 0; border-top: 2px dashed #6a696c; background: none !important; vertical-align: 3px; }

@media (max-width: 720px) {
  .top-in { flex-wrap: wrap; gap: 4px 10px; padding-top: 8px; padding-bottom: 6px; }
  .nav { order: 3; flex-basis: 100%; }
  .me { margin-left: auto; }
  .grid2, .row2 { grid-template-columns: 1fr; }
  /* Tablas apiladas en el móvil: cada fila es una ficha */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tfoot, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.stack tbody tr:hover td { background: none; }
  table.stack td { border: 0; padding: 3px 2px; text-align: left; white-space: normal; }
  table.stack td.n { text-align: left; }
  table.stack td[data-l]::before { content: attr(data-l); display: inline-block; min-width: 40%; color: var(--muted); font-size: 12px; font-weight: 400; }
  table.stack td:empty, table.stack td.chk:empty { display: none; }
  table.stack td.chk { float: right; width: auto; }
  table.stack td.first { font-size: 15px; }
  table.stack .actions { margin-top: 4px; }
  table.stack tfoot tr { border-bottom: 0; background: #f7f8fa; border-radius: 8px; padding: 8px; }
  .card.table-wrap { padding: 4px 12px; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 > :last-child { grid-column: 1 / -1; }
  h1 { font-size: 20px; }
  .stat b { font-size: 18px; }
}
