:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --line: #e2e5ec;
  --text: #171a21;
  --muted: #646b7a;
  --accent: #8a1c2b;
  --accent-soft: #f6e9eb;
  --on-accent: #ffffff;
  --oro: #b08d57;
  --oro-claro: #e6cf9f;
  --negro: #0e0c0d;
  --ok: #138a52;
  --ok-soft: #e3f5ec;
  --warn: #a86400;
  --warn-soft: #fff3dc;
  --danger: #c8322b;
  --danger-soft: #fde9e7;
  --info: #6a42c2;
  --info-soft: #efe9fb;
  --wa: #1faa59;
  --shadow: 0 1px 2px rgba(20, 24, 34, .06), 0 4px 14px rgba(20, 24, 34, .05);
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --surface: #1a1d24;
    --surface-2: #232731;
    --line: #2d323d;
    --text: #eceef3;
    --muted: #9aa1b0;
    --accent: #d9b574;
    --accent-soft: #3a3020;
    --on-accent: #1a1308;
    --ok: #45c98a;
    --ok-soft: #173326;
    --warn: #f0b04c;
    --warn-soft: #3a2c14;
    --danger: #f27166;
    --danger-soft: #3d1c1a;
    --info: #b29af0;
    --info-soft: #2b2342;
    --wa: #34c46e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: var(--safe-bottom);
}
body.no-scroll { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
small { display: block; font-size: .8rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .88rem; }
.center { text-align: center; }
.small-txt { font-size: .8rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.hidden:not(.pob-app *) { display: none !important; }
.warn-txt { color: var(--warn); }
.danger-txt { color: var(--danger) !important; }
.ok-txt { color: var(--ok) !important; }

svg { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.fill { fill: currentColor; stroke: none; }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 42px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, background-color .15s ease, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn.big { min-height: 50px; font-size: 1.02rem; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text); cursor: pointer; font-size: 1.15rem;
}
.icon-btn:active { background: var(--surface-2); }

input, textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 44px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: grid; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--muted); }
label > input, label > textarea, label > select { color: var(--text); font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0; display: grid; gap: 10px; }
legend { display: flex; align-items: center; gap: 6px; font-weight: 650; padding: 0 6px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: .9rem;
  padding: 7px 14px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg.small button { font-size: .85rem; padding: 6px 12px; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--text); font-weight: 500; font-size: .95rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }

.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 700; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 650; padding: 3px 8px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.muted-tag { background: var(--surface-2); color: var(--muted); }
.tag svg { width: .95em; height: .95em; }

.avatar {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem;
}
.avatar.sm { width: 34px; height: 34px; font-size: .78rem; }
.avatar.xs { width: 26px; height: 26px; font-size: .68rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }

/* Estados de aviso */
.st-enterado { --st: var(--ok); --st-soft: var(--ok-soft); }
.st-no_puedo { --st: var(--danger); --st-soft: var(--danger-soft); }
.st-abierto { --st: var(--warn); --st-soft: var(--warn-soft); }
.st-avisado { --st: var(--info); --st-soft: var(--info-soft); }
.st-sin_aviso { --st: var(--muted); --st-soft: var(--surface-2); }
.avatar[class*="st-"] { background: var(--st-soft); color: var(--st); box-shadow: 0 0 0 2px var(--st); }
.persona-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 20px; background: var(--st-soft); color: var(--st); white-space: nowrap; }
.persona-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--st); }

/* ---------- Estructura ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 18px 16px 48px; }
.wrap.narrow { max-width: 760px; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-top)) 12px 8px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; overflow: hidden; }
.brand-emblema { width: 46px; height: 35px; object-fit: cover; border-radius: 9px; background: var(--negro); box-shadow: 0 0 0 1px color-mix(in srgb, var(--oro) 45%, transparent), 0 2px 8px rgba(0,0,0,.18); flex: none; }
.brand-txt { display: grid; line-height: 1.1; min-width: 0; }
.brand-txt b { font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-txt small { font-size: .74rem; color: var(--muted); letter-spacing: .02em; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent); }
.top-title { flex: 1; font-weight: 650; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.chip-link { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: .88rem; font-weight: 600; }

.demo-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px;
  padding: calc(6px + var(--safe-top)) 14px 6px; font-size: .82rem;
  background: var(--warn-soft); color: var(--warn);
}
.demo-bar + .top { padding-top: 8px; }
.demo-bar label { display: flex; align-items: center; gap: 8px; color: inherit; font-weight: 600; font-size: .82rem; }
.demo-bar select { width: auto; padding: 4px 8px; font-size: .85rem; }

.splash { min-height: 100vh; display: grid; place-items: center; background: var(--negro); }
.splash img { border-radius: 14px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; transform: scale(.94); } }
@media (prefers-reduced-motion: reduce) { .splash img { animation: none; } }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 28px 22px; box-shadow: var(--shadow); display: grid; gap: 16px; text-align: center; }
.auth-card form { text-align: left; }
.auth-card .seg { justify-self: center; }
.auth-logo { justify-self: center; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 17px; background: var(--accent); color: var(--on-accent); font-size: 1.7rem; }
.stack { display: grid; gap: 14px; }

/* ---------- Pizarra ---------- */
.board-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.board-head p { text-transform: none; margin-top: 4px; }
.board-head p::first-letter { text-transform: uppercase; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search { flex: 1; min-width: 160px; max-width: 320px; padding: 8px 12px; }

.alert-panel { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.alert-panel.info { border-left-color: var(--info); }
.alert-panel h2 { display: flex; align-items: center; gap: 8px; font-size: .95rem; margin-bottom: 8px; }
.alert-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.alert-panel a { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 7px 4px; border-radius: 8px; font-size: .88rem; }
.alert-panel a:hover { background: var(--surface-2); }
.alert-txt { color: var(--muted); }
.alert-act { font-weight: 600; }

.col-tabs { display: none; width: 100%; margin-bottom: 12px; }
.col-tabs button { flex: 1; justify-content: center; white-space: nowrap; padding: 7px 6px; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col { background: var(--surface-2); border-radius: 18px; padding: 12px; min-height: 160px; }
.col-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; font-size: .95rem; }
.col-h .count { background: var(--surface); }
.col-body { display: grid; gap: 10px; }
.empty { color: var(--muted); font-size: .9rem; text-align: center; padding: 22px 8px; }
.empty.big { padding: 60px 16px; font-size: 1rem; }

.card { display: grid; gap: 8px; background: var(--surface); border-radius: var(--radius); padding: 13px 14px; box-shadow: var(--shadow); border: 1px solid transparent; transition: transform .12s ease, border-color .15s; }
.card:hover { border-color: var(--line); }
.card:active { transform: scale(.985); }
.card.en_curso { border-left: 3px solid var(--accent); }
.card.cancelada { opacity: .65; }
.card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.folio { font-size: .78rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.card h3 { font-size: 1rem; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .82rem; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta.big { font-size: .9rem; gap: 6px 16px; }
.progress { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress div { height: 100%; background: var(--ok); border-radius: 3px; }
.progress-txt { font-size: .75rem; color: var(--muted); margin-top: -4px; }
.people { display: flex; flex-wrap: wrap; gap: 5px; }
.card-foot { font-size: .75rem; color: var(--muted); }

/* ---------- Formulario ---------- */
.form-card { background: var(--surface); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pasos-edit { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.pasos-edit li::marker { color: var(--muted); font-weight: 600; }
.check-list { display: grid; gap: 6px; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; color: var(--text); font-weight: 500; font-size: .95rem; }
.check-item input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.check-item small { color: var(--muted); font-weight: 400; }
.check-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.externo-row { display: grid; grid-template-columns: 1fr 1fr 40px; gap: 8px; align-items: center; }
#externos { display: grid; gap: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Detalle ---------- */
.detalle { display: grid; gap: 14px; }
.det-head { display: grid; gap: 10px; padding: 4px 2px 6px; }
.det-head h1 { overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.estado { font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 8px; text-transform: uppercase; letter-spacing: .03em; }
.e-pendiente { background: var(--warn-soft); color: var(--warn); }
.e-en_curso { background: var(--accent-soft); color: var(--accent); }
.e-cerrada { background: var(--ok-soft); color: var(--ok); }
.e-cancelada { background: var(--surface-2); color: var(--muted); }
.desc { color: var(--text); white-space: pre-wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.panel { background: var(--surface); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.panel.highlight { border: 2px solid var(--accent); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel h2 { display: flex; align-items: center; gap: 8px; }

.persona { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.persona:first-of-type { border-top: 0; padding-top: 0; }
.persona-info { display: grid; gap: 4px; min-width: 0; }
.persona-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.hitos { list-style: none; margin: 4px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); display: grid; gap: 5px; }
.hitos li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; font-size: .84rem; position: relative; }
.hitos li::before { content: ""; position: absolute; left: -17px; top: .45em; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.hitos .h-avisado::before { background: var(--info); }
.hitos .h-abierto::before { background: var(--warn); }
.hitos .h-enterado::before { background: var(--ok); }
.hitos .h-no_puedo::before { background: var(--danger); }
.hitos time, .bitacora time, .c-h time { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.add-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.add-row > input, .add-row > select, .add-row > textarea { flex: 1 1 180px; }
.add-row .btn { flex: none; min-height: 44px; }

.pasos { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: p; }
.pasos li { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 8px 4px; border-radius: 10px; }
.pasos li.done > div > div:first-child { color: var(--muted); text-decoration: line-through; }
.chk { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; transition: background .15s, border-color .15s; }
.chk { position: relative; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.chk::after { content: ""; position: absolute; inset: -9px; } /* zona de toque más amplia que el cuadro */
.chk:not(:disabled):active { transform: scale(.9); }
.chk svg { width: 16px; height: 16px; stroke-width: 3; }
.pasos li.done .chk { background: var(--ok); border-color: var(--ok); color: #fff; }
.chk:disabled { cursor: default; opacity: .8; }

.informe .pre { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.validacion { border-radius: 12px; padding: 10px 12px; font-size: .9rem; display: grid; gap: 4px; }
.v-aprobada { background: var(--ok-soft); color: var(--ok); }
.v-observada { background: var(--warn-soft); color: var(--warn); }
.validacion p { color: var(--text); }

.comentarios { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.comentarios li { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; }
.comentarios li.enc { background: var(--ok-soft); }
.c-h { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.c-h time { margin-left: auto; }

.bitacora { list-style: none; margin: 0; padding: 0; display: grid; }
.bitacora li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 8px 0 8px 14px; border-left: 2px solid var(--line); font-size: .86rem; position: relative; }
.bitacora li::before { content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.bitacora .b-aviso::before { background: var(--info); }
.bitacora .b-abierto::before { background: var(--warn); }
.bitacora .b-enterado::before, .bitacora .b-cerrada::before, .bitacora .b-validada::before { background: var(--ok); }
.bitacora .b-no_puedo::before, .bitacora .b-cancelada::before { background: var(--danger); }
.bitacora .b-creada::before, .bitacora .b-iniciada::before { background: var(--accent); }

/* ---------- Página del aviso (la abre el compañero) ---------- */
.aviso-page { min-height: 100vh; padding: calc(20px + var(--safe-top)) 16px 32px; display: grid; place-items: start center; }
.aviso-card { width: 100%; max-width: 520px; background: var(--surface); border-radius: 22px; padding: 22px 18px; box-shadow: var(--shadow); display: grid; gap: 16px; }
.aviso-top { display: flex; align-items: center; gap: 12px; }
.aviso-top .logo { width: 44px; height: 44px; border-radius: 13px; font-size: 1.3rem; }
.aviso-act { background: var(--surface-2); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.aviso-act h2 { font-size: 1.2rem; }
.aviso-act h3 { font-size: .9rem; color: var(--muted); }
.pasos-simple { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.pasos-simple .done { color: var(--muted); text-decoration: line-through; }
.respuesta { display: flex; gap: 12px; align-items: center; border-radius: 14px; padding: 12px 14px; }
.respuesta svg { width: 26px; height: 26px; stroke-width: 2.6; }
.r-enterado { background: var(--ok-soft); color: var(--ok); }
.r-no_puedo { background: var(--danger-soft); color: var(--danger); }
.respuesta small { color: var(--text); }
.cambiar summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .92rem; padding: 4px 0; }
.cambiar[open] summary { margin-bottom: 12px; }

/* ---------- Equipo y perfil ---------- */
.equipo { list-style: none; margin: 0; padding: 0; display: grid; }
.equipo li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.equipo li:first-child { border-top: 0; }
.equipo select { width: auto; }
.perfil-head { display: flex; align-items: center; gap: 14px; }
.steps-help { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.steps-help svg { vertical-align: -3px; color: var(--accent); }

/* ---------- Modal tipo hoja ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 18, .45); display: none; align-items: flex-end; justify-content: center; }
.modal.open { display: flex; animation: fade .18s ease; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  background: var(--surface); border-radius: 22px 22px 0 0; padding: 22px 18px calc(20px + var(--safe-bottom));
  display: grid; gap: 14px; animation: subir .26s cubic-bezier(.2, .9, .3, 1);
}
.sheet h2 { display: flex; align-items: center; gap: 8px; padding-right: 40px; font-size: 1.15rem; }
.sheet-x { position: absolute; top: 12px; right: 10px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-actions .btn.wa { flex: 1 1 100%; }
.modal-actions .btn:not(.wa) { flex: 1; }
.sheet.pv-ventana { max-width: 760px; height: 92vh; height: 92dvh; max-height: none; overflow: hidden; display: flex; flex-direction: column; }
.pv-datos { margin: 0; overflow-wrap: anywhere; }
.pv-hojas { flex: 1 1 0; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--surface-2); border-radius: 12px; padding: 14px; display: grid; gap: 16px; align-content: start; }
.pv-hoja { margin: 0; display: grid; gap: 6px; }
.pv-papel { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 8px 22px -12px rgba(0,0,0,.45); border-radius: 2px; overflow: hidden; }
.pv-papel canvas { display: block; width: 100%; height: 100%; }
.pv-hoja figcaption { text-align: center; font-size: .78rem; color: var(--muted); }
.warn-box { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 10px; font-size: .88rem; }
@keyframes subir { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 700px) {
  .modal { align-items: center; }
  .sheet { border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) { .modal.open, .sheet { animation: none; } }

.toast {
  position: fixed; left: 50%; bottom: calc(18px + var(--safe-bottom)); z-index: 60;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-size: .92rem; font-weight: 600; box-shadow: 0 8px 28px rgba(0,0,0,.2);
  transition: transform .25s ease, opacity .25s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--danger); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }

/* ---------- Módulos ---------- */
.mod-top { flex: 1; display: flex; justify-content: center; gap: 4px; }
.mod-link { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: .92rem; position: relative; }
.mod-link.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: none;
  padding: 6px 8px calc(6px + var(--safe-bottom)); gap: 4px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0 3px; border-radius: 10px; color: var(--muted); font-size: .72rem; font-weight: 600; position: relative; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--accent); }
.tab .badge { position: absolute; top: 0; left: calc(50% + 6px); }
.top-title.con-modulos { flex: 0 1 auto; max-width: 200px; text-align: left; }
.pob-marco { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: var(--bg); }
.pob-marco > .top { position: static; flex: none; }
.pob-marco > .tabbar { position: static; flex: none; }

/* ---------- Datos generales ---------- */
.c-amarillo { --papel: #fff5c4; --papel-borde: #efd979; --papel-tinta: #6b5300; }
.c-azul     { --papel: #e2ecff; --papel-borde: #b9cdf6; --papel-tinta: #2348a8; }
.c-verde    { --papel: #e0f5e6; --papel-borde: #b2dfbf; --papel-tinta: #1d6b3b; }
.c-rosa     { --papel: #fde3ec; --papel-borde: #f4b9cd; --papel-tinta: #9c2a54; }
.c-morado   { --papel: #eee6fd; --papel-borde: #cfbdf3; --papel-tinta: #5b35a8; }
.c-gris     { --papel: #eef0f4; --papel-borde: #d4d8e0; --papel-tinta: #4a5263; }
@media (prefers-color-scheme: dark) {
  .c-amarillo { --papel: #38321a; --papel-borde: #5a4f22; --papel-tinta: #f2d77a; }
  .c-azul     { --papel: #1d2741; --papel-borde: #2f3e66; --papel-tinta: #9db8f7; }
  .c-verde    { --papel: #1b3124; --papel-borde: #2b4c37; --papel-tinta: #8fd6a7; }
  .c-rosa     { --papel: #3a1e28; --papel-borde: #5b2f40; --papel-tinta: #f2a3bf; }
  .c-morado   { --papel: #2a2240; --papel-borde: #433666; --papel-tinta: #c4aef5; }
  .c-gris     { --papel: #252931; --papel-borde: #393f4b; --papel-tinta: #b7bfcd; }
}

.chips-filtro { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding-bottom: 2px; }
.chips-filtro::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 10px; border-radius: 20px; cursor: pointer; }
.chip svg { width: 1em; height: 1em; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.on .count { background: color-mix(in srgb, var(--bg) 20%, transparent); color: inherit; }
.switch.small { font-size: .88rem; gap: 8px; }
.switch.small .track { width: 38px; height: 23px; }
.switch.small .track::after { width: 17px; height: 17px; }
.switch.small input:checked + .track::after { transform: translateX(15px); }

.dsec { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 18px 2px 10px; }
.dgrid { columns: 4 250px; column-gap: 14px; }
.dcard {
  display: grid; gap: 8px; break-inside: avoid; margin-bottom: 14px;
  background: var(--papel); border: 1px solid var(--papel-borde); border-radius: 14px; padding: 13px 14px 11px;
  box-shadow: 0 1px 2px rgba(20, 24, 34, .05), 0 6px 16px -8px rgba(20, 24, 34, .18);
  transition: transform .14s ease, box-shadow .14s ease;
}
.dcard:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(20, 24, 34, .06), 0 12px 24px -10px rgba(20, 24, 34, .25); }
.dcard:active { transform: scale(.985); }
.dcard.archivada { opacity: .7; }
.dcard h3 { font-size: 1.02rem; overflow-wrap: anywhere; }
.dcard-top { display: flex; align-items: center; gap: 6px; }
.dtipo { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--papel-tinta); }
.dtipo svg { width: 1.05em; height: 1.05em; }
.dpin { color: var(--papel-tinta); display: inline-flex; }
.dnuevo { margin-left: auto; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--danger); color: #fff; }
.dnuevo.cambio { background: var(--warn); }
.dcard-body { color: var(--text); font-size: .9rem; min-width: 0; }
.dcard-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .74rem; color: var(--muted); }
.detq { padding: 1px 7px; border-radius: 6px; background: color-mix(in srgb, var(--papel-tinta) 12%, transparent); color: var(--papel-tinta); font-weight: 600; }
.dseg { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-weight: 600; }
.dseg svg { width: 1em; height: 1em; }
.dseg.s-recibido { color: var(--ok); }
.dseg.s-visto { color: var(--accent); }
.dseg.s-viejo { color: var(--warn); }
.dseg.s-sin_ver { color: var(--muted); }

.d-nota { margin: 0; overflow-wrap: anywhere; }
.d-nota.clamp { display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.d-ficha { margin: 0; display: grid; gap: 6px; }
.d-ficha > div { display: grid; gap: 1px; }
.d-ficha dt { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.d-ficha dd { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 600; overflow-wrap: anywhere; }
.d-ficha dd span { flex: 1; min-width: 0; }
.mini-copy { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--papel-borde, var(--line)); background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--muted); cursor: pointer; }
.mini-copy:active { transform: scale(.94); }
.d-mas { font-size: .78rem; color: var(--muted); margin: 4px 0 0; }
.d-lista { margin: 0; padding-left: 20px; display: grid; gap: 3px; overflow-wrap: anywhere; }
.d-tabla-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--papel-borde, var(--line)); background: var(--surface); }
.d-tabla { border-collapse: collapse; width: 100%; font-size: .82rem; }
.d-tabla th, .d-tabla td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.d-tabla th { background: var(--surface-2); font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.d-tabla tr:last-child td { border-bottom: 0; }
.d-contacto-previa { display: grid; gap: 2px; }
.d-contacto-previa span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: .84rem; }
.d-contacto { display: grid; gap: 14px; }
.d-contacto-top { display: flex; align-items: center; gap: 12px; }
.d-contacto-top b { font-size: 1.1rem; }
.d-contacto-top small { color: var(--muted); }

.datos-vacio { display: grid; justify-items: center; gap: 10px; }
.datos-vacio .logo { width: 52px; height: 52px; border-radius: 15px; font-size: 1.5rem; }
.datos-vacio b { color: var(--text); font-size: 1.1rem; }

.h-centro { text-align: center; margin: 8px 0 18px; }
.tipos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tipo-card { display: grid; gap: 6px; align-content: start; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .12s ease, border-color .15s; }
.tipo-card:hover { border-color: var(--accent); }
.tipo-card:active { transform: scale(.98); }
.tipo-card b { font-size: 1.05rem; }
.tipo-card span:not(.tipo-icon) { font-size: .9rem; }
.tipo-card small { color: var(--muted); }
.tipo-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 1.3rem; }
.tipo-sel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.tipo-sel .muted { font-size: .85rem; }

.fila-edit { display: grid; grid-template-columns: 28px 1fr 1.3fr 40px; gap: 8px; align-items: center; border-radius: 10px; }
.fila-edit.uno { grid-template-columns: 28px 1fr 40px; }
.asa { display: inline-grid; place-items: center; width: 28px; height: 36px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: grab; position: relative; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.asa::after { content: ""; position: absolute; inset: -4px; }
.asa svg { width: 16px; height: 16px; }
.asa:hover { background: var(--surface-2); color: var(--text); }
.moviendo { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); }
.t-fila.moviendo td { background: var(--accent-soft); }
body.arrastrando, body.arrastrando * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
#filas { display: grid; gap: 8px; }
.span2 { grid-column: 1 / -1; }

.t-edit-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.t-edit { border-collapse: separate; border-spacing: 4px; min-width: 100%; }
.t-edit th, .t-edit td { padding: 0; position: relative; min-width: 136px; border-radius: 8px; }
.t-edit .t-asa { min-width: 28px; width: 28px; position: sticky; left: 0; z-index: 2; background: var(--surface); border-radius: 0; }
.t-edit th .asa { position: absolute; left: 1px; top: 50%; transform: translateY(-50%); width: 26px; height: 30px; z-index: 1; }
.t-edit .t-acc { min-width: 32px; width: 32px; }
.t-edit input { padding: 7px 9px; font-size: 15px; border-radius: 8px; }
.t-edit .t-col { font-weight: 700; background: var(--surface-2); padding-left: 28px; padding-right: 28px; }
.t-x { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.t-x svg { width: 14px; height: 14px; }
.t-edit th .t-x { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }
.t-x:hover { background: var(--danger-soft); color: var(--danger); }

.para-sel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.para-op { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--text); font-weight: 500; }
.para-op input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.para-op small { display: block; color: var(--muted); font-weight: 400; }
.para-op:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.colores { display: flex; gap: 10px; flex-wrap: wrap; }
.color-op { cursor: pointer; display: block; }
.color-op input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.color-op span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--papel); border: 2px solid var(--papel-borde); transition: transform .12s ease; }
.color-op input:checked + span { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); }
.color-op input:focus-visible + span { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }

.dhoja { background: var(--papel); border: 1px solid var(--papel-borde); border-radius: 18px; padding: 18px; display: grid; gap: 12px; box-shadow: 0 10px 30px -18px rgba(20, 24, 34, .35); }
.dhoja h1 { overflow-wrap: anywhere; }
.dhoja .tag { background: color-mix(in srgb, var(--papel-tinta) 14%, transparent); color: var(--papel-tinta); }
.dhoja .tag.muted-tag { background: color-mix(in srgb, var(--surface) 60%, transparent); color: var(--muted); }
.dhoja-body { font-size: 1rem; }
.dhoja.mini { padding: 10px 12px; gap: 6px; margin-top: 8px; box-shadow: none; font-size: .88rem; }
.anterior summary { cursor: pointer; color: var(--accent); font-size: .84rem; font-weight: 600; margin-top: 4px; }

main.wrap:has(+ .tabbar) { padding-bottom: 110px; }

/* ---------- Fotos ---------- */
.oculto { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
label.btn { position: relative; cursor: pointer; color: var(--text); font-weight: 600; display: inline-flex; }
label.btn.primary { color: var(--on-accent); }
img[data-foto]:not([src]) { background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 60%, var(--surface)), var(--surface-2)); background-size: 200% 100%; animation: brillo 1.2s linear infinite; }
img.sin-foto { animation: none; }
@keyframes brillo { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { img[data-foto]:not([src]) { animation: none; } }

.dportada { position: relative; margin: 0 -4px; }
.dportada img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--papel-borde); }
.dportada span { position: absolute; right: 8px; bottom: 8px; padding: 2px 9px; border-radius: 12px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .78rem; font-weight: 700; }
.dcard-body .dportada + * { margin-top: 8px; }

.dgaleria { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 4px; }
.dg-item { position: relative; padding: 0; border: 1px solid var(--papel-borde, var(--line)); border-radius: 12px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; display: block; }
.dg-item img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.dg-item span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; font-size: .76rem; font-weight: 600; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-item:active { transform: scale(.98); }
.dhoja-body .dgaleria { margin-top: 12px; }
.dhoja.mini .dgaleria { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }

.fotos-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.fotos-edit:empty { display: none; }
.fe-item { position: relative; display: grid; gap: 6px; }
.fe-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.fe-item.subiendo img { opacity: .5; }
.fe-estado { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font-size: .8rem; font-weight: 700; }
.fe-x { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; padding: 0; }
.fe-x svg { width: 14px; height: 14px; }
.fe-desc { font-size: 14px; padding: 6px 8px; }

.visor { display: grid; gap: 10px; padding-top: 30px; }
.visor img { width: 100%; max-height: 68vh; object-fit: contain; border-radius: 12px; background: var(--surface-2); min-height: 200px; }
.visor p { margin: 0; text-align: center; }
.visor-nav { display: flex; align-items: center; justify-content: center; gap: 16px; }
.visor-nav .gira svg { transform: rotate(180deg); }


/* ---------- Equipo, ayuda y diagnóstico ---------- */
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; padding: 4px; justify-self: center; }
.equipo li { grid-template-columns: auto 1fr auto; }
.equipo .roles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.equipo .roles:empty { display: none; }
.equipo-ctrl { display: grid; gap: 6px; justify-items: end; }
.roles-help { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: .92rem; }
.roles-help a { color: var(--accent); font-weight: 600; }

.diag-link { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 14px 0; }
.diag-link > svg:first-child { width: 22px; height: 22px; color: var(--accent); }
.diag-link > svg:last-child { transform: rotate(180deg); color: var(--muted); }
.diag-link small { display: block; }

.faq { border-top: 1px solid var(--line); }
.faq:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; padding: 12px 2px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-size: 1.2rem; line-height: 1; }
.faq[open] summary::after { content: "–"; }
.faq-body { padding: 0 2px 14px; color: var(--text); font-size: .93rem; display: grid; gap: 8px; }
.faq-body p { margin: 0; }
.faq-body ul, .faq-body ol { margin: 0; padding-left: 20px; display: grid; gap: 5px; }
.faq-body svg { vertical-align: -3px; color: var(--accent); }

.diag-resumen { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; }
.diag-resumen > svg { width: 30px; height: 30px; stroke-width: 2.6; flex: none; }
.diag-resumen b { font-size: 1.05rem; }
.diag-resumen small { display: block; color: var(--muted); }
.diag-resumen.ok { background: var(--ok-soft); color: var(--ok); }
.diag-resumen.aviso { background: var(--warn-soft); color: var(--warn); }
.diag-resumen.mal { background: var(--danger-soft); color: var(--danger); }
.diag-resumen b, .diag-resumen small { color: var(--text); }
.diag-lista { list-style: none; margin: 0; padding: 0; display: grid; }
.diag-lista li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.diag-lista li:first-child { border-top: 0; padding-top: 0; }
.diag-lista p { margin: 2px 0 0; font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.diag-lista .diag-sol { color: var(--text); background: var(--surface-2); padding: 8px 10px; border-radius: 10px; margin-top: 6px; }
.diag-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; font-size: .85rem; }
.diag-ico svg { width: 15px; height: 15px; stroke-width: 3; }
.d-ok .diag-ico { background: var(--ok-soft); color: var(--ok); }
.d-mal .diag-ico { background: var(--danger-soft); color: var(--danger); }
.d-aviso .diag-ico { background: var(--warn-soft); color: var(--warn); }
.d-info .diag-ico { background: var(--accent-soft); color: var(--accent); }


/* ---------- Bienvenida (portada de la app) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bienvenida { position: fixed; inset: 0; z-index: 80; background: var(--negro); color: #f3e7cf; overflow: hidden; display: grid; transition: opacity .42s ease, transform .42s ease; }
.bienvenida.saliendo { opacity: 0; transform: scale(1.02); }
.bv-fondo { position: absolute; inset: -40px; background: url(../img/portada.jpg) center / cover no-repeat; filter: blur(26px) brightness(.26) saturate(1.1); transform: scale(1.08); }
.bv-velo { position: absolute; inset: 0; background: radial-gradient(120% 80% at 50% 40%, transparent 0%, rgba(8, 6, 7, .55) 70%, rgba(8, 6, 7, .9) 100%); }
.bv-contenido { position: relative; display: grid; grid-template-rows: 1fr auto; align-items: center; justify-items: center; padding: calc(40px + var(--safe-top)) 24px calc(36px + var(--safe-bottom)); gap: 28px; }
.bv-arte { display: grid; justify-items: center; gap: 6px; width: min(100%, 520px); }
.bv-emblema { width: min(78vw, 360px); height: auto; -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent 100%); mask-image: radial-gradient(closest-side, #000 72%, transparent 100%); animation: bv-aparecer 1s cubic-bezier(.2, .8, .2, 1) both; }
.bv-marca { width: min(92vw, 520px); height: auto;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent), linear-gradient(180deg, transparent, #000 16%, #000 84%, transparent);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent), linear-gradient(180deg, transparent, #000 16%, #000 84%, transparent); mask-composite: intersect; animation: bv-aparecer 1s .18s cubic-bezier(.2, .8, .2, 1) both; }
.bv-pie { display: grid; justify-items: center; gap: 14px; animation: bv-aparecer .9s .4s cubic-bezier(.2, .8, .2, 1) both; }
.bv-linea { width: 56px; height: 1px; background: linear-gradient(90deg, transparent, var(--oro-claro), transparent); }
.bv-app { margin: 0; font-size: .8rem; letter-spacing: .32em; text-transform: uppercase; color: color-mix(in srgb, var(--oro-claro) 80%, #fff); }
.bv-btn {
  min-width: 220px; min-height: 52px; padding: 0 34px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: .95rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #1a1308;
  border: 1px solid color-mix(in srgb, var(--oro-claro) 70%, #fff);
  background: linear-gradient(180deg, #ecd6a6 0%, #c9a466 55%, #a8834a 100%);
  box-shadow: 0 10px 30px -10px rgba(201, 164, 102, .55), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.bv-btn:hover { filter: brightness(1.05); box-shadow: 0 14px 36px -10px rgba(201, 164, 102, .7), inset 0 1px 0 rgba(255, 255, 255, .5); }
.bv-btn:active { transform: scale(.97); }
.bv-btn:focus-visible { outline: 2px solid var(--oro-claro); outline-offset: 4px; }
@keyframes bv-aparecer { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.bv-portada { display: none; }
/* Pantallas anchas (computadora, iPad horizontal): la portada completa al centro */
@media (min-width: 900px) and (min-aspect-ratio: 4/3) {
  .bv-arte { width: auto; }
  .bv-emblema, .bv-marca { display: none; }
  .bv-portada { display: block; width: min(88vw, calc((100vh - 220px) * 1.777)); height: auto; border-radius: 6px;
    -webkit-mask-image: radial-gradient(closest-side, #000 80%, transparent 100%); mask-image: radial-gradient(closest-side, #000 80%, transparent 100%);
    animation: bv-aparecer 1.1s cubic-bezier(.2, .8, .2, 1) both; }
}
@media (prefers-reduced-motion: reduce) { .bv-portada { animation: none; } }
@media (prefers-reduced-motion: reduce) {
  .bv-emblema, .bv-marca, .bv-pie { animation: none; }
  .bienvenida { transition: none; }
}

/* ---------- Inicio de sesión premium ---------- */
.auth.premium { position: relative; background: var(--negro); isolation: isolate; }
.auth.premium::before { content: ""; position: fixed; inset: -40px; z-index: -1; background: url(../img/portada.jpg) center / cover no-repeat; filter: blur(30px) brightness(.32); transform: scale(1.08); }
.auth.premium .auth-card { border: 1px solid color-mix(in srgb, var(--oro) 35%, transparent); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7); }
.auth-emblema { justify-self: center; width: 148px; height: auto; border-radius: 18px; background: var(--negro); box-shadow: 0 0 0 1px color-mix(in srgb, var(--oro) 50%, transparent), 0 12px 30px -12px rgba(0, 0, 0, .5); }
.auth-titulo { display: grid; gap: 4px; }
.auth-titulo span { font-size: .74rem; font-weight: 700; letter-spacing: .26em; text-transform: uppercase; color: var(--oro); }
.auth-titulo h1 { font-size: 1.45rem; }


/* ---------- Carátulas ---------- */
.car-hoja { position: relative; overflow: hidden; flex: none; box-sizing: border-box; color: #2a2326; }
.car-fondo { position: absolute; inset: 0; width: 100%; height: 100%; }
.car-velo, .car-marco { position: absolute; inset: 0; pointer-events: none; }
.car-capa { position: absolute; white-space: pre-wrap; overflow-wrap: anywhere; user-select: none; -webkit-user-select: none; }
.car-capa.imagen img { display: block; width: 100%; height: auto; }
.car-capa.imagen img.difuminada { -webkit-mask-image: radial-gradient(closest-side, #000 70%, transparent 100%); mask-image: radial-gradient(closest-side, #000 70%, transparent 100%); }
.car-hoja.interactiva .car-capa { cursor: grab; touch-action: none; }
.car-hoja.interactiva .car-capa:hover { outline: 1px dashed rgba(138, 28, 43, .45); outline-offset: 1mm; }
.car-hoja.interactiva .car-capa.sel { outline: 1.5px solid #c9a466; outline-offset: 1mm; }

.car-editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; max-width: 1400px; margin: 0 auto; padding: 16px 16px 60px; align-items: start; }
.car-lienzo { position: sticky; top: calc(70px + var(--safe-top)); display: grid; place-items: center; padding: 18px 12px; min-height: 340px; border-radius: 18px;
  background: repeating-conic-gradient(color-mix(in srgb, var(--surface-2) 80%, var(--bg)) 0 25%, var(--surface-2) 0 50%) 0 0 / 18px 18px; overflow: hidden; }
.car-lienzo .car-hoja { box-shadow: 0 2px 6px rgba(0, 0, 0, .12), 0 18px 40px -18px rgba(0, 0, 0, .45); }
.car-panel { display: grid; gap: 12px; }
.car-acciones { display: flex; gap: 8px; align-items: center; }
.car-nombre { font-weight: 700; font-size: 1.05rem; }
.car-sec { background: var(--surface); border-radius: 16px; padding: 4px 14px; box-shadow: var(--shadow); }
.car-sec > summary { cursor: pointer; list-style: none; padding: 12px 0; font-weight: 700; display: flex; justify-content: space-between; }
.car-sec > summary::-webkit-details-marker { display: none; }
.car-sec > summary::after { content: "+"; color: var(--muted); }
.car-sec[open] > summary::after { content: "–"; }
.car-sec[open] { padding-bottom: 14px; }
.car-sec > *:not(summary) + *:not(summary) { margin-top: 12px; }
.car-seg { width: 100%; }
.car-seg button { flex: 1; justify-content: center; }
.car-rango { display: grid; gap: 4px; }
.car-rango span { display: flex; align-items: center; gap: 10px; }
.car-rango input[type=range] { flex: 1; padding: 0; border: 0; box-shadow: none; accent-color: var(--accent); background: none; }
.car-rango output { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; font-size: .85rem; }
.car-color { display: grid; gap: 4px; }
.car-color input { height: 40px; padding: 3px; cursor: pointer; }
.car-estilos { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; }
.car-estilos .car-color input { width: 64px; }
.link-btn.izq { justify-self: start; padding-left: 0; }

.car-fondos { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.car-fondo-op { aspect-ratio: 3 / 4; border-radius: 10px; border: 2px solid var(--line); background-size: cover; background-position: center; cursor: pointer; position: relative; display: grid; place-items: end center; padding: 4px; color: var(--muted); font-size: .7rem; font-weight: 700; }
.car-fondo-op span { background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 1px 6px; border-radius: 6px; }
.car-fondo-op.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.car-fondo-op.subir { place-items: center; align-content: center; gap: 2px; background: var(--surface-2); border-style: dashed; }

.car-capas { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.car-capas li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; border-radius: 10px; border: 1px solid transparent; }
.car-capas li.on { border-color: var(--accent); background: var(--accent-soft); }
.car-capa-btn { display: flex; align-items: center; gap: 8px; min-width: 0; border: 0; background: none; font: inherit; color: var(--text); padding: 8px; cursor: pointer; text-align: left; }
.car-capa-btn b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); font-family: Georgia, serif; }
.car-capa-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car-capas .icon-btn:first-of-type svg { transform: rotate(90deg); }
.car-props { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; }

.car-galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.car-tarjeta { display: grid; gap: 8px; }
.car-mini { display: grid; place-items: center; aspect-ratio: 3 / 4; border-radius: 12px; background: var(--surface-2); overflow: hidden; box-shadow: var(--shadow); transition: transform .14s ease; }
.car-mini { position: relative; }
.car-mini img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0,0,0,.18)); }
.car-mini > svg { width: 40px; height: 40px; color: var(--muted); }
.car-tarjeta:hover .car-mini { transform: translateY(-2px); }
.car-info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car-info small { color: var(--muted); }

.car-plantillas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.car-plantilla { display: grid; gap: 6px; text-align: left; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); box-shadow: var(--shadow); }
.car-plantilla:hover { border-color: var(--accent); }
.car-plantilla small { color: var(--muted); }
.car-pmini { display: grid; place-items: center; height: 270px; border-radius: 10px; background: var(--surface-2); overflow: hidden; pointer-events: none; }
.car-pescala .car-hoja { box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .4); }

/* Vista previa antes de descargar */
.car-previa { display: grid; place-items: center; padding: 14px; border-radius: 14px; background: var(--surface-2); max-height: 58vh; }
.car-previa.png { background: repeating-conic-gradient(#e6e6ea 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.car-previa img { max-width: 100%; max-height: calc(58vh - 28px); object-fit: contain; box-shadow: 0 4px 18px rgba(0, 0, 0, .25); background: transparent; }
.car-previa-datos { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .88rem; color: var(--muted); }
.car-previa-datos b { color: var(--text); margin-right: 6px; }

/* Hoja con copias del lomo y línea de corte */
.board-head .car-nuevos .btn { width: auto !important; padding: 0 14px !important; border-radius: 11px !important; }
.board-head .car-nuevos .btn span { display: inline !important; }
.car-pliego { display: flex; justify-content: center; align-items: center; gap: 5mm; background: #fff; }
.car-corte { border: 0.3mm dashed #8a8a92; }

@media (max-width: 899px) {
  .car-editor { grid-template-columns: 1fr; padding-top: 10px; }
  .car-lienzo { position: relative; top: 0; min-height: 260px; }
  .car-fondos { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- Responsivo ---------- */
@media (max-width: 899px) {
  .tabbar { display: flex; }
  .top-title.con-modulos { flex: 1; max-width: none; text-align: center; }
  .pob-marco > .top { display: none; }
  .mod-top { display: none; }
  .top-title:empty { flex: 1; }
  .col-tabs { display: flex; }
  .board { grid-template-columns: 1fr; }
  .col { display: none; background: transparent; padding: 0; }
  .col.on { display: block; }
  .col-h { display: none; }
}
@media (max-width: 560px) {
  .brand-txt small { display: none; }
  .brand-txt b { font-size: .68rem; letter-spacing: .07em; }
  .brand-emblema { width: 40px; height: 31px; }
  .equipo li { grid-template-columns: auto 1fr; }
  .equipo-ctrl { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; align-items: center; gap: 12px; }
  .para-sel { grid-template-columns: 1fr; }
  .fila-edit { grid-template-columns: 28px 1fr 1fr 36px; gap: 6px; }
  .dgrid { columns: 1; }
  h1 { font-size: 1.4rem; }
  .board-head .btn span { display: none; }
  .board-head .btn { width: 46px; padding: 0; border-radius: 50%; }
  .chip-link span { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .persona { grid-template-columns: auto 1fr; }
  .persona > .btn { grid-column: 1 / -1; }
  .search { max-width: none; }
  .toolbar .seg { width: 100%; }
  .toolbar .seg button { flex: 1; justify-content: center; }
  .form-actions .btn { flex: 1; }
}

/* ---------- Documentos PDF (constancia de actividad y dato) ---------- */
/* Los estilos del documento sirven en pantalla (vista previa) y al imprimir */
.constancia { display: none; }
/* Sin margen de página, el navegador no tiene dónde imprimir la dirección y la fecha */

.constancia { padding: 0 16mm; color: #1d2230; font-size: 10pt; line-height: 1.4; text-align: left; --tinta: #1d2230; --suave: #5d6475; --linea: #c9ced8; --fondo: #f2f4f8; --acento: #8a1c2b; }
.constancia table { width: 100%; border-collapse: collapse; }
.constancia table.pagina > * > tr > td { border: 0; padding: 0; background: none; }
.constancia table.pagina > tbody > tr { break-inside: auto; }

/* Encabezado y pie que se repiten en cada hoja */
.constancia .corrido { display: flex; justify-content: space-between; gap: 16px; font-size: 8pt; color: var(--suave); }
.constancia .corrido.arriba { padding: 10mm 0 3mm; border-bottom: 1px solid var(--linea); margin-bottom: 5mm; }
.constancia .corrido.abajo { padding: 3mm 0 9mm; border-top: 1px solid var(--linea); margin-top: 5mm; }
.constancia .corrido b { color: var(--acento); text-transform: uppercase; letter-spacing: .04em; }
.constancia .corrido-tit { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.constancia .portada { display: flex; gap: 14px; align-items: center; margin-bottom: 5mm; break-inside: avoid; }
.constancia .folio-big { flex: none; display: grid; place-items: center; width: 24mm; height: 24mm; border-radius: 4mm; background: var(--acento); color: #fff; font-size: 7.5pt; text-transform: uppercase; letter-spacing: .06em; line-height: 1.1; text-align: center; }
.constancia .folio-big b { display: block; font-size: 17pt; letter-spacing: 0; }
.constancia .portada .sup { font-size: 8pt; text-transform: uppercase; letter-spacing: .08em; color: var(--suave); margin: 0; }
.constancia .portada h1 { font-size: 16pt; line-height: 1.2; margin: 1mm 0 2mm; color: var(--tinta); }
.constancia .chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; }
.constancia .chips span { font-size: 8pt; font-weight: 600; padding: 1mm 2.5mm; border-radius: 3mm; background: var(--fondo); border: 1px solid var(--linea); }

.constancia .resumen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3mm; margin-bottom: 6mm; break-inside: avoid; }
.constancia .resumen div { background: var(--fondo); border-radius: 3mm; padding: 3mm; }
.constancia .resumen b { display: block; font-size: 14pt; color: var(--tinta); }
.constancia .resumen small { display: block; font-size: 7.5pt; color: var(--suave); }

.constancia .sec { margin-bottom: 6mm; }
.constancia .sec.junta { break-inside: avoid; }
.constancia .sec h2 { display: flex; align-items: center; gap: 2.5mm; font-size: 11pt; margin: 0 0 2.5mm; color: var(--tinta); break-after: avoid; }
.constancia .sec h2 span { display: inline-grid; place-items: center; width: 5.5mm; height: 5.5mm; border-radius: 50%; background: var(--acento); color: #fff; font-size: 8pt; }
.constancia .sec h2 + * { break-before: avoid; }

.constancia th, .constancia td { border: 1px solid var(--linea); padding: 1.6mm 2.2mm; text-align: left; vertical-align: top; }
.constancia .grid thead { display: table-header-group; }
.constancia thead th { background: var(--fondo); font-size: 8.5pt; color: var(--suave); text-transform: uppercase; letter-spacing: .03em; }
.constancia .kv th { width: 26%; background: var(--fondo); font-weight: 600; }
.constancia tr { break-inside: avoid; }
.constancia small { display: inline; color: var(--suave); }
.constancia i { color: var(--suave); }
.constancia .pasos-t td:first-child, .constancia .pasos-t th:first-child { width: 8mm; text-align: center; }
.constancia .pasos-t td:last-child { width: 34%; }
.constancia .bitacora-t, .constancia .avisos-t { font-size: 8.8pt; }
.constancia .bitacora-t td { padding: 1.1mm 2mm; }
.constancia .bitacora-t td:first-child { width: 1%; white-space: nowrap; }
.constancia .bitacora-t td:nth-child(2) { width: 27%; }
.constancia .avisos-t td:first-child { width: 30%; }
.constancia .avisos-t td:not(:first-child) { white-space: nowrap; }
.constancia .avisos-t td:last-child { white-space: normal; }

.constancia .caja { border: 1px solid var(--linea); border-left: 3px solid var(--acento); border-radius: 2mm; padding: 3mm; background: #fff; }
.constancia .caja p { margin: 2mm 0 0; }
.constancia .nota-bit { font-size: 7.5pt; color: var(--suave); margin: 1.5mm 0 0; }
.constancia .pie-caja { font-size: 8pt; color: var(--suave); margin: 1.5mm 0 0; }

.constancia .cierre { break-inside: avoid; padding-top: 14mm; }
.constancia .salto-hoja { break-before: page; }
.constancia .firmas { display: grid; grid-template-columns: 1fr 1fr; gap: 20mm; margin: 0 8mm 5mm; text-align: center; }
.constancia .firmas .firma-rol { margin: 0 0 18mm; font-size: 8pt; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--suave); }
.constancia .firmas .linea { display: block; border-top: 1px solid var(--tinta); margin: 0 6mm 2mm; }
.constancia .firmas b { display: block; min-height: 1.4em; }
.constancia .firmas small { display: block; }
.constancia .leyenda { font-size: 7.5pt; color: var(--suave); text-align: center; margin: 0; break-before: avoid; }

/* Documento de un dato general */
.constancia .doc-folio { gap: 1mm; align-content: center; }
.constancia .doc-folio svg { width: 6mm; height: 6mm; stroke: #fff; }
.constancia .doc-texto { font-size: 10.5pt; line-height: 1.55; }
.constancia .doc-ficha th { width: 32%; }
.constancia .doc-ficha td { font-size: 11pt; font-weight: 600; }
.constancia .doc-lista { margin: 0; padding-left: 7mm; display: grid; gap: 1.6mm; font-size: 10.5pt; }
.constancia .doc-lista li { break-inside: avoid; padding-left: 1mm; }
.constancia .doc-tabla { font-size: 9pt; }
.constancia .doc-tabla td, .constancia .doc-tabla th { padding: 1.3mm 2mm; }
.constancia .doc-tabla .n { width: 8mm; text-align: center; color: var(--suave); }
.constancia .doc-tabla tbody tr:nth-child(even) td { background: #fafbfd; }
.constancia .doc-fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
.constancia .doc-fotos.grandes { grid-template-columns: repeat(2, 1fr); }
.constancia .doc-fotos figure { margin: 0; break-inside: avoid; display: grid; gap: 1.5mm; }
.constancia .doc-fotos img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--fondo); border: 1px solid var(--linea); border-radius: 2mm; }
.constancia .doc-fotos.grandes img { aspect-ratio: 4 / 3.2; }
.constancia .doc-fotos figcaption { font-size: 8.5pt; color: var(--suave); }
.constancia .doc-fotos figcaption b { color: var(--tinta); }
.constancia .doc-leyenda { margin-top: 6mm; }

/* Pantalla de vista previa */
.pdf-barra { position: sticky; top: calc(57px + var(--safe-top)); z-index: 15; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.pdf-opciones { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.pdf-zona { padding: 20px 12px 16px; background: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); min-height: 60vh; overflow-x: hidden; }
.pdf-ayuda { padding: 0 16px 40px; }

/* Copia para generar el archivo PDF */
.pdf-oculto { position: fixed; left: -12000px; top: 0; }
.constancia.para-archivo { box-shadow: none; border-radius: 0; margin: 0; }
.constancia.para-archivo table.pagina > thead, .constancia.para-archivo table.pagina > tfoot { display: none; }
.constancia.para-archivo .doc-fotos figure { justify-items: center; }
.constancia.para-archivo .doc-fotos img { aspect-ratio: auto; width: auto; height: auto; max-width: 100%; max-height: 95mm; }
.constancia.para-archivo .doc-fotos:not(.grandes) img { max-height: 60mm; }
.constancia.para-archivo .doc-fotos figcaption { justify-self: stretch; }
.pdf-botones { display: flex; gap: 8px; }

/* Vista previa en pantalla: una hoja tamaño carta */
.constancia.en-pantalla { display: block; width: 216mm; margin: 0 auto; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 18px 40px -20px rgba(0,0,0,.4); border-radius: 4px; }
.constancia.en-pantalla.horizontal { width: 279mm; }

@media print {
  @page { size: letter; margin: 0; }
  :root { color-scheme: light; }
  html, body { background: #fff !important; }
  body { color: #1d2230; font-size: 10pt; line-height: 1.4; padding: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #app > *:not(.constancia):not(.pdf-zona):not(.pob-marco), .pob-marco > .top, .pob-marco > .demo-bar, .modal, .toast, .tabbar, iframe, body > :not(#app) { display: none !important; }
  .pdf-zona { display: block !important; padding: 0 !important; background: none !important; }
  .constancia { display: block !important; }
  .constancia.en-pantalla { width: auto !important; box-shadow: none !important; border-radius: 0; zoom: 1 !important; margin: 0; }
}
