/* VastSigner — componentes nuevos (activación, correo, nube, notificaciones…).
   Requiere tokens.css y app.css. Solo variables de tokens. */

.view, .layer { position: absolute; inset: 0; }
.layer { pointer-events: none; z-index: 20; }
.layer > * { pointer-events: auto; }
.layer:empty { display: none; }

/* Marca */
.brand__mark { color: #fff; }

/* Barra inferior: punto de pendiente */
.tab__dot { position: absolute; top: -2px; right: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-danger); border: 2px solid var(--c-surface); }
.fab { border: 0; }

/* Aviso flotante */
.toast { position: absolute; left: 50%; top: calc(var(--safe-top) + 8px); z-index: 30; transform: translate(-50%, calc(-100% - var(--safe-top) - 24px)); opacity: 0; width: max-content; max-width: calc(100% - 40px);
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-pill); background: var(--c-surface); border: 1px solid var(--c-line-strong);
  box-shadow: var(--sh-float); font-size: 14px; font-weight: 700; color: var(--c-ink); transition: transform .3s ease, opacity .3s; }
.toast svg { color: var(--c-ok); flex: none; }
.toast.on { transform: translate(-50%, 0); opacity: 1; }

/* Campos con ícono y botón al final */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { width: 100%; padding-right: 50px; }
.input-wrap .input--lead { padding-left: 44px; }
.input-wrap__lead { position: absolute; left: 14px; color: var(--c-subtle); display: grid; pointer-events: none; }
.input-wrap__end { position: absolute; right: 2px; width: var(--touch-min); height: var(--touch-min); border: 0; background: transparent; color: var(--c-subtle); display: grid; place-items: center; }
.input--big { height: 56px; font-size: 20px; font-weight: 700; letter-spacing: 0.08em; }
.input.is-ok { border-color: var(--c-ok); }
.input.is-bad { border-color: var(--c-danger); }
.field__msg { font-size: 12px; font-weight: 600; min-height: 16px; }
.field__msg--ok { color: var(--c-ok); }
.field__msg--bad { color: var(--c-danger); }
.segmented--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Reglas de contraseña */
.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.rule { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--c-muted); font-weight: 600; }
.rule i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--c-line-strong); display: grid; place-items: center; flex: none; }
.rule.on { color: var(--c-ink); }
.rule.on i { background: var(--c-ok-solid); border-color: var(--c-ok-solid); color: #fff; }
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.meter i { height: 5px; border-radius: 3px; background: var(--c-primary-tint); }
.meter[data-l="1"] i:nth-child(-n+1) { background: var(--c-danger); }
.meter[data-l="2"] i:nth-child(-n+2) { background: var(--c-warn); }
.meter[data-l="3"] i:nth-child(-n+3) { background: var(--c-accent); }
.meter[data-l="4"] i { background: var(--c-ok); }

/* Lista de verificación animada (validando…) */
.checklist { display: flex; flex-direction: column; gap: 14px; }
.check-item { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 700; color: var(--c-subtle); transition: color .25s; }
.check-item i { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--c-line-strong); display: grid; place-items: center; flex: none; color: #fff; }
.check-item.run { color: var(--c-ink); }
.check-item.run i { border-color: var(--c-accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.check-item.ok { color: var(--c-ink); }
.check-item.ok i { background: var(--c-ok-solid); border-color: var(--c-ok-solid); }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.35); border-top-color: #fff; animation: spin .8s linear infinite; }

/* Correo de ejemplo (vista previa del mensaje recibido) */
.mail-card { border-radius: var(--r-lg); background: var(--c-paper); color: var(--c-paper-text); overflow: hidden; box-shadow: var(--sh-card); }
.mail-card__head { padding: 12px 14px; border-bottom: 1px solid var(--c-paper-line); display: flex; gap: 10px; align-items: center; font-size: 12px; }
.mail-card__body { padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; line-height: 1.5; }
.mail-card__btn { align-self: flex-start; padding: 10px 18px; border-radius: var(--r-pill); background: var(--c-primary); color: #fff; font-weight: 700; font-size: 13px; border: 0; }
.mail-card b { color: var(--c-ink-signature); }

/* Hero de bienvenida */
.hero-glow { position: absolute; inset: -40px -60px auto; height: 320px; background: radial-gradient(60% 60% at 60% 40%, rgba(25,55,240,0.35), transparent 70%); pointer-events: none; }
.pill-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--c-primary-soft); border: 1px solid var(--c-primary-tint); font-size: 13px; line-height: 1.45; color: var(--c-ink); }
.pill-note svg { color: var(--c-accent); flex: none; margin-top: 1px; }
.pill-note--warn { background: var(--c-warn-bg); border-color: transparent; }
.pill-note--warn svg { color: var(--c-warn); }
.pill-note--bad { background: var(--c-danger-bg); border-color: transparent; }
.pill-note--bad svg { color: var(--c-danger); }
.pill-note--ok { background: var(--c-ok-bg); border-color: transparent; }
.pill-note--ok svg { color: var(--c-ok); }

/* Acciones rápidas */
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick a, .quick button { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--c-ink); font-size: 12px; font-weight: 500; background: none; border: 0; padding: 0; }
.quick span.ico-box { width: 56px; height: 56px; border-radius: 16px; border: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-accent); }
.quick__txt { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.quick__s { display: none; }
/* Pantallas anchas (web de escritorio y tableta con menú lateral): tarjetas con el texto a la derecha */
@media (min-width: 900px) {
  html.web-sesion .quick { gap: 14px; }
  html.web-sesion .quick a { flex-direction: row; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--c-line);
    background: var(--c-surface); text-align: left; transition: transform .15s ease, border-color .15s ease; }
  html.web-sesion .quick a:hover { transform: translateY(-1px); border-color: var(--c-primary-tint); }
  html.web-sesion .quick span.ico-box { width: 46px; height: 46px; border-radius: 13px; flex: none; }
  html.web-sesion .quick__txt { align-items: flex-start; gap: 2px; }
  html.web-sesion .quick__t { font-size: 15px; font-weight: 700; }
  /* Contadores: el número con su ícono al lado (en columna dejaban un hueco grande) */
  html.web-sesion .stats-3 { gap: 14px; }
  html.web-sesion .stats-3 .stat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; row-gap: 2px; align-items: center; padding: 16px 18px; }
  html.web-sesion .stats-3 .stat .ico-box { grid-row: 1 / span 2; width: 46px; height: 46px; }
  html.web-sesion .stats-3 .stat__value { line-height: 1.05; }
  html.web-sesion .stats-3 .stat__label { font-size: 13.5px; }
  html.web-sesion .quick__s { display: block; font-size: 12.5px; font-weight: 500; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}

/* Fila de proveedor de correo */
.provider { width: 100%; padding: 14px; border-radius: var(--r-md); border: 1px solid var(--c-line); background: var(--c-surface); display: flex; align-items: center; gap: 14px; text-align: left; color: var(--c-ink); }
.provider__logo { width: 42px; height: 42px; border-radius: 12px; background: var(--c-paper); color: var(--c-primary); display: grid; place-items: center; font-size: 19px; font-weight: 700; flex: none; }

/* Correo: filas de mensajes */
.mail-row { padding: 14px; border-radius: var(--r-md); background: var(--c-surface); border: 1px solid var(--c-line); display: flex; flex-direction: column; gap: 10px; }
.mail-row.is-done { opacity: .65; }
.attach { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-sm); background: var(--c-field); border: 1px solid var(--c-line); }
.attach__pdf { width: 34px; height: 40px; border-radius: 6px; background: var(--c-danger-bg); color: var(--c-danger); display: grid; place-items: center; font-size: 9px; font-weight: 700; flex: none; }
.btn--sm { height: 40px; font-size: 13px; font-weight: 700; padding: 0 14px; }
.btn--soft { background: var(--c-primary-soft); color: var(--c-accent); }

/* Nube */
.vault { padding: 18px; border-radius: var(--r-xl); background: linear-gradient(135deg, var(--c-primary-softer), var(--c-surface)); border: 1px solid var(--c-primary-tint); display: flex; flex-direction: column; gap: 12px; }
.file-row { padding: 12px 14px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--c-divider); color: var(--c-ink); background: transparent; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.file-row:last-child { border-bottom: 0; }
.file-ico { position: relative; width: 40px; height: 46px; border-radius: 8px; background: var(--c-ground); border: 1px solid var(--c-line); display: grid; place-items: center; color: var(--c-muted); flex: none; }
.file-ico__lock { position: absolute; right: -6px; bottom: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--c-primary); color: #fff; display: grid; place-items: center; border: 2px solid var(--c-surface); }
.file-ico--signed { background: var(--c-ok-bg); color: var(--c-ok); border-color: transparent; }
.uploading { padding: 14px; border-radius: var(--r-md); background: var(--c-surface); border: 1px solid var(--c-accent); display: flex; flex-direction: column; gap: 10px; }

/* Notificaciones */
.note { padding: 14px; display: flex; gap: 12px; align-items: flex-start; border-bottom: 1px solid var(--c-divider); text-decoration: none; color: var(--c-ink); }
.note:last-child { border-bottom: 0; }
.note.unread { background: var(--c-primary-softer); }
.note__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); flex: none; margin-top: 6px; }

/* Interruptor */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 15px; background: var(--c-line-control); transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--c-primary); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--c-accent); outline-offset: 2px; }

/* Certificado */
.cert { position: relative; overflow: hidden; padding: 18px; border-radius: var(--r-xl); background: var(--c-primary); color: #fff; display: flex; flex-direction: column; gap: 14px; }
.cert::after { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; border: 28px solid rgba(255,255,255,0.08); }
.cert .kv > :first-child { color: rgba(255,255,255,0.75); }
.cert__chip { width: 40px; height: 30px; border-radius: 6px; background: rgba(255,255,255,0.22); display: grid; place-items: center; }
.source { width: 100%; padding: 14px; border-radius: var(--r-md); border: 2px solid var(--c-line); background: var(--c-surface); display: flex; align-items: center; gap: 12px; text-align: left; color: var(--c-ink); }
.source.on { border-color: var(--c-accent); background: var(--c-primary-softer); }
.tag { display: inline-flex; padding: 3px 8px; border-radius: var(--r-xs); background: var(--c-primary-soft); color: var(--c-accent); font-size: 10px; font-weight: 700; letter-spacing: .04em; }

/* Visor multipágina y campos colocados */
.pages { display: flex; flex-direction: column; gap: 16px; }
.paper { position: relative; }
.page-no { align-self: center; font-size: 11px; font-weight: 700; color: var(--c-subtle); }
.placer { position: relative; aspect-ratio: 0.72; background: var(--c-paper); border-radius: 6px; padding: 22px 18px; display: flex; flex-direction: column; gap: 8px; cursor: copy; overflow: hidden; border: 0; width: 100%; }
.placed { position: absolute; width: 38%; height: 13%; border-radius: 6px; border: 2px dashed; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; transform: translate(-50%, -50%); background: rgba(255,255,255,0.85); cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.placed--0 { border-color: var(--c-primary); color: var(--c-primary); }
.placed--1 { border-color: #B26A00; color: #8A5200; }
.placed--2 { border-color: #1E7A45; color: #17633A; }
.placed--3 { border-color: #9C2F6B; color: #84245A; }
.signer-chip { flex: none; height: 38px; padding: 0 12px 0 6px; border-radius: 19px; border: 1px solid var(--c-line); background: var(--c-surface); display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--c-ink); }
.signer-chip .avatar { width: 28px; height: 28px; font-size: 11px; }
.signer-chip.on { border-color: var(--c-accent); background: var(--c-primary-softer); }

/* Variables de plantilla resaltadas en el papel */
.var { background: #E8ECFE; color: var(--c-primary); border-radius: 3px; padding: 0 3px; font-weight: 700; }
.var--empty { background: #FFF2D6; color: #8A5200; }
.doc-text { font-family: var(--font-template); color: #2B2F38; font-size: 12.5px; line-height: 1.6; }
.doc-text h3 { margin: 0 0 6px; font-size: 15px; text-align: center; color: #11151C; }

/* Progreso de firma criptográfica */
.sign-steps { display: flex; flex-direction: column; gap: 12px; }

/* Contactos sugeridos */
.contact-chip { flex: none; height: 36px; padding: 0 12px 0 4px; border-radius: 18px; border: 1px dashed var(--c-line-strong); background: transparent; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--c-muted); }
.contact-chip .avatar { width: 28px; height: 28px; font-size: 10px; }

/* Verificación */
.verify-ok { padding: 18px; border-radius: var(--r-xl); background: var(--c-ok-bg); border: 1px solid var(--c-ok-solid); display: flex; flex-direction: column; gap: 12px; }
.qr-frame { position: relative; width: 220px; height: 220px; margin: 0 auto; border-radius: 22px; background: var(--c-field); border: 1px solid var(--c-line); display: grid; place-items: center; color: var(--c-subtle); overflow: hidden; }
.qr-frame::before { content: ''; position: absolute; left: 16px; right: 16px; height: 2px; background: var(--c-accent); box-shadow: 0 0 12px var(--c-accent); animation: scanline 2s ease-in-out infinite; }
@keyframes scanline { 0%, 100% { top: 18px; } 50% { top: 200px; } }

.badge--rejected { background: var(--c-danger-bg); color: var(--c-danger); }
.empty { padding: 36px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--c-muted); font-size: 14px; }
.empty .ico-box { width: 56px; height: 56px; border-radius: 18px; }
.link-btn { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
/* Los hijos del scroll nunca se encogen (las filas de chips con overflow quedaban en 0 px) */
.scroll > * { flex-shrink: 0; }

/* Visor de PDF real (PDF.js) */
.pdf-page { position: relative; background: var(--c-paper); border-radius: 6px; overflow: hidden; box-shadow: var(--sh-card); }
.sig-overlay { position: absolute; z-index: 1; }
.sig-overlay .sig-field, .sig-overlay .sig-stamp, .sig-overlay .sig-slot { width: 100%; min-height: 0; }
.sig-overlay .sig-stamp { padding: 2px 4px; line-height: 1.2; overflow: hidden; font-size: 5.5px !important; }

/* ---------- Sensación de app nativa (como RobiLab) ----------
   La pantalla NUNCA se desplaza ni rebota como página: solo se desplaza por dentro el .scroll,
   y solo en vertical. Sin zoom por doble toque ni menú de copiar al mantener presionado. */
html, body { overflow: hidden; overscroll-behavior: none; position: fixed; inset: 0; width: 100%; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
#app { overflow: hidden; }
.scroll { overflow-x: hidden; overscroll-behavior-y: contain; }
.screen { overflow: hidden; }
.hero-glow { inset: -40px 0 auto; }
/* El placeholder del campo grande va liviano: es una pista, no un dato */
.input--big::placeholder { font-size: 16px; font-weight: 400; letter-spacing: 0; color: var(--c-subtle); }

/* Nube: código de recuperación en 8 grupos numerados */
.codigo-rec { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codigo-rec span { position: relative; padding: 14px 10px 12px; border-radius: var(--r-control); background: var(--c-surface); border: 1px solid var(--c-line-strong);
  font-family: var(--font-mono); font-size: 20px; font-weight: 700; letter-spacing: .14em; text-align: center; color: var(--c-ink); -webkit-user-select: text; user-select: text; }
.codigo-rec i { position: absolute; top: 5px; left: 8px; font-style: normal; font-family: var(--font-ui); font-size: 10px; font-weight: 600; letter-spacing: 0; color: var(--c-subtle); }
.bar--warn > span { background: var(--c-warn); box-shadow: none; }

/* Firmar: recuadro que se puede arrastrar y controles de zoom */
.sig-overlay--movible { touch-action: none; cursor: grab; }
.sig-overlay--movible .sig-field { box-shadow: 0 0 0 4px rgba(11, 51, 251, 0.18); }
.zoom-ctl { position: absolute; right: calc(var(--gutter) + 10px); bottom: calc(var(--safe-bottom) + 114px); z-index: 5; display: flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: 14px; background: rgba(27, 31, 41, 0.78); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--sh-card-soft); }
.zoom-ctl button { width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--c-ink); font-size: 22px; font-weight: 600; line-height: 1; }
.zoom-ctl button:active { background: var(--c-primary-soft); }
.zoom-ctl span { min-width: 46px; text-align: center; font-size: 12px; font-weight: 700; color: var(--c-muted); font-variant-numeric: tabular-nums; }

/* Editor del documento (07-plantillas.js → #/editor) */
.editor-barra { position: absolute; left: 0; right: 0; top: calc(var(--safe-top) + 72px); z-index: 4; display: flex; gap: 4px; padding: 8px var(--gutter);
  overflow-x: auto; scrollbar-width: none; background: rgba(14, 17, 22, 0.85); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--glass-line); }
.editor-barra::-webkit-scrollbar { display: none; }
.editor-barra button { flex: none; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--c-line-strong); background: var(--c-surface);
  color: var(--c-ink); font: 600 16px var(--font-template); }
.editor-barra button:active { background: var(--c-primary-soft); border-color: var(--c-accent); }
.editor-hoja { padding: 26px 20px !important; min-height: 70vh; outline: none; gap: 8px; -webkit-user-select: text; user-select: text; caret-color: var(--c-primary); }
.editor-hoja p, .editor-hoja h3, .editor-hoja ul, .editor-hoja ol { margin: 0 0 8px; }
.editor-hoja:focus { box-shadow: 0 0 0 3px rgba(11, 51, 251, 0.35); }

/* ---------- Administración (screens/12-admin.js) ---------- */
/* Cabecera fija: va pegada arriba (también bajo la barra de estado) con vidrio oscuro; el contenido pasa por debajo */
.adm-cabecera { position: sticky; top: calc(-1 * (var(--safe-top) + 14px)); z-index: 3; display: flex; flex-direction: column; gap: 10px;
  margin: calc(-1 * (var(--safe-top) + 14px)) calc(-1 * var(--gutter)) 0; padding: calc(var(--safe-top) + 14px) var(--gutter) 12px;
  /* Fondo SÓLIDO: en WebKit (iPhone) el vidrio con desenfoque en una barra fija dejaba ver el contenido de atrás */
  background: linear-gradient(180deg, #121722 0%, var(--c-ground) 100%); isolation: isolate;
  border-bottom: 1px solid var(--glass-line); box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.8); }
.adm-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter); }
.adm-tabs::-webkit-scrollbar { display: none; }
.adm-tabs .chip { flex: none; }
.adm-consumo__cifras { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--c-muted); }
.adm-consumo__cifras b { color: var(--c-ink); font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.adm-tabs .chip { display: inline-flex; align-items: center; gap: 6px; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.adm-dato { display: flex; flex-direction: column; gap: 3px; padding: 14px 14px 13px; border-radius: var(--r-md); text-decoration: none; color: inherit;
  background: var(--grad-card), var(--c-surface); border: 1px solid var(--glass-line); box-shadow: var(--sh-card-soft); }
a.adm-dato:active { transform: scale(.98); }
.adm-dato__n { font-family: var(--font-display); font-size: 25px; font-weight: 700; letter-spacing: -0.02em; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.adm-dato__l { font-size: 12.5px; font-weight: 700; color: var(--c-ink); }
.adm-dato__nota { font-size: 11.5px; color: var(--c-muted); line-height: 1.35; }
.adm-dato--ojo .adm-dato__n { color: var(--c-warn); }
.adm-dato--mal .adm-dato__n { color: var(--c-danger); }
.adm-barras { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; height: 130px; align-items: end; }
.adm-barras span { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.adm-barras i { width: 100%; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #5C77FF, var(--c-accent)); box-shadow: 0 0 10px rgba(124,147,247,0.35); min-height: 3px; }
.adm-barras b { position: absolute; top: -2px; font-size: 10px; color: var(--c-muted); font-weight: 700; }
.adm-barras em { font-style: normal; font-size: 10px; color: var(--c-subtle); }
.adm-pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,0.06); color: var(--c-muted); border: 1px solid var(--c-line); }
.adm-pill--admin { background: var(--c-primary-soft); color: var(--c-accent-hover); border-color: var(--c-primary-tint); }
.adm-pill--ok { background: var(--c-ok-bg); color: var(--c-ok); border-color: transparent; }
.adm-pill--ojo { background: var(--c-warn-bg); color: var(--c-warn); border-color: transparent; }
.adm-pill--mal { background: var(--c-danger-bg); color: var(--c-danger); border-color: transparent; }
.adm-contexto { font-family: var(--font-mono); font-size: 11px; color: var(--c-subtle); background: rgba(0,0,0,0.25); padding: 8px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.adm-punto { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c-subtle); }
.adm-punto--ok { background: var(--c-ok); box-shadow: 0 0 0 4px rgba(95,211,148,0.15); }
.adm-punto--ojo { background: var(--c-warn); box-shadow: 0 0 0 4px rgba(224,176,74,0.15); }
.adm-punto--mal { background: var(--c-danger); box-shadow: 0 0 0 4px rgba(242,139,130,0.18); }
.adm-punto--grande { width: 16px; height: 16px; }
.adm-qr { width: 200px; height: 200px; background: #fff; border-radius: 12px; padding: 8px; }
.adm-qr svg { width: 100%; height: 100%; display: block; }
@media (min-width: 900px) { .adm-grid { grid-template-columns: repeat(4, 1fr); } }
.adm-grid.adm-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* las tres cifras del consumo, siempre en una fila */
.adm-grid--3 .adm-dato__n { font-size: 21px; }
.card > .kv { padding: 7px 0; }

/* Web: bienvenida e ingreso como página (panel de marca + formulario a toda la altura), no como teléfono.
   Lo activa el router con html.web-acceso solo fuera de la app y en las pantallas de acceso. */
.web-panel { display: none; }
@media (min-width: 900px) {
  html.web-acceso body { display: flex; background: radial-gradient(70% 70% at 0% 0%, rgba(11, 51, 251, 0.30), transparent 65%), radial-gradient(50% 50% at 60% 100%, rgba(124, 147, 247, 0.10), transparent 70%), var(--c-ground); }
  html.web-acceso .web-panel { display: flex; flex: 1; min-width: 0; flex-direction: column; justify-content: center; gap: 34px; padding: 56px clamp(40px, 7vw, 120px); overflow-y: auto; }
  .web-panel__logo { position: absolute; top: 36px; left: clamp(40px, 7vw, 120px); }
  .web-panel__logo img { height: 36px; width: auto; display: block; }
  .web-panel__texto h1 { margin: 0 0 14px; font: 700 clamp(34px, 3.4vw, 50px)/1.08 var(--font-display); letter-spacing: -0.02em; color: var(--c-ink); max-width: 620px; }
  .web-panel__texto p { margin: 0; font-size: 18px; line-height: 1.55; color: var(--c-muted); max-width: 560px; }
  .web-panel__lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 28px; max-width: 680px; }
  .web-panel__lista li { display: flex; gap: 14px; align-items: flex-start; font-size: 14.5px; line-height: 1.45; color: var(--c-muted); }
  .web-panel__lista b { display: block; margin-bottom: 2px; font: 700 15.5px var(--font-display); color: var(--c-ink); }
  .web-panel__ico { flex: none; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: var(--c-accent-hover);
    background: linear-gradient(180deg, rgba(92, 119, 255, 0.22), rgba(11, 51, 251, 0.10)); border: 1px solid var(--c-primary-tint); }
  .web-panel__pie { position: absolute; bottom: 30px; display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--c-subtle); }
  .web-panel__pie img { height: 22px; width: auto; display: block; opacity: .85; }
  html.web-acceso .web-panel { position: relative; }
  html.web-acceso #app { flex: none; width: 500px; max-width: 42vw; min-width: 440px; margin: 0; border-left: 1px solid var(--glass-line); box-shadow: -30px 0 80px -40px rgba(0, 0, 0, 0.8); }
  html.web-acceso #app .scroll { justify-content: safe center; padding: 48px 48px; }
  html.web-acceso #app .scroll > [style*="margin-top:auto"] { margin-top: 10px !important; }
  html.web-acceso #app .hero-art, html.web-acceso #app .hero-glow, html.web-acceso #app .scroll > .brand { display: none; }
  html.web-acceso #app .actionbar { padding-left: 48px; padding-right: 48px; }
}

/* Web de escritorio con sesión (html.web-sesion) y páginas públicas (html.web): menú lateral, contenido centrado
   y hojas como ventanas. Solo en la web y desde 900 px; la app y el teléfono no cambian. */
.web-menu { display: none; }
@media (min-width: 900px) {
  html.web:not(.web-acceso) #app { max-width: none; }
  html.web:not(.web-acceso) #app .scroll { padding-left: max(40px, calc((100% - 1280px) / 2)) !important; padding-right: max(40px, calc((100% - 1280px) / 2)) !important; padding-top: 32px; }
  html.web:not(.web-acceso) #app .appbar, html.web:not(.web-acceso) #app .actionbar { padding-left: max(40px, calc((100% - 1280px) / 2)); padding-right: max(40px, calc((100% - 1280px) / 2)); }
  html.web:not(.web-acceso) body { background: radial-gradient(60% 50% at 100% 0%, rgba(11, 51, 251, 0.14), transparent 70%), var(--c-ground); }
  html.web-sesion body { display: flex; }
  html.web-sesion #app { flex: 1; min-width: 0; background: transparent; }
  html.web-sesion #app .screen { background: transparent; }
  html.web-sesion #app .tabbar { display: none; }
  html.web-sesion #app .scroll { padding-bottom: 48px; }
  html.web-sesion .web-menu { display: flex; flex-direction: column; gap: 6px; flex: none; width: 260px; height: 100dvh; padding: 26px 16px 18px; overflow-y: auto;
    background: rgba(20, 24, 32, 0.72); border-right: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
  .web-menu__logo { padding: 0 10px 18px; }
  .web-menu__logo img { height: 32px; width: auto; display: block; }
  .web-menu__nuevo { margin: 0 4px 14px; gap: 8px; }
  .web-menu nav { display: flex; flex-direction: column; gap: 4px; }
  .web-menu__item { display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 14px; border-radius: 12px; color: var(--c-muted); text-decoration: none; font: 600 15px var(--font-display); }
  .web-menu__item:hover { background: rgba(255, 255, 255, 0.05); color: var(--c-ink); }
  .web-menu__item.on { background: var(--c-primary-soft); color: var(--c-ink); }
  .web-menu__item.on svg { color: var(--c-accent); }
  .web-menu__num { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid; place-items: center; background: var(--c-primary); color: #fff; font: 700 12px var(--font-display); }
  .web-menu__abajo { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--glass-line); }
  .web-menu__yo { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; text-decoration: none; color: var(--c-ink); }
  .web-menu__yo:hover { background: rgba(255, 255, 255, 0.05); }
  .web-menu__yo b { display: block; font: 700 14px var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
  .web-menu__yo small { color: var(--c-subtle); font-size: 12.5px; }
  html.web-sesion #app .topbar > .brand { visibility: hidden; }   /* el logo ya está en el menú lateral */
  html.web-sesion #app .grid-2:has(> .stat) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* Hojas inferiores → ventanas centradas sobre toda la página */
  html.web .layer { position: fixed; }
  html.web .sheet { inset: 0; margin: auto; width: min(540px, calc(100% - 48px)); height: fit-content; max-height: min(86vh, calc(100% - 24px)); overflow-y: auto; border-radius: 22px; padding: 26px 28px; }
  html.web .sheet__grip { display: none; }
  html.web .toast { position: fixed; }
}

/* Elegir «Solo firmar» o «Enviar a firmar» (06-enviar, paso 1) */
.modo-firma { gap: 10px; }
.modo-firma__op { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; text-align: left; border-radius: var(--r-lg);
  border: 1.5px solid var(--c-line); background: var(--c-surface); color: var(--c-ink); font: inherit; cursor: pointer; transition: border-color .15s, background .15s; }
.modo-firma__op .t-cap { line-height: 1.35; }
.modo-firma__ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 4px; color: var(--c-accent); background: var(--c-primary-soft); }
.modo-firma__check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--c-primary); opacity: 0; transform: scale(.6); transition: .15s; }
.modo-firma__op.on { border-color: var(--c-accent); background: var(--c-primary-softer); }
.modo-firma__op.on .modo-firma__check { opacity: 1; transform: none; }

/* Lo último de una pantalla nunca queda detrás de la barra de acción o de la barra inferior.
   WebKit ignora a veces el padding inferior de un contenedor flex con desplazamiento: se usa un espaciador real. */
.screen:has(> .actionbar) > .scroll, .screen:has(> .tabbar) > .scroll { padding-bottom: 0 !important; }
.screen:has(> .actionbar) > .scroll::after, .screen:has(> .tabbar) > .scroll::after { content: ''; display: block; flex: none; height: calc(var(--safe-bottom) + 124px); }
@media (min-width: 900px) { html.web-sesion .screen:has(> .tabbar):not(:has(> .actionbar)) > .scroll::after { height: 32px; } }
.web-p12 { gap: 16px; }

/* Nombre del documento que se toca para renombrarlo (detalle) */
.doc-nombre { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--c-ink); font: 700 15px var(--font-display); text-align: left; cursor: pointer; }
.doc-nombre svg { flex: none; color: var(--c-subtle); }
.doc-nombre:hover svg { color: var(--c-accent); }

/* El campo «Firma aquí» siempre como el rectángulo del otro flujo: el texto escala con el recuadro y nunca se parte */
.sig-overlay { container-type: size; }
.sig-overlay .sig-field { height: 100%; border-radius: 8px; white-space: nowrap; font-size: clamp(9px, 30cqh, 14px); gap: 0.4em; padding: 0 6px; }
.sig-overlay .sig-field svg { width: 1.1em; height: 1.1em; flex: none; }

/* Franja permanente cuando el dispositivo usa un servidor que no es el de fábrica (selector de servidor) */
#franjaServidor { position: fixed; z-index: 50; left: 0; right: 0; top: 0; padding: calc(var(--safe-top) + 2px) 12px 3px; text-align: center; font: 700 11px var(--font-display);
  color: #1B1300; background: #F5B83D; text-decoration: none; letter-spacing: .02em; }
#franjaServidor[hidden] { display: none; }

/* Documentos y nube en una sola lista */
.card--btn { width: 100%; text-align: left; font: inherit; color: var(--c-ink); cursor: pointer; }
.doc-nube { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: var(--c-accent); background: var(--c-primary-soft); }
.nube-resumen { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-control); background: var(--c-surface); border: 1px solid var(--c-line);
  color: var(--c-muted); text-decoration: none; font-size: 13px; font-weight: 600; }
.nube-resumen svg { color: var(--c-accent); flex: none; }

/* Deslizar para actualizar */
.ptr { position: absolute; z-index: 15; left: 50%; top: calc(var(--safe-top) + 8px); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c-surface); border: 1px solid var(--c-line); box-shadow: var(--sh-float); color: var(--c-subtle); opacity: 0; transform: translate(-50%, -50px);
  transition: opacity .15s, color .15s; pointer-events: none; }
.ptr--listo { color: var(--c-accent); }
.ptr--girando .ptr__ico { animation: ptrGira .8s linear infinite; color: var(--c-accent); }
.ptr__ico { display: grid; place-items: center; }
@keyframes ptrGira { to { transform: rotate(360deg); } }

.paso-n { flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font: 700 12px var(--font-display); color: #fff; background: var(--c-primary); }

/* reCAPTCHA: en la app la insignia flotante va escondida (Google lo permite si se muestra su aviso, R.avisoRecaptcha);
   en la web se ve normal */
html.nativo .grecaptcha-badge { visibility: hidden !important; }
@media (max-width: 899px) { .grecaptcha-badge { visibility: hidden !important; } }
.aviso-recaptcha { margin: 6px auto 0; max-width: 320px; line-height: 1.45; }
.aviso-recaptcha a { color: var(--c-muted); text-decoration: underline; }

/* Volver a la página principal (solo web): píldora de vidrio con ícono en círculo azul */
.web-panel__inicio-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff;
  background: linear-gradient(180deg, #2F55FF, var(--c-primary)); box-shadow: 0 6px 16px -6px rgba(11, 51, 251, 0.8), inset 0 1px 0 rgba(255,255,255,0.25); }
.volver-inicio { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 5px; border-radius: 999px; text-decoration: none;
  font: 700 13.5px var(--font-display); color: var(--c-ink); background: rgba(255,255,255,0.07); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.06); }
.volver-inicio .web-panel__inicio-ico { width: 28px; height: 28px; }
@media (min-width: 900px) {
  .web-panel__arriba { position: absolute; top: 32px; left: clamp(40px, 7vw, 120px); right: clamp(40px, 7vw, 120px); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .web-panel__arriba .web-panel__logo { position: static; }
  .web-panel__inicio { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px 0 7px; border-radius: 999px; text-decoration: none;
    font: 700 14px var(--font-display); color: var(--c-ink); background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.04));
    border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px -14px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.08); transition: transform .18s ease, background .18s ease, border-color .18s ease; }
  .web-panel__inicio .web-panel__inicio-ico { transition: transform .18s ease; }
  .web-panel__inicio { padding-right: 18px; }
  .web-panel__inicio:hover { transform: translateY(-1px); border-color: var(--c-primary-tint); background: linear-gradient(180deg, rgba(92,119,255,0.16), rgba(11,51,251,0.06)); }
  .web-panel__inicio:hover .web-panel__inicio-ico { transform: translateX(-3px); }   /* la flecha «se va» hacia atrás */
  html.web-acceso .bienvenida-arriba { display: none; }
}

.aviso-web-nube { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-control); font-size: 13px; line-height: 1.45; color: var(--c-muted);
  background: linear-gradient(180deg, rgba(92,119,255,0.12), rgba(11,51,251,0.05)); border: 1px solid var(--c-primary-tint); }
.aviso-web-nube svg { flex: none; color: var(--c-accent); }
.aviso-web-nube b { color: var(--c-ink); }

/* ---------- Primeros pasos (screens/13-empezar.js) e Inicio ---------- */
.stats-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stats-3 .stat { padding: 14px 12px; }
.stats-3 .stat__label { font-size: var(--fs-xs); line-height: 1.3; }
.config-inicio .btn--sm, .config-paso__btn { gap: 6px; flex: none; }
.config-barra { display: block; height: 6px; border-radius: var(--r-pill); background: var(--c-primary-softer); overflow: hidden; }
.config-barra > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--c-primary), var(--c-accent)); transition: width .3s; }
.config-inicio { gap: 12px; text-decoration: none; color: var(--c-ink); border-color: var(--c-primary-tint); }
.firma-inicio { flex-direction: row; align-items: center; gap: 12px; text-decoration: none; color: var(--c-ink); }
.config-paso { gap: 0; }
.config-paso__num { width: 32px; height: 32px; border-radius: var(--r-pill); display: grid; place-items: center; flex: none;
  font: 700 var(--fs-sm) var(--font-display); color: var(--c-accent); background: var(--c-primary-soft); }
.config-paso--hecho .config-paso__num { color: var(--c-ok); background: var(--c-ok-bg); }
.config-paso__btn { align-self: flex-start; margin-top: 8px; }
.recorrido { display: flex; flex-direction: column; }
.recorrido__diapo { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; min-height: 52vh; }
.recorrido__ico { width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; color: var(--c-accent);
  background: var(--c-primary-soft); border: 1px solid var(--c-primary-tint); box-shadow: var(--sh-card); }
.recorrido__puntos { justify-content: center; margin: 8px 0; }
.recorrido__puntos > i.wide { width: 22px; }
.lista-cuenta svg { flex: none; margin-top: 1px; }
.nube-resumen__texto { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nube-resumen__texto b { color: var(--c-ink); font-weight: 700; }
.nube-cerrada { gap: 12px; text-decoration: none; color: var(--c-ink); border-color: var(--c-primary-tint); }
.p12-falta { gap: 12px; text-decoration: none; color: var(--c-ink); border-color: var(--c-primary-tint); }

/* ---------- «Procesando…» automático (js/cargando.js, como LunaCuentos) ----------
   Encima de todo menos de los avisos (toast); bloquea los toques mientras dura para que no se pida dos veces. */
.vs-cargando { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 24px; background: rgba(10, 13, 20, 0.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .18s ease; }
.vs-cargando[hidden] { display: none; }
.vs-cargando__caja { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 200px; max-width: 320px; padding: 22px 26px; border-radius: 16px; background: var(--c-surface); border: 1px solid var(--c-line); box-shadow: var(--sh-float); text-align: center; }
.vs-cargando__rueda { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--c-primary-tint); border-top-color: var(--c-accent); animation: spin .8s linear infinite; }
.vs-cargando__texto { margin: 0; color: var(--c-ink); font-family: var(--font-display); font-size: 15px; font-weight: 600; line-height: 1.4; }
.vs-cargando__largo { margin: 0; color: var(--c-muted); font-size: 12.5px; line-height: 1.45; }
.vs-cargando__largo[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .vs-cargando__rueda { animation-duration: 2.4s; } }

/* App de Android en tableta (core.js › marcoWeb): el menú lateral de la web, por debajo de la barra de estado */
@media (min-width: 900px) {
  html.app-tableta.web-sesion .web-menu { padding-top: calc(var(--safe-top) + 14px); padding-bottom: calc(var(--safe-bottom) + 12px); }
  /* El contenido ocupa el panel como en la web (antes quedaba del ancho de un teléfono al lado del menú) */
  html.app-tableta.web-sesion #app { max-width: none; }
  html.app-tableta.web-sesion #app .scroll { padding-left: max(40px, calc((100% - 1280px) / 2)) !important; padding-right: max(40px, calc((100% - 1280px) / 2)) !important; padding-top: calc(var(--safe-top) + 24px); }
  html.app-tableta.web-sesion #app .appbar, html.app-tableta.web-sesion #app .actionbar { padding-left: max(40px, calc((100% - 1280px) / 2)); padding-right: max(40px, calc((100% - 1280px) / 2)); }
  /* Hojas como ventanas centradas, igual que en la web */
  html.app-tableta .layer { position: fixed; }
  html.app-tableta .sheet { inset: 0; margin: auto; width: min(540px, calc(100% - 48px)); height: fit-content; max-height: min(86vh, calc(100% - 24px)); overflow-y: auto; border-radius: 22px; padding: 26px 28px; }
  html.app-tableta .sheet__grip { display: none; }
  html.app-tableta .toast { position: fixed; }
  html.app-tableta .web-panel__inicio { display: none; }
  html.app-tableta .web-panel__logo { pointer-events: none; }
  html.app-tableta .web-panel__arriba { top: calc(var(--safe-top) + 24px); }
  html.app-tableta.web-acceso .web-panel { padding-top: calc(var(--safe-top) + 40px); padding-bottom: calc(var(--safe-bottom) + 40px); }
}

/* Con el teclado abierto la pantalla se achica: una hoja nunca es más alta que lo visible (se desplaza por dentro) */
.sheet { max-height: calc(100% - 12px); overflow-y: auto; overscroll-behavior: contain; }

/* Foco que pone el código (título de cada pantalla, hoja al abrirse): sin anillo; el teclado sigue viéndolo en los controles */
.foco-titulo:focus, .sheet:focus { outline: none; }

/* Área táctil mínima (--touch-min) sin cambiar el tamaño visible: un ::after invisible amplía el toque
   de enlaces-botón, chips, botones pequeños y segmentados. Las filas de chips tienen overflow: se les da
   el aire justo para que el área no cree un scroll vertical */
.link-btn, .chip, .btn--sm, .segmented button { position: relative; }
.link-btn::after, .chip::after, .btn--sm::after, .segmented button::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: var(--touch-min); min-height: 100%; transform: translateY(-50%); }
.chips { padding-top: calc((var(--touch-min) - var(--h-chip)) / 2); padding-bottom: calc((var(--touch-min) - var(--h-chip)) / 2); }
