/* VV-PPDigital · estilos base (mobile-first) */
:root {
    --brand: #1b2a6b;
    --brand-2: #2a78d6;
    --bg: #f4f5f8;
    --surface: #ffffff;
    --border: #e3e5ec;
    --text: #14161f;
    --text-secondary: #52566a;
    --muted: #7b8094;
    --grid: #eceef3;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --ok: #0f8a4f;
    --ok-bg: #e6f6ee;
    --warn: #9a6400;
    --warn-bg: #fff4dc;
    --error: #c42b2b;
    --error-bg: #fdeaea;
    --info-bg: #e8f1fc;
    --hot: #e34948;
    --warm: #eda100;
    --cold: #5a8fd6;
    --none: #c9ccd6;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(20, 22, 31, .06), 0 4px 16px rgba(20, 22, 31, .05);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
code { font-size: .85em; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.lead { font-size: 1.05rem; color: var(--text-secondary); }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .25rem; font-weight: 600; }

.container { max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }
.container--narrow { max-width: 720px; }

/* ---------- Topbar ---------- */
.topbar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar__inner { max-width: 1280px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand__mark { background: #fff; color: var(--brand); border-radius: 8px; padding: 3px 7px; font-size: .8rem; font-weight: 800; }
.brand__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }
.nav-toggle { margin-left: auto; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; font-size: 1.1rem; padding: 4px 10px; cursor: pointer; }
.nav { display: none; width: 100%; flex-direction: column; padding: 4px 0 12px; }
.nav-open .nav { display: flex; }
.nav a { color: rgba(255,255,255,.85); padding: 9px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.nav a.is-active { background: rgba(255,255,255,.16); color: #fff; }
.nav__user { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px 0; border-top: 1px solid rgba(255,255,255,.15); margin-top: 6px; font-size: .9rem; }
.nav__user small { display: block; color: rgba(255,255,255,.65); font-size: .75rem; }
.nav__user form { margin: 0; }
.nav__user .btn { color: #fff; border-color: rgba(255,255,255,.35); }

@media (min-width: 980px) {
    .nav-toggle { display: none; }
    .nav { display: flex; flex-direction: row; align-items: center; width: auto; flex: 1; padding: 0; gap: 2px; }
    .nav__user { margin: 0 0 0 auto; border: 0; padding: 0; }
}

/* ---------- Público ---------- */
.public { background: var(--bg); }
.hero { background: linear-gradient(135deg, var(--brand) 0%, #2d3f99 60%, var(--brand-2) 130%); color: #fff; padding: 36px 16px 72px; text-align: center; }
.hero__brand { color: #fff; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.hero__brand:hover { text-decoration: none; }
.hero__meta { margin: 6px 0 0; opacity: .85; }
.public__main { margin-top: -56px; }
.public__footer { text-align: center; font-size: .85rem; color: var(--muted); padding: 0 16px 32px; }

/* ---------- Cards / layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card--form { max-width: 860px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card__head h2 { margin: 0; }
.empty { text-align: center; padding: 40px 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head--compact { align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }
.actions--center { justify-content: center; margin: 16px 0 8px; }
.actions-cell { text-align: right; white-space: nowrap; }
.grid-2, .grid-3 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
.grid-2--wide { gap: 16px; }
@media (min-width: 720px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.grid-dash { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grid-dash .card { margin: 0; min-width: 0; }
@media (min-width: 980px) {
    .grid-dash { grid-template-columns: 2fr 1fr; }
    .card--span { grid-column: 1 / -1; }
}

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: .92rem; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; min-height: 40px; transition: background .15s, border-color .15s; }
.btn:hover { text-decoration: none; border-color: #c9cdd9; background: #fafbfd; }
.btn:disabled { opacity: .6; cursor: default; }
.btn--primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn--primary:hover { background: #1f68c0; border-color: #1f68c0; }
.btn--ghost { background: transparent; }
.btn--sm { padding: 5px 11px; min-height: 32px; font-size: .84rem; }
.btn--lg { padding: 13px 22px; font-size: 1rem; min-height: 50px; }
.btn--block { width: 100%; }

/* ---------- Formularios ---------- */
.form { display: flex; flex-direction: column; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; border: 0; padding: 0; min-width: 0; }
.field > span, .field legend { font-weight: 600; font-size: .88rem; color: var(--text-secondary); padding: 0; margin-bottom: 5px; }
.field small { color: var(--muted); font-size: .8rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
    font: inherit; font-size: 16px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand-2) 40%, transparent); border-color: var(--brand-2); }
textarea { resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0 10px; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--brand-2); }
.check--inline { align-self: end; margin-bottom: 22px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: .88rem; cursor: pointer; user-select: none; }
.chip input:checked + span { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters input { flex: 1 1 240px; }
.filters select { flex: 0 1 220px; width: auto; }

/* ---------- Alertas / tags ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; border: 1px solid transparent; }
.alert--success { background: var(--ok-bg); color: var(--ok); border-color: #bfe6d1; }
.alert--error { background: var(--error-bg); color: var(--error); border-color: #f4c4c4; }
.alert--info { background: var(--info-bg); color: #1b4f8f; border-color: #c7dcf5; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: #eef0f4; color: var(--text-secondary); white-space: nowrap; }
.tag--ok { background: var(--ok-bg); color: var(--ok); }
.tag--caliente { background: #fde8e8; color: #b42323; }
.tag--tibio { background: var(--warn-bg); color: var(--warn); }
.tag--frio { background: #e6eefb; color: #2b5ea8; }
.tag--none { background: #f0f1f4; color: var(--muted); }
.tag--follow { background: #efe9fb; color: #5b3aa8; }
.tag--r-new { background: var(--ok-bg); color: var(--ok); }
.tag--r-repeat, .tag--r-already_in { background: var(--warn-bg); color: var(--warn); }
.tag--r-invalid { background: var(--error-bg); color: var(--error); }
.pill { display: inline-block; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: .9rem; }
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--info { background: var(--warn-bg); color: var(--warn); }
.pill--error { background: var(--error-bg); color: var(--error); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(6, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); border-top: 3px solid transparent; }
.kpi__label { font-size: .78rem; color: var(--text-secondary); font-weight: 600; }
.kpi__value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpis--big .kpi__value { font-size: 2rem; }
.kpi__sub { font-size: .78rem; color: var(--muted); }
.kpi--hot { border-top-color: var(--hot); }
.kpi--warm { border-top-color: var(--warm); }
.kpi--cold { border-top-color: var(--cold); }
.progress { height: 6px; background: var(--grid); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.progress--inline { display: inline-block; width: 80px; vertical-align: middle; margin: 0 6px 0 0; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-left: 4px; vertical-align: middle; animation: pulse 2s infinite; }
.live-dot.is-off { background: var(--error); animation: none; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap.card { padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: #fafbfc; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .notes { max-width: 320px; font-size: .85rem; color: var(--text-secondary); }
.table--sm td, .table--sm th { padding: 6px 8px; font-size: .82rem; }
tr.is-muted td { opacity: .55; }
.segbar { display: flex; gap: 2px; height: 8px; width: 160px; max-width: 100%; margin: 4px 0; }
.seg { display: block; border-radius: 2px; min-width: 4px; }
.seg--hot { background: var(--hot); }
.seg--warm { background: var(--warm); }
.seg--cold { background: var(--cold); }
.seg--none { background: var(--none); }
.pager { display: flex; gap: 12px; justify-content: center; align-items: center; margin: 12px 0; }

/* ---------- Listas ---------- */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list__item { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--grid); color: var(--text); }
.list__item:last-child { border-bottom: 0; }
a.list__item:hover { background: #fafbfd; text-decoration: none; }
.list__main { display: flex; flex-direction: column; min-width: 0; }
.list__main .muted { font-size: .85rem; }
.list__note { font-size: .82rem; color: var(--text-secondary); margin-top: 3px; }
.list__side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.list--compact { box-shadow: none; margin-top: 10px; }
.list--compact:empty { display: none; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--grid); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; word-break: break-word; }

/* ---------- Escáner ---------- */
.scan-layout { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .scan-layout { grid-template-columns: 1fr 1fr; align-items: start; } }
.reader { width: 100%; min-height: 260px; background: #0f1222; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.reader video { width: 100% !important; height: auto !important; }
.reader__msg { color: #fff; padding: 20px; text-align: center; margin: 0; }
.reader:empty::after { content: "Cámara apagada"; color: rgba(255,255,255,.55); }
.scan-controls { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.scan-controls .btn { flex: 1; }
.scan-controls select { flex: 1 1 100%; }
.manual { display: flex; gap: 8px; margin-bottom: 8px; }
.manual input { flex: 1; min-width: 0; text-transform: uppercase; }
.manual input::placeholder { text-transform: none; }
.result-card { border-top: 4px solid var(--ok); }
.result-card.is-repeat { border-top-color: var(--warm); }
.result__status { margin-bottom: 10px; }
.result-card h2 { font-size: 1.35rem; margin: 0; }
.rating { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.rating input { position: absolute; opacity: 0; }
.rating__opt { display: block; text-align: center; padding: 12px 6px; border: 2px solid var(--border); border-radius: 10px; font-weight: 700; cursor: pointer; user-select: none; }
.rating input:focus-visible + .rating__opt { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.rating input:checked + .rating__opt--hot { background: #fde8e8; border-color: var(--hot); color: #b42323; }
.rating input:checked + .rating__opt--warm { background: var(--warn-bg); border-color: var(--warm); color: var(--warn); }
.rating input:checked + .rating__opt--cold { background: #e6eefb; border-color: var(--cold); color: #2b5ea8; }

.counter { font-size: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 16px; }
.counter strong { font-size: 1.3rem; }
.checkin-result { display: flex; gap: 16px; align-items: center; border-width: 2px; }
.checkin-result__icon { width: 64px; height: 64px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; color: #fff; }
.checkin-result__msg { font-weight: 700; text-transform: uppercase; font-size: .85rem; letter-spacing: .04em; }
.checkin-result__name { font-size: 1.4rem; font-weight: 800; }
.checkin-result.is-ok { border-color: var(--ok); background: var(--ok-bg); }
.checkin-result.is-ok .checkin-result__icon { background: var(--ok); }
.checkin-result.is-warn { border-color: var(--warm); background: var(--warn-bg); }
.checkin-result.is-warn .checkin-result__icon { background: var(--warm); }
.checkin-result.is-error { border-color: var(--error); background: var(--error-bg); }
.checkin-result.is-error .checkin-result__icon { background: var(--error); }

/* ---------- Dashboard ---------- */
.chart { position: relative; height: 280px; }
.feed { list-style: none; margin: 0; padding: 0; max-height: 330px; overflow-y: auto; font-size: .87rem; }
.feed__item { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--grid); }
.feed__item time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.feed__item em { color: var(--muted); font-style: normal; font-size: .8rem; }
.feed__item--invalid strong { color: var(--error); }
.bars { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.bars__row { display: grid; grid-template-columns: 90px 1fr 36px; gap: 8px; align-items: center; font-size: .82rem; }
.bars__label { color: var(--muted); font-variant-numeric: tabular-nums; }
.bars__bar { height: 12px; background: var(--grid); border-radius: 4px; overflow: hidden; }
.bars__bar span { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.bars__val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.timeline time { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.timeline p { margin: 4px 0; }

/* ---------- Gafete ---------- */
.badge { background: #fff; border-radius: 18px; box-shadow: var(--shadow); border: 1px solid var(--border); max-width: 380px; margin: 0 auto; overflow: hidden; text-align: center; padding-bottom: 20px; }
.badge__head { background: var(--brand); color: #fff; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.badge__event { font-weight: 700; text-align: left; }
.badge__type { font-size: .72rem; font-weight: 800; letter-spacing: .12em; background: rgba(255,255,255,.18); padding: 3px 8px; border-radius: 6px; }
.badge__qr { width: 260px; max-width: 80%; margin: 20px auto 10px; }
.badge__qr svg { width: 100%; height: auto; display: block; }
.badge__qr--sm { width: 180px; margin: 0 auto 8px; }
.badge__name { font-size: 1.5rem; font-weight: 800; padding: 0 16px; line-height: 1.2; }
.badge__company { color: var(--text-secondary); padding: 2px 16px 0; }
.badge__code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; letter-spacing: .05em; color: var(--muted); margin-top: 10px; }
.badge__status { margin: 12px 16px 0; background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 6px; font-weight: 600; font-size: .85rem; }

@media print {
    .hero, .public__footer, .no-print, .alert, .topbar { display: none !important; }
    body { background: #fff; }
    .public__main { margin: 0; }
    .badge { box-shadow: none; border: 1px solid #000; }
    .badge__head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
