:root { --head:#fff; --head-txt:#0f172a; --menu:#0f172a; --menu-txt:#cbd5e1; --menu-sel:#fff; --accent:#dc2626; --btn:#dc2626; --btn-txt:#fff; --text:#1e293b; --bg:#f1f5f9;
  --card:#fff; --muted:#64748b; --line:#e2e8f0; --ok:#15803d; --ok-bg:#dcfce7; --err:#b91c1c; --err-bg:#fee2e2; --warn:#b45309; --warn-bg:#fef3c7;
  --info:#1d4ed8; --info-bg:#dbeafe; --na:#475569; --na-bg:#e2e8f0; --radius:14px; --shadow:0 1px 2px rgba(15,23,42,.06),0 4px 16px rgba(15,23,42,.04); }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0; letter-spacing: -.01em; } h2 { font-size: 1.05rem; margin: 0 0 .8em; } h3 { font-size: .95rem; margin: 0 0 .5em; }
.muted { color: var(--muted); font-weight: normal; } .center { text-align: center; } .hidden { display: none !important; }
.ic { flex: 0 0 auto; }
/* Menú lateral */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--menu); color: var(--menu-txt); display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; text-decoration: none; color: var(--menu-sel); border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { max-width: 48px; max-height: 40px; border-radius: 6px; background: #fff; padding: 2px; }
.brand-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #fff; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; } .brand-txt b { font-size: 15px; } .brand-txt small { font-size: 11px; opacity: .7; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a, .logout button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--menu-txt); text-decoration: none; font-weight: 500; font-size: 14.5px; }
.sidebar nav a:hover, .logout button:hover { background: rgba(255,255,255,.07); }
.sidebar nav a.active { background: color-mix(in srgb, var(--accent) 85%, transparent); color: var(--menu-sel); }
.logout { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); } .logout button { width: 100%; background: none; border: 0; cursor: pointer; font: inherit; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 24px; margin-left: 248px;
  background: var(--head); color: var(--head-txt); border-bottom: 1px solid var(--line); }
.top-title { font-weight: 700; display: none; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.who-txt { display: flex; flex-direction: column; line-height: 1.15; font-weight: 600; } .who-txt small { font-weight: 400; opacity: .7; font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.menu-btn { display: none; background: none; border: 0; color: inherit; cursor: pointer; padding: 4px; }
.scrim { display: none; }
main { padding: 24px; max-width: 1280px; }
body.has-nav main { margin-left: 248px; }
@media (max-width: 960px) {
  .menu-btn, .top-title { display: block; } .who-txt { display: none; }
  .topbar { margin-left: 0; padding: 0 12px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; } body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; }
  body.has-nav main { margin-left: 0; } main { padding: 14px; }
}
/* Componentes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card > h2:first-child { display: flex; align-items: center; gap: 8px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font: inherit; font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--btn-txt); } .btn.primary:hover { filter: brightness(.93); }
.btn.danger { color: var(--err); border-color: #fecaca; } .btn.danger:hover { background: var(--err-bg); }
.btn.warn { color: var(--warn); border-color: #fde68a; } .btn.info { color: var(--info); border-color: #bfdbfe; }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.big { min-height: 54px; padding: 12px 24px; font-size: 16px; border-radius: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin: 12px 0 0; }
.actions.center { justify-content: center; } .actions.left { justify-content: flex-start; }
td.acts { white-space: nowrap; } td.acts > * { margin: 2px 4px 2px 0; } td.acts form { display: inline; }
.form label, label.form { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13.5px; margin-bottom: 14px; color: #334155; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; width: 100%; color: var(--text); font-weight: normal; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
input:disabled, input[readonly] { background: #f8fafc; color: var(--muted); }
input[type=color] { padding: 2px; height: 42px; }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.grid2 .span2, .grid3 .span3, .grid3 .span2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.form-section { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 6px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; } legend { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; color: #334155; }
.choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice { flex: 1 1 220px; flex-direction: row !important; margin: 0 !important; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: block; width: 100%; padding: 14px; border: 2px solid var(--line); border-radius: 12px; text-align: center; cursor: pointer; font-weight: 600; }
.choice input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, #fff); color: var(--accent); }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; } .check input { width: 18px; height: 18px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.checks label { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; } .row input, .row select { flex: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 14px; }
.chip { border: 1px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.hl input { border: 2px solid var(--accent); }
.info { background: var(--info-bg); color: #1e3a8a; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 10px; background: var(--warn-bg); color: #78350f; border-left: 4px solid #f59e0b; }
.alert.crit { background: var(--err-bg); color: #7f1d1d; border-left-color: var(--err); } .alert small { display: block; opacity: .8; margin-top: 2px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); min-width: 200px; flex: 1 1 200px; max-width: 320px; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--ok-bg); color: #14532d; font-weight: 600; border: 1px solid #bbf7d0; }
.flash.err { background: var(--err-bg); color: #7f1d1d; border-color: #fecaca; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #e2e8f0; color: #334155; vertical-align: middle; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.sm { font-size: 10px; padding: 1px 6px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.tbl th:first-child { border-top-left-radius: 8px; } .tbl th:last-child { border-top-right-radius: 8px; }
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover td { background: #fafbfc; }
.tbl .row-danger td { background: #fff5f5; }
.tbl.compact td { padding: 7px 10px; }
@media (max-width: 760px) {
  .tbl thead { display: none; } .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 8px 12px; }
  .tbl td { border: 0; padding: 3px 0; } .tbl td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12px; }
  td.acts { white-space: normal; padding-top: 8px !important; }
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; transition: transform .15s; }
.stat:hover { transform: translateY(-2px); }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #94a3b8; }
.stat b { font-size: 2rem; line-height: 1.1; } .stat span { color: var(--muted); font-weight: 600; font-size: 13px; }
.stat.warn::before { background: #f59e0b; } .stat.ok::before { background: #22c55e; } .stat.err::before { background: #ef4444; } .stat.info::before { background: #3b82f6; } .stat.acc::before { background: var(--accent); }
.stat.active { outline: 2px solid var(--accent); }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.summary > div { display: flex; flex-direction: column; gap: 2px; } .summary .muted { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; }
.dl div { display: flex; flex-direction: column; } .dl span { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); } .dl b { font-weight: 600; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; background: #e2e8f0; padding: 4px; border-radius: 12px; width: fit-content; max-width: 100%; }
.tab { padding: 8px 16px; border-radius: 9px; text-decoration: none; color: #334155; font-weight: 600; font-size: 14px; }
.tab.active { background: #fff; color: var(--accent); box-shadow: var(--shadow); }
.tab .badge { margin-left: 4px; }
.qr-thumb { width: 60px; height: 60px; }
.qr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.qr-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: var(--shadow); }
.qr-card img { width: 140px; height: 140px; } .qr-card b { font-size: 17px; } .qr-card .actions { margin-top: 6px; justify-content: center; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(135deg, var(--menu), color-mix(in srgb, var(--accent) 60%, var(--menu))); }
.login-box { width: 100%; max-width: 400px; } .login-box .brand-big { text-align: center; margin-bottom: 14px; }
.login-box .brand-big img { max-height: 70px; max-width: 200px; } .login-box h1 { text-align: center; font-size: 1.35rem; }
.done-card { max-width: 680px; margin: 30px auto; } .done-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); font-size: 38px; display: grid; place-items: center; margin: 0 auto 10px; }
.net { position: fixed; bottom: 0; left: 0; right: 0; background: #0f172a; color: #fff; padding: 10px 16px; text-align: center; font-size: 14px; z-index: 50; }
.photos { display: flex; gap: 10px; flex-wrap: wrap; } .photos img { max-width: 240px; max-height: 180px; border-radius: 10px; border: 1px solid var(--line); }
.sigs { display: flex; gap: 24px; flex-wrap: wrap; } .sigs div { display: flex; flex-direction: column; align-items: center; } .sigs img { width: 260px; border-bottom: 1px solid #0f172a; }
.res-cumple { color: var(--ok); } .res-no_cumple { color: var(--err); } .res-na { color: var(--na); } .res-pendiente { color: var(--warn); }
/* Página pública del QR */
.pub { max-width: 560px; margin: 0 auto; padding: 16px; }
.pub-head { text-align: center; padding: 22px 16px; border-radius: var(--radius); background: var(--menu); color: #fff; margin-bottom: 16px; }
.pub-head img { max-height: 64px; max-width: 200px; background: #fff; border-radius: 8px; padding: 4px; }
.pub-head h1 { font-size: 1.3rem; margin-top: 8px; } .pub-head p { margin: 4px 0 0; opacity: .8; }
.big-choices { display: grid; gap: 12px; } .big-choices .btn { min-height: 64px; font-size: 17px; }
/* Pantalla de inspección */
.insp-app { max-width: 860px; margin: 0 auto; }
.insp-head h1 { font-size: 1.2rem; }
.insp-head .meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 14px; font-size: 13px; margin: 10px 0; }
.insp-head .meta span b { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.progress { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; } .progress div { height: 100%; background: var(--ok); transition: width .3s; }
.steps { display: flex; gap: 6px; overflow-x: auto; padding-top: 10px; }
.step { flex: 0 0 auto; border: 1px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.step.done { background: var(--ok-bg); border-color: #86efac; color: var(--ok); } .step.cur { outline: 2px solid var(--accent); } .step[disabled] { opacity: .45; }
.sync { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.sync.ok { background: var(--ok-bg); color: var(--ok); } .sync.pending { background: var(--warn-bg); color: var(--warn); }
.q { border-top: 1px solid var(--line); padding: 16px 0; } .q:first-of-type { border-top: 0; }
.q.missing { background: #fff7ed; box-shadow: 0 0 0 2px #fdba74; border-radius: 10px; padding: 14px 10px; }
.q-text { font-weight: 600; margin-bottom: 10px; font-size: 16px; }
.q-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #f1f5f9; font-size: 12px; margin-right: 8px; }
.ans-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 520px) { .ans-grid { grid-template-columns: 1fr 1fr; } }
.ans { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 70px; border-radius: 14px; border: 2px solid #cbd5e1;
  background: #fff; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--text); -webkit-tap-highlight-color: transparent; transition: transform .08s; }
.ans:active { transform: scale(.97); } .ans span { font-size: 24px; line-height: 1; }
.ans-cumple { color: var(--ok); } .ans-no_cumple { color: var(--err); } .ans-na { color: var(--na); } .ans-pendiente { color: var(--warn); }
.ans-cumple.on { background: var(--ok); border-color: var(--ok); color: #fff; } .ans-no_cumple.on { background: var(--err); border-color: var(--err); color: #fff; }
.ans-na.on { background: var(--na); border-color: var(--na); color: #fff; } .ans-pendiente.on { background: #d97706; border-color: #d97706; color: #fff; }
.q details { margin-top: 8px; } .q summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0; } .q textarea { margin-top: 6px; }
.crit-tag { display: none; } .q.is-crit .crit-tag { display: inline-flex; }
.photo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .photo-row { grid-template-columns: 1fr; } }
.photo-slot { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 12px; }
.photo-slot img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; }
.photo-empty { width: 100%; height: 110px; display: grid; place-items: center; background: #f8fafc; border-radius: 8px; color: var(--muted); }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 94%, transparent); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); margin: 0; backdrop-filter: blur(4px); }
canvas.sig { width: 100%; height: 220px; border: 2px dashed #94a3b8; border-radius: 12px; background: #fff; display: block; touch-action: none; }
.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 60; max-width: 90vw; display: none; font-weight: 600; }
.toast.err { background: var(--err); }
.scanner { position: fixed; inset: 0; background: #000; z-index: 70; display: flex; flex-direction: column; }
.scanner video { flex: 1; width: 100%; object-fit: cover; }
.scanner .scan-frame { position: absolute; top: 50%; left: 50%; width: 240px; height: 240px; transform: translate(-50%, -60%); border: 3px solid #fff; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); }
.scanner .scan-bar { padding: 16px; display: flex; gap: 10px; justify-content: center; background: #000; color: #fff; flex-wrap: wrap; text-align: center; }
.preview-box { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; min-height: 220px; }
.preview-box .pv-side { width: 160px; padding: 12px 8px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.preview-box .pv-side span { padding: 7px 10px; border-radius: 8px; } .preview-box .pv-main { flex: 1; display: flex; flex-direction: column; }
.preview-box .pv-head { padding: 12px 14px; font-weight: 700; border-bottom: 1px solid var(--line); } .preview-box .pv-body { padding: 14px; flex: 1; }
.timeline { list-style: none; padding: 0; margin: 0; } .timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
@media print { .noprint, .sidebar, .topbar { display: none !important; } body { background: #fff; } body.has-nav main { margin: 0; } }
.grid2 > *, .grid3 > *, .dl > div, .summary > div { min-width: 0; }
select { text-overflow: ellipsis; }
main { min-width: 0; overflow-wrap: break-word; }
input, select, textarea { min-width: 0; max-width: 100%; } input[type=date], input[type=time] { display: block; -webkit-appearance: none; appearance: none; min-height: 44px; }
.choice { position: relative; } .choice input { width: 1px; height: 1px; left: 0; top: 0; }
.check input, .checks input { flex: 0 0 auto; width: 18px; height: 18px; } .brand-logo { max-width: 110px; max-height: 44px; object-fit: contain; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.comp-grid div { display: flex; flex-direction: column; min-width: 0; } .comp-grid .muted { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.tbl th { white-space: nowrap; }
.big-choices .btn, .btn.big { white-space: normal; text-align: center; }
.q-help { display: block; font-weight: 400; font-size: 13px; margin-top: 2px; }
.card.form .chips { margin: 4px 0 12px; }
.card.form .chip { font-size: 13px; padding: 5px 12px; text-align: left; }
td.acts.wrap { white-space: normal; min-width: 240px; }
.qr-group > .row-between { margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.qr-group h2 { margin: 0 0 2px; }
.qr-group .qr-card { border: 1px solid #e2e8f0; box-shadow: none; }
.alert.ok { background: var(--ok-bg, #ecfdf5); color: #064e3b; border-left-color: #10b981; }
.scan-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.scan-btn + .who { margin-left: 8px; }
@media (max-width: 900px) { .scan-btn span { display: none; } .scan-btn { padding: 8px 10px; } }
.scan-page { max-width: 460px; margin: 30px auto; }
.head-actions .btn svg { vertical-align: -3px; margin-right: 4px; }
