/* =========================================================
   Scooby Scan — sistema de diseño (Propuesta C)
   Móvil primero · un botón principal por pantalla · toques ≥ 44 px
   ========================================================= */
:root {
  --bg: #FFFFFF;
  --art: radial-gradient(900px 520px at 100% -8%, #FFF1BF 0, rgba(255,241,191,0) 60%), radial-gradient(820px 460px at -12% 4%, #E3ECFF 0, rgba(227,236,255,0) 58%), radial-gradient(700px 500px at 50% 110%, #F1F5FF 0, rgba(241,245,255,0) 60%), #FFFFFF;
  --card: #FFFFFF;
  --card-border: #E6ECF7;
  --elev: 0 1px 2px rgba(31,79,216,0.06), 0 12px 28px -14px rgba(31,79,216,0.28);
  --hero: linear-gradient(135deg, #2A5CF0 0%, #1A3FB8 100%);
  --tab-bg: rgba(255,255,255,0.92);
  --surface: #F4F7FD;
  --surface-2: #EEF3FC;
  --ink: #0B1B3A;
  --ink-2: #27344F;
  --muted: #4A5568;
  --line: #E2E7F0;
  --line-2: #C8D1E0;
  --primary: #1F4FD8;
  --primary-ink: #1A3FA8;
  --primary-soft: #E8EEFC;
  --on-primary: #FFFFFF;
  --amber: #F2A541;
  --amber-soft: #FEF1DC;
  --amber-ink: #7A4A06;
  --danger: #B42318;
  --danger-soft: #FEE4E2;
  --dark: #0B1B3A;
  --on-dark: #FFFFFF;
  --shadow: 0 8px 24px rgba(11, 27, 58, 0.10);
  --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-pill: 999px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
  --tabbar-h: 78px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080C16; --art: #080C16; --card: #1D2433; --card-border: rgba(255,255,255,0.14); --elev: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 20px rgba(0,0,0,0.35); --hero: linear-gradient(135deg, #4378FF 0%, #2453E0 100%); --tab-bg: rgba(14,19,30,0.94); --surface: #141B29; --surface-2: #283246; --ink: #E7ECF8; --ink-2: #C9D2EA; --muted: #B7C1D9;
    --line: #2C3442; --line-2: #3D4758; --primary: #8DB0FF; --primary-ink: #CFDCFF; --primary-soft: #2B3F78; --on-primary: #0B1B3A;
    --amber: #F2A541; --amber-soft: #3A2A10; --amber-ink: #F8C985; --danger: #F97066; --danger-soft: #3B1513;
    --dark: #E7ECF8; --on-dark: #0B1B3A; --shadow: 0 8px 24px rgba(0, 0, 0, 0.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #080C16; --art: #080C16; --card: #1D2433; --card-border: rgba(255,255,255,0.14); --elev: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 20px rgba(0,0,0,0.35); --hero: linear-gradient(135deg, #4378FF 0%, #2453E0 100%); --tab-bg: rgba(14,19,30,0.94); --surface: #141B29; --surface-2: #283246; --ink: #E7ECF8; --ink-2: #C9D2EA; --muted: #B7C1D9;
  --line: #2C3442; --line-2: #3D4758; --primary: #8DB0FF; --primary-ink: #CFDCFF; --primary-soft: #2B3F78; --on-primary: #0B1B3A;
  --amber: #F2A541; --amber-soft: #3A2A10; --amber-ink: #F8C985; --danger: #F97066; --danger-soft: #3B1513;
  --dark: #E7ECF8; --on-dark: #0B1B3A; --shadow: 0 8px 24px rgba(0, 0, 0, 0.4); color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--art, var(--bg)); background-attachment: fixed; color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; }
body { min-height: 100dvh; }
img, svg { display: block; }
a { color: var(--primary); text-decoration: none; font-weight: 600; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- estructura ---------- */
.view { display: none; min-height: 100dvh; }
.view.active { display: flex; flex-direction: column; }
.view.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 48px); }
.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.section-title { font-size: 15px; font-weight: 700; color: var(--muted); margin: 22px 0 10px; }
.page-title { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.lead { font-size: 16px; color: var(--muted); margin: 8px 0 0; }

.topbar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; min-height: 68px; }
.topbar .title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar .title b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title span { font-size: 13px; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 28px; letter-spacing: 0; color: var(--ink); }
.brand svg { flex-shrink: 0; }
.wm-b,.wm-n{display:inline-block;color:transparent;-webkit-background-clip:text;background-clip:text}.wm-b{background-image:linear-gradient(to bottom right,#FFC93C 0 52%,var(--ink) 52%)}.wm-n{background-image:linear-gradient(to bottom left,#FFC93C 0 52%,var(--ink) 52%)}

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 56px; padding: 0 24px; border-radius: var(--r-pill);
  border: 0; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 17px; text-decoration: none; white-space: nowrap; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(0.98); }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.block { width: 100%; }
.btn.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--line-2); }
.btn.dark { background: var(--dark); color: var(--on-dark); }
.btn.soft { background: var(--primary-soft); color: var(--primary-ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { height: 44px; padding: 0 16px; font-size: 15px; }
.btn.link { background: none; color: var(--primary); height: 44px; padding: 0 8px; }
.btn.link.muted { color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--card-border); background: var(--card); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn.plain { background: transparent; border: 0; }
.icon-btn.glass { border: 0; }
.icon-btn.primary { background: var(--primary); color: var(--on-primary); border: 0; box-shadow: 0 6px 14px rgba(31,79,216,0.28); }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--card-border); flex-shrink: 0; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.bottom-bar { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--bg) 22%); padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.bottom-bar .wrap { padding: 0; display: flex; flex-direction: column; gap: 8px; }

/* ---------- formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea, .input { height: 52px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--card); padding: 0 14px; font-size: 16px; font-weight: 500; width: 100%; }
.field textarea { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.code-input { height: 64px; font-size: 30px; letter-spacing: 12px; text-align: center; font-weight: 700; }
.search { display: flex; align-items: center; gap: 10px; height: 50px; border-radius: var(--r-pill); background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--elev); padding: 0 16px; color: var(--muted); }
.search input { border: 0; background: transparent; font-size: 16px; font-weight: 500; flex: 1; min-width: 0; outline: none; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--ink-2); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); margin: 1px 0 0; flex-shrink: 0; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 60px; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--primary); }

/* ---------- tarjetas y listas ---------- */
.card { background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--elev); border-radius: var(--r-lg); padding: 16px; }
.card-list { background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--elev); border-radius: var(--r-lg); padding: 0 16px; }
.card-list:empty { display: none; }
.card-list .empty { padding: 28px 8px; }
.card.white { background: var(--card); }
.card.amber { background: var(--amber-soft); border-color: rgba(242,165,65,0.35); }
.tile { display: flex; flex-direction: column; gap: 18px; background: var(--card); border-radius: 24px; padding: 16px; min-height: 124px; color: var(--ink); border: 1px solid var(--card-border); box-shadow: var(--elev); transition: transform .1s; text-align: left; font-weight: 400; }
.tile .ic { width: 44px; height: 44px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; }
.tile b { font-size: 16px; display: block; }
.tile span { font-size: 13px; color: var(--muted); }
.tile:active { transform: scale(0.985); }
.tile.hero { flex-direction: row; align-items: center; justify-content: space-between; background: var(--hero); color: #FFFFFF; border: 0; box-shadow: 0 10px 24px rgba(31,79,216,0.30); min-height: 100px; padding: 20px; grid-column: 1 / -1; }
.tile.hero b { font-size: 20px; }
.tile.hero span { color: #FFFFFF; opacity: .88; font-size: 14px; }
.tile.hero .ic { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,0.18); color: #FFFFFF; border: 1px solid rgba(255,255,255,0.28); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.alert-card { display: flex; align-items: center; gap: 12px; background: var(--amber-soft); border: 1px solid rgba(242,165,65,0.35); box-shadow: var(--elev); border-radius: 20px; padding: 14px 14px 14px 16px; color: var(--ink); }
.alert-card .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--amber); color: #3D2604; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-card b { display: block; font-size: 16px; }
.alert-card span { font-size: 14px; color: var(--amber-ink); }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.list-row:last-child { border-bottom: 0; }
.list-row b { display: block; font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row small { display: block; font-size: 13px; color: var(--muted); }
.thumb-doc { width: 40px; height: 48px; border-radius: 10px; background: var(--primary-soft); border: 0; color: var(--primary-ink) !important; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 10px; white-space: nowrap; }
.pill.wait { background: var(--amber-soft); color: var(--amber-ink); }
.pill.ok { background: var(--primary-soft); color: var(--primary-ink); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--surface-2); color: var(--ink-2); }
.badge { min-width: 18px; height: 18px; border-radius: 9px; background: var(--amber); color: #3D2604; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ic { width: 64px; height: 64px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.empty b { color: var(--ink); font-size: 17px; }
.trust { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); line-height: 1.45; }
.trust svg { color: var(--primary); flex-shrink: 0; margin-top: 1px; }

/* segmentado */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; background: var(--surface-2); border-radius: var(--r-md); padding: 4px; }
.seg button { height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.active { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(11,27,58,0.12); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip { height: 40px; padding: 0 14px; border-radius: var(--r-pill); border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

/* ---------- barra de pestañas ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--tab-bg); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--card-border); box-shadow: 0 -4px 16px rgba(11,27,58,0.06);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 8px 0 env(safe-area-inset-bottom); }
.tabbar .inner { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; min-height: 52px; position: relative; padding: 0; }
.tabbar button.active { color: var(--primary-ink); font-weight: 700; }
.tabbar button:not(.fab) svg { padding: 3px 14px; box-sizing: content-box; border-radius: 14px; transition: background .15s; }
.tabbar button.active:not(.fab) svg { background: var(--primary-soft); }
.tabbar .fab { margin-top: -26px; color: var(--ink); font-weight: 700; }
.tabbar .fab .ring { width: 58px; height: 58px; border-radius: 50%; background: var(--hero); color: #FFFFFF; display: flex; align-items: center; justify-content: center; border: 4px solid var(--bg); box-shadow: 0 6px 16px rgba(31,79,216,0.32); }
.tabbar .badge { position: absolute; top: -4px; left: 50%; margin-left: 6px; }

/* ---------- bienvenida ---------- */
.hero-art { height: 360px; background: var(--primary-soft); border-radius: 0 0 36px 36px; position: relative; overflow: hidden; }
.hero-art .doc { position: absolute; left: 50%; top: 88px; width: 206px; height: 250px; margin-left: -103px; background: #FFFFFF; border-radius: 16px; box-shadow: var(--shadow); transform: rotate(-4deg); padding: 22px 20px; display: flex; flex-direction: column; gap: 8px; }
.hero-art .doc i { display: block; height: 6px; background: #E6EBF3; border-radius: 3px; }
.hero-art .doc .sig { margin-top: auto; border-top: 1.5px solid #C8D1E0; text-align: right; font-family: 'Dancing Script', cursive; font-size: 26px; color: #0B1B3A; line-height: 1; padding-top: 4px; }
.hero-art .ok { position: absolute; right: calc(50% - 150px); top: 108px; width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: #FFF; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(31,79,216,0.35); }
.hero-art .toast-art { position: absolute; left: calc(50% - 150px); bottom: 40px; background: #FFFFFF; color: #0B1B3A; border-radius: 16px; padding: 8px 12px; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); font-size: 13px; font-weight: 700; }

/* ---------- documento abierto ---------- */
#view-work { background: var(--surface); height: 100dvh; min-height: 0; }
#view-work .topbar { background: var(--card); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.viewer { flex: 1; overflow: auto; padding: 16px 12px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; -webkit-overflow-scrolling: touch; }
.page { position: relative; background: #FFFFFF; box-shadow: 0 2px 12px rgba(11,27,58,0.14); border-radius: 4px; flex-shrink: 0; max-width: 100%; }
.page canvas { width: 100%; height: 100%; display: block; border-radius: 4px; }
.overlay { position: absolute; inset: 0; }
.pnum { position: absolute; bottom: -20px; right: 2px; font-size: 12px; color: var(--muted); }
.loading { padding: 40px; color: var(--muted); text-align: center; }
.viewer.placing .overlay { cursor: crosshair; }
.mark { position: absolute; border: 2px solid var(--primary); border-radius: 8px; background: rgba(31,79,216,0.05); cursor: grab; touch-action: none; }
.mark img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.mark .x { position: absolute; top: -16px; right: -16px; width: 32px; height: 32px; border-radius: 50%; border: 2px solid #FFF; background: #0B1B3A; color: #FFF; display: flex; align-items: center; justify-content: center; padding: 0; font-size: 16px; line-height: 1; }
.mark .grip { position: absolute; right: -11px; bottom: -11px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); border: 3px solid #FFF; cursor: nwse-resize; }
.mark.field { border-color: var(--c, var(--primary)); background: color-mix(in srgb, var(--c, #1F4FD8) 14%, transparent); display: flex; align-items: center; justify-content: center; }
.flabel { font-size: 11px; font-weight: 700; color: var(--c, var(--primary)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; pointer-events: none; }
.mark.field.mine { --c: #B4501E; cursor: pointer; animation: pulse 1.6s infinite; }
.mark.field.mine.filled { animation: none; background: transparent; border-style: dashed; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(180,80,30,0.22); } }
.mark.hl { background: rgba(253,224,71,0.45); border: 1px dashed #CA8A04; }
.mark.redact { background: #000; border: 1px dashed #F43F5E; }
.mark.whiteout { background: #FFF; border: 1px dashed var(--primary); }
.mark.whiteout img { object-position: left; }
.hint-chip { position: absolute; left: 50%; transform: translateX(-50%); top: 80px; z-index: 5; background: var(--dark); color: var(--on-dark); font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: var(--r-pill); box-shadow: var(--shadow); pointer-events: none; white-space: nowrap; }
.dock { background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 -4px 16px rgba(11,27,58,0.08); padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; flex-shrink: 0; }
.dock .wrap { padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tools4 { display: flex; gap: 6px; background: var(--surface-2); border-radius: 22px; padding: 6px; }
.tools4 button { flex: 1; height: 56px; border-radius: 17px; border: 0; background: transparent; color: var(--ink); font-weight: 600; font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tools4 button.on { background: var(--card); color: var(--primary); box-shadow: 0 1px 3px rgba(11,27,58,0.12); }
.dock-actions { display: flex; gap: 10px; }
.dock-actions .btn { flex: 1; }
.dock-actions .btn.secondary { flex: 0 0 auto; }
.steps-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 0 20px; }
.steps-bar i { height: 4px; border-radius: 2px; background: var(--line-2); }
.steps-bar i.on { background: var(--primary); }

/* participantes */
.person { background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--elev); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: 10px; border-left: 5px solid var(--c); }
.person .head { display: flex; align-items: center; gap: 10px; }
.person .num { width: 32px; height: 32px; border-radius: 50%; background: var(--c); color: #FFF; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.person details summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--primary); list-style: none; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.person details summary::-webkit-details-marker { display: none; }
.person .opts { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.add-person { height: 54px; border-radius: var(--r-md); border: 1.5px dashed var(--line-2); background: var(--card); color: var(--primary); font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.choice { display: flex; align-items: center; gap: 14px; border: 2px solid var(--card-border); box-shadow: var(--elev); border-radius: 20px; padding: 16px; min-height: 84px; background: var(--card); width: 100%; text-align: left; color: var(--ink); }
.choice .ic { width: 48px; height: 48px; border-radius: 16px; background: var(--primary-soft); color: var(--primary-ink); color: var(--ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.choice b { display: block; font-size: 17px; }
.choice span { font-size: 14px; color: var(--muted); }
.choice[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); }
.choice[aria-checked="true"] .ic { background: var(--card); color: var(--primary); }
.doc-chip { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--elev); border-radius: var(--r-md); padding: 10px 12px; }

/* firmas */
.env-card { background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--elev); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.who-row { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 30px; }
.who-row .st { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.who-row .st.ok { background: var(--primary); color: #FFF; }
.who-row .st.wait { border: 2px dashed #C08A2E; }
.who-row .st.cc { background: var(--surface-2); color: var(--muted); }
.who-row .st.bad { background: var(--danger); color: #FFF; }
.env-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.env-actions .btn { flex: 1; min-width: 120px; }
.log { font-size: 13px; color: var(--muted); padding-left: 18px; margin: 6px 0 0; }
.log li { margin: 4px 0; }

/* herramientas */
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 1px solid var(--card-border); box-shadow: var(--elev); background: var(--card); border-radius: 20px; padding: 14px 6px; min-height: 100px; font-weight: 600; font-size: 14px; color: var(--ink); text-align: center; line-height: 1.25; }
.tool .ic { width: 42px; height: 42px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; }

/* escáner */
#view-scan { background: #0B1324; color: #FFF; height: 100dvh; min-height: 0; position: relative; overflow: hidden; }
#view-scan video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#view-scan .cam-off { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; color: #D1DBD8; }
.scan-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px; }
.glass { background: rgba(0,0,0,0.5); color: #FFF; border: 0; }
.scan-toggle { height: 40px; padding: 0 14px; border-radius: 20px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.scan-toggle .sw { width: 32px; height: 20px; border-radius: 10px; background: #56627E; position: relative; transition: background .15s; }
.scan-toggle .sw::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #FFF; transition: left .15s; }
.scan-toggle[aria-pressed="true"] .sw { background: #8FB0FF; }
.scan-toggle[aria-pressed="true"] .sw::after { left: 15px; }
.scan-guide { position: absolute; z-index: 1; inset: 18% 12% 30%; border: 3px solid rgba(255,255,255,0.55); border-radius: 10px; pointer-events: none; transition: border-color .2s, background .15s; }
.scan-guide.found { border-color: #8FB0FF; background: rgba(143,176,255,0.14); }
.scan-guide.id { inset: 32% 10% 40%; border-radius: 16px; }
.scan-guide.qr { inset: 28% 25% 38%; }
.scan-guide.flash { background: rgba(255,255,255,0.6); }
.scan-msg { position: absolute; z-index: 2; left: 0; right: 0; bottom: 210px; display: flex; justify-content: center; }
.scan-msg span { background: rgba(0,0,0,0.65); font-size: 15px; font-weight: 600; padding: 9px 16px; border-radius: 20px; max-width: 90%; text-align: center; }
.scan-bottom { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; background: #0B1324; padding: 14px 0 calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.scan-modes { display: flex; justify-content: center; gap: 6px; }
.scan-modes button { height: 40px; padding: 0 14px; border-radius: 20px; border: 0; background: transparent; color: #B8C3DD; font-weight: 600; font-size: 15px; }
.scan-modes button.active { background: #FFF; color: #0B1324; font-weight: 700; }
.scan-controls { display: flex; align-items: center; justify-content: space-between; padding: 0 28px; max-width: 480px; width: 100%; margin: 0 auto; }
.shutter { width: 82px; height: 82px; border-radius: 50%; border: 4px solid #FFF; background: transparent; padding: 5px; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #FFF; transition: transform .1s; }
.shutter:active span { transform: scale(0.9); }
.stackbtn { width: 60px; height: 60px; border: 0; padding: 0; background: transparent; position: relative; }
.stackbtn img { position: absolute; left: 8px; top: 2px; width: 44px; height: 56px; object-fit: cover; border-radius: 6px; border: 2px solid #FFF; background: #333; }
.stackbtn .n { position: absolute; right: -6px; top: -6px; min-width: 24px; height: 24px; border-radius: 12px; background: #8FB0FF; color: #0B1324; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.thumb { position: relative; background: var(--surface); border-radius: 12px; padding: 6px; }
.thumb img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 6px; display: block; }
.thumb .n { position: absolute; top: 10px; left: 10px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.thumb .acts { display: flex; justify-content: center; gap: 2px; margin-top: 4px; }

/* ---------- hojas inferiores y modales ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(11,27,58,0.45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 24px 24px 0 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 12px; }
.sheet h3 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.sheet .sub { color: var(--muted); font-size: 15px; margin: 0 0 14px; }
.action { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; border: 0; background: none; text-align: left; padding: 8px 4px; color: var(--ink); border-bottom: 1px solid var(--line); }
.action:last-child { border-bottom: 0; }
.action .ic { width: 42px; height: 42px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.action b { display: block; font-size: 16px; font-weight: 600; }
.action small { display: block; font-size: 13px; color: var(--muted); }
.action.danger { color: var(--danger); }
.action.danger .ic { background: var(--danger-soft); color: var(--danger); }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 24px; } }

#sigCanvas { width: 100%; height: 200px; border: 1.5px solid var(--line-2); border-radius: 16px; background: #FFF; touch-action: none; display: block; margin: 8px 0 12px; }
#sigTyped { font-family: 'Dancing Script', cursive; font-size: 22px; flex: 1; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-flex; align-items: center; justify-content: center; padding: 0; background: transparent; }
.swatch i { width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--line-2); }
.swatch.on i { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--ink); }

#toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%) translateY(-20px); opacity: 0; background: var(--dark); color: var(--on-dark);
  padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; z-index: 90; transition: all .2s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- planes ---------- */
.plan { background: var(--card); box-shadow: var(--elev); border: 2px solid var(--card-border); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.plan.pro { border-color: var(--primary); }
.plan .price { font-size: 30px; font-weight: 800; }
.plan .price small { font-size: 15px; color: var(--muted); font-weight: 500; }
.plan ul { padding-left: 20px; margin: 6px 0; line-height: 1.8; font-size: 15px; }
.plan s { color: var(--muted); }

/* ---------- página del firmante ---------- */
.sign-layout { display: flex; flex-direction: column; min-height: 100dvh; }
.sign-panel { padding: 0 20px 20px; }
.stepper { list-style: none; margin: 18px 0 0; padding: 0; display: flex; align-items: center; gap: 6px; }
.stepper li { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.stepper li.line { flex: 1; height: 2px; background: var(--line-2); }
.stepper .n { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.stepper li.on { color: var(--primary); font-weight: 700; }
.stepper li.on .n { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.stepper li.done .n { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary-ink); }
.sign-viewer { background: var(--surface); flex: 1; min-height: 60vh; display: flex; flex-direction: column; }
.locked { margin: 24px auto; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.id-prev { width: 100%; border-radius: 12px; }
@media (min-width: 900px) {
  .sign-layout { flex-direction: row; height: 100dvh; }
  .sign-panel { width: 400px; flex-shrink: 0; overflow: auto; border-right: 1px solid var(--line); }
  .sign-viewer { height: 100dvh; }
}

/* ---------- títulos de sección y configuración ---------- */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 10px; }
.sec-head h2 { font-size: 18px; font-weight: 800; }
.settings-group { background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--elev); border-radius: var(--r-lg); padding: 0 16px; }
.settings-group .action:last-child { border-bottom: 0; }
.set-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 22px 4px 8px; }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .ic { width: 38px; height: 38px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.set-row b { display: block; font-size: 16px; font-weight: 600; }
.set-row small { display: block; font-size: 13px; color: var(--muted); }
.set-row .seg { min-width: 0; }
.set-row.col { flex-direction: column; align-items: stretch; gap: 10px; }
.toggle { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--line-2); position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s; margin: 0; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #FFF; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.toggle:checked { background: var(--primary); }
.toggle:checked::after { left: 23px; }
.sig-preview { height: 72px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: #FFF; display: flex; align-items: center; justify-content: center; padding: 8px; }
.sig-preview img { max-height: 100%; max-width: 100%; }
html.big-text body { zoom: 1.12; }

/* ---------- tickets ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span2 { grid-column: 1 / -1; }
.field-label { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 0 0 8px; }
.ticket-photo { width: 100%; max-height: 320px; object-fit: contain; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--card-border); }
.ticket-thumb { width: 56px; height: 68px; object-fit: cover; border-radius: 10px; border: 1px solid var(--card-border); background: var(--surface-2); flex-shrink: 0; }
.ticket-thumb.sm { width: 40px; height: 48px; border-radius: 8px; }
.month-head { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: .02em; margin: 22px 0 8px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv span { color: var(--muted); flex-shrink: 0; }
.kv b { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.pill.done { background: #DDF5EA; color: #0B6E5A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.done { background: #123D31; color: #7FE0C0; } }
:root[data-theme="dark"] .pill.done { background: #123D31; color: #7FE0C0; }
.btn.link[style*="danger"] { color: var(--danger); }

/* ---------- tickets: deslizar, seleccionar, varias partes ---------- */
.swipe { position: relative; overflow: hidden; }
.swipe + .swipe .swipe-row { border-top: 0; }
.swipe-row { position: relative; background: var(--card); border-bottom: 1px solid var(--line); cursor: pointer; touch-action: pan-y; user-select: none; }
.swipe:last-child .swipe-row { border-bottom: 0; }
.swipe-act { position: absolute; right: 0; top: 0; bottom: 0; width: 88px; border: 0; background: var(--danger); color: #FFFFFF; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 700; }
.check-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: #FFFFFF; }
.check-dot.on { background: var(--primary); border-color: var(--primary); }
.tk-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--card-border); box-shadow: var(--elev); }
.tk-bar .btn { flex: 1; height: 50px; }
.tk-bar .btn:disabled { opacity: .45; }
.pages-strip { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pg { position: relative; width: 72px; height: 92px; flex-shrink: 0; }
.pg img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; border: 1px solid var(--card-border); background: var(--surface-2); }
.pg > span { position: absolute; left: 6px; bottom: 6px; background: rgba(11,27,58,0.75); color: #FFFFFF; font-size: 11px; font-weight: 700; border-radius: 8px; padding: 1px 6px; }
.pg-x { position: absolute; right: -6px; top: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--danger); color: #FFFFFF; font-size: 16px; line-height: 1; font-weight: 700; }
.pg-add { width: 72px; height: 92px; flex-shrink: 0; border-radius: 12px; border: 1.5px dashed var(--line-2); background: var(--card); color: var(--primary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 700; }
.folio-row { display: flex; gap: 10px; align-items: flex-end; }
.folio-row .field { flex: 1; min-width: 0; }
.folio-row .btn { height: 52px; flex-shrink: 0; }

/* ---------- cámara con recuadro para la clave del ticket ---------- */
.cropcam { position: fixed; inset: 0; z-index: 200; background: #000; overflow: hidden; }
.cropcam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cc-box { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 84%; height: 150px; border: 3px solid #34D399; border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55); }
.cc-hint { position: absolute; left: 16px; right: 16px; top: calc(50% - 124px); margin: 0; text-align: center; color: #FFFFFF; font-size: 16px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.cc-bar { position: absolute; left: 0; right: 0; bottom: calc(28px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; align-items: center; padding: 0 40px; }
.cc-shot { width: 72px; height: 72px; border-radius: 50%; border: 5px solid #FFFFFF; background: #FFFFFF; }
.cc-x { width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.2); color: #FFFFFF; display: flex; align-items: center; justify-content: center; }

/* acciones por persona en Esperando */
.who-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 2px 0 6px 36px; }
.who-acts .btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.who-acts small { display: inline-flex; gap: 6px; align-items: center; }
