/* Web app de PortaDocumentos (/app/).
   Marca: tinta #101a2b · humo #5b6b86 · papel #f4f6f9. Los tres colores del
   logo son ESTADOS (vencido / por vencer / vigente): se usan en el resumen de
   Inicio y en las insignias, nunca en botones ni acentos. La acción va en tinta
   (mismo lenguaje que el sitio). El estado se dice siempre con glifo + palabra
   + color, no solo con color. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #edf0f5;
  --text: #101a2b;
  --muted: #5b6b86;
  --border: #e1e6ee;
  --line: #9aa6ba;
  --accent: #101a2b;
  --on-accent: #ffffff;
  --accent-tint: rgba(16, 26, 43, 0.08);
  --side-bg: #101a2b;

  --bad: #e0453c;   --bad-solid: #c4372f;   --bad-fg: #b3261e;  --bad-bg: rgba(224, 69, 60, 0.12);
  --warn: #f2a93b;  --warn-fg: #8a5200; --warn-bg: rgba(242, 169, 59, 0.2);
  --ok: #16a97a;    --ok-solid: #0e7a57;    --ok-fg: #0b7355;   --ok-bg: rgba(22, 169, 122, 0.14);
  --none-fg: #5b6b86; --none-bg: rgba(91, 107, 134, 0.14);

  --radius: 24px;
  --radius-sm: 14px;
  --shadow: none;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --wordmark: Archivo, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --side-w: 248px;
  --tab-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #131c2e;
    --surface-2: #1a2540;
    --text: #f2f5fa;
    --muted: #8fa0be;
    --border: #243350;
    --line: #4a5b7c;
    --accent: #f2f5fa;
    --on-accent: #0b1220;
    --accent-tint: rgba(242, 245, 250, 0.12);
    --side-bg: #0a101c;
    --bad-fg: #ff8a82;  --bad-bg: rgba(224, 69, 60, 0.2);
    --warn-fg: #ffc46b; --warn-bg: rgba(242, 169, 59, 0.2);
    --ok-fg: #4fd6a8;   --ok-bg: rgba(22, 169, 122, 0.2);
    --none-fg: #8fa0be; --none-bg: rgba(143, 160, 190, 0.16);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--text); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.center { text-align: center; }
.pre { white-space: pre-wrap; }
.row { display: flex; align-items: center; }
.row--end { justify-content: flex-end; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
.boot__label { color: var(--muted); }

/* ── Pantalla de carga ──
   Las tres formas de la marca entran una tras otra y después "respiran" mientras
   se abre la sesión. Con movimiento reducido queda la marca quieta (ver el final). */
.splash { display: flex; flex-direction: column; align-items: center; gap: 22px; animation: splash-in 0.35s ease-out both; }
.splash .wordmark { font-size: 1.45rem; }
.splash__mark { overflow: visible; }
.splash__a, .splash__b, .splash__c { transform-box: fill-box; transform-origin: center; opacity: 0; animation: splash-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.25) forwards, splash-breathe 2.4s ease-in-out 1.1s infinite; }
.splash__b { animation-delay: 0.12s, 1.25s; }
.splash__c { animation-delay: 0.24s, 1.4s; }
.splash__bar { position: relative; width: 120px; height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; }
.splash__bar::after { content: ""; position: absolute; inset: 0; width: 45%; border-radius: 3px; background: var(--accent); animation: splash-slide 1.2s ease-in-out infinite; }
@keyframes splash-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes splash-pop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@keyframes splash-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes splash-slide { from { transform: translateX(-100%); } to { transform: translateX(240%); } }

.ic { width: 1.25em; height: 1.25em; flex: none; }

/* ── Marca ── */
.wordmark { font-family: var(--wordmark); letter-spacing: -0.03em; white-space: nowrap; line-height: 1.1; font-size: 1.15rem; }
.wordmark__a { font-weight: 400; color: var(--muted); }
.wordmark__b { font-weight: 800; color: var(--text); }
.brand-mark { height: 28px; width: auto; }

/* ── Shell ── */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.side {
  position: sticky; top: 0; height: 100vh; padding: 24px 16px; display: flex; flex-direction: column; gap: 28px;
  background: var(--side-bg); color: #fff;
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; text-decoration: none; }
.side .wordmark__a { color: #c9d1dd; }
.side .wordmark__b { color: #fff; }
.side__nav { display: flex; flex-direction: column; gap: 4px; }
.side__foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; font-size: 0.85rem; color: #c9d1dd; }
.side__user { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.side__plan { background: #1d2a42; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.side__plan:empty { display: none; }
.side__plan-name { font-size: 0.82rem; font-weight: 600; color: #c9d1dd; }
.side__plan-count { font-size: 1.1rem; font-weight: 800; color: #fff; margin-bottom: 8px; }
.side__plan-bar { height: 6px; border-radius: 3px; background: #2a3a55; overflow: hidden; }
.side__plan-bar > span { display: block; height: 100%; background: #f2a93b; border-radius: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm);
  color: #c9d1dd; text-decoration: none; font-weight: 600;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-link.is-active { background: #fff; color: #101a2b; }

.main { padding: 40px clamp(16px, 4vw, 48px) 64px; max-width: 1240px; width: 100%; outline: none; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { display: block; }
  .side { display: none; }
  .main { padding: 18px 16px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 500; min-width: 0;
  }
  .tab .ic { width: 24px; height: 24px; }
  .tab.is-active { color: var(--text); font-weight: 700; }
}

/* ── Encabezado de página ── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: clamp(1.9rem, 4.5vw, 2.5rem); font-weight: 900; letter-spacing: -0.04em; line-height: 1.05; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 6px; color: var(--muted); text-decoration: none; font-weight: 500; background: none; border: 0; padding: 0; cursor: pointer; }
.back:hover { color: var(--text); }
.h3 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.025em; }
.h4 { font-size: 0.95rem; font-weight: 600; margin-top: 4px; }

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text);
  font-weight: 700; cursor: pointer; text-decoration: none; transition: background 0.12s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn--danger { background: var(--bad-fg); border-color: var(--bad-fg); color: #fff; }
.btn--danger:hover { background: var(--bad-fg); filter: brightness(1.08); }
.btn--danger-ghost { color: var(--bad-fg); }
.btn--small { min-height: 38px; padding: 0 16px; font-size: 0.9rem; }
.btn--block { width: 100%; }
.is-busy { cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link { background: none; border: 0; padding: 0; color: var(--text); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { text-decoration-thickness: 2px; }
.link[disabled] { color: var(--muted); cursor: default; text-decoration: none; }
.links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ── Tarjetas, listas ── */
.card { background: var(--surface); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.card--link { text-decoration: none; color: inherit; transition: background 0.12s; }
.card--link:hover { background: var(--surface-2); }
.card__head, .section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section { margin: 28px 0; display: flex; flex-direction: column; gap: 14px; }
.list { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.row-item {
  display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px 22px; background: transparent; border: 0;
  border-bottom: 1px solid var(--border); text-align: left; text-decoration: none; color: inherit; cursor: pointer;
}
.row-item:last-child { border-bottom: 0; }
a.row-item:hover, button.row-item:hover { background: var(--surface-2); }
.row-item--static { cursor: default; }
.row-item--tall { align-items: flex-start; }
.row-item__lead { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--muted); flex: none; }
.row-item__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.row-item__title { font-weight: 600; overflow-wrap: anywhere; }
.row-item__sub { color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.row-item__end { flex: none; }
.s-bg-expired { background: var(--bad-bg); color: var(--bad-fg); }
.s-bg-critical, .s-bg-soon { background: var(--warn-bg); color: var(--warn-fg); }
.s-bg-ok { background: var(--ok-bg); color: var(--ok-fg); }
.s-bg-unknown, .s-bg-missing { background: var(--none-bg); color: var(--none-fg); }

@media (max-width: 560px) {
  .row-item { flex-wrap: wrap; }
  .row-item__end { margin-left: 52px; }
}

/* ── Estado: insignias y barra de cobertura ── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; line-height: 1.3; }
.badge .ic { width: 1.05em; height: 1.05em; }
.b-expired { background: var(--bad-bg); color: var(--bad-fg); }
.b-critical, .b-soon { background: var(--warn-bg); color: var(--warn-fg); }
.b-ok { background: var(--ok-bg); color: var(--ok-fg); }
.b-unknown, .b-missing { background: var(--none-bg); color: var(--none-fg); }
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.8rem; font-weight: 600; }

.cov { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.cov__seg { height: 8px; border-radius: 4px; background: var(--none-bg); }
.c-expired { background: var(--bad); }
.c-critical, .c-soon { background: var(--warn); }
.c-ok { background: var(--ok); }
.c-unknown { background: var(--muted); opacity: 0.5; }
/* El que falta, en línea discontinua: se distingue sin depender del color. */
.c-missing { background: transparent; border: 2px dashed var(--muted); height: 8px; opacity: 0.6; }

/* ── Vehículo ── */
.vcard { gap: 14px; }
.vcard__top { display: flex; align-items: center; gap: 12px; }
.vcard__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-tint); color: var(--accent); flex: none; }
.vcard__icon .ic { width: 26px; height: 26px; }
.vcard__id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.vcard__name { font-size: 1.05rem; overflow-wrap: anywhere; }
.vcard__foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.summary { gap: 14px; }
.summary__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.odo { flex-direction: row; align-items: center; justify-content: space-between; }
.odo__val { display: block; font-size: 1.4rem; font-family: var(--mono); font-weight: 500; }

/* ── Inicio ── */
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.cols > * { min-width: 0; }
.cols .section:first-child { margin-top: 0; }
@media (max-width: 1100px) { .cols { grid-template-columns: minmax(0, 1fr); gap: 0; } }
/* El resumen toma el color del PEOR estado: rojo, ámbar, verde o tinta si faltan datos. */
.hero { gap: 24px; padding: 32px 36px; border-radius: 32px; background: var(--text); color: var(--bg); flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.hero--expired { background: var(--bad-solid); color: #fff; }
.hero--soon { background: var(--warn); color: #101a2b; }
.hero--ok { background: var(--ok-solid); color: #fff; }
.hero__text { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 260px; }
.hero__kicker { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.2); font-size: 0.85rem; font-weight: 700; }
.hero--soon .hero__kicker { background: rgba(16, 26, 43, 0.12); }
.hero__title { font-size: clamp(1.8rem, 4vw, 2.75rem); font-weight: 900; letter-spacing: -0.04em; line-height: 1.02; }
.hero__sub { font-size: 1.05rem; opacity: 0.9; }
.hero .stats { flex: none; }
@media (max-width: 560px) {
  .hero { padding: 24px 20px; gap: 20px; border-radius: 28px; }
  .hero .stats { width: 100%; gap: 8px; }
  .stat { min-width: 0; padding: 12px; border-radius: 16px; font-size: 0.9rem; }
  .stat__n { font-size: 2rem; }
}
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border-radius: 20px; padding: 16px 20px; display: flex; flex-direction: column; min-width: 104px; }
.hero .stat { background: rgba(255, 255, 255, 0.16); }
.hero--soon .stat { background: rgba(16, 26, 43, 0.1); }
.hero .stat .muted { color: inherit; opacity: 0.85; font-weight: 600; }
.stat__n { font-size: 2.4rem; font-weight: 900; letter-spacing: -0.04em; line-height: 1; }
.shortcuts { display: grid; grid-template-columns: 1fr; gap: 10px; }
.shortcut {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border: 0; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 700; text-decoration: none; cursor: pointer; text-align: left;
}
.shortcut:hover { background: var(--surface-2); }
.shortcut .ic { width: 24px; height: 24px; }
.invites { gap: 12px; padding: 16px 20px; }
.invite-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.invite-row__main { display: flex; flex-direction: column; flex: 1; min-width: 200px; }
.note { gap: 4px; }

/* ── Documentos ── */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.search { position: relative; flex: 1; min-width: 220px; display: block; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 40px; }
.empty-note { padding: 24px 0; text-align: center; }
.fold > summary { cursor: pointer; padding: 6px 0; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold[open] > summary { margin-bottom: 10px; }
.docview { display: flex; flex-direction: column; gap: 16px; }
.docview__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 18px; margin: 0; }
.facts dt { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.facts__wide { grid-column: 1 / -1; }
.preview { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); min-height: 120px; display: grid; place-items: center; overflow: hidden; padding: 6px; }
.preview__img { max-height: 70vh; object-fit: contain; border-radius: 8px; }
.preview__pdf { width: 100%; height: 70vh; border: 0; background: #fff; }

/* Lista y panel lateral: en pantallas anchas la ficha se abre al lado, sin tapar la lista. */
.split { display: block; }
.docpanel { display: none; }
@media (min-width: 1100px) {
  .split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr); gap: 20px; align-items: start; }
  .docpanel {
    display: flex; flex-direction: column; gap: 14px; position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto;
    background: var(--surface); border-radius: var(--radius); padding: 24px;
  }
  .docpanel__title { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.035em; line-height: 1.05; }
  .docpanel__empty { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 48px 12px; color: var(--muted); }
  .docpanel__empty .ic { width: 40px; height: 40px; }
  .docpanel .preview__img { max-height: 46vh; }
  .docpanel .preview__pdf { height: 46vh; }
  .row-item.is-selected { background: var(--accent-tint); }
}

/* ── Formularios ── */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field--inline { max-width: 340px; margin-bottom: 16px; }
.field__label { font-weight: 600; font-size: 0.9rem; }
.field__label em { font-style: normal; font-weight: 400; color: var(--muted); }
.field__hint { font-size: 0.85rem; color: var(--muted); }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; background: var(--surface); color: var(--text);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); font: inherit; appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
textarea.input { resize: vertical; min-height: 84px; }
.input:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.input--code { font-family: var(--mono); font-size: 1.6rem; letter-spacing: 0.4em; text-align: center; }
.captcha:empty { display: none; }
.captcha { display: flex; justify-content: center; }
.form-error { color: var(--bad-fg); font-weight: 600; font-size: 0.92rem; }
.notice { background: var(--warn-bg); color: var(--text); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.92rem; }
.form-actions { margin-top: 4px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.seg { display: inline-flex; padding: 4px; background: var(--surface-2); border-radius: 999px; gap: 2px; align-self: flex-start; }
.seg__opt { position: relative; cursor: pointer; }
.seg__opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg__opt span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: 999px; font-weight: 700; color: var(--muted); min-height: 40px; }
.seg__opt input:checked + span { background: var(--accent); color: var(--on-accent); }
.seg__opt input:focus-visible + span { outline: 3px solid var(--accent); }
.seg--tight .seg__opt span { padding: 6px 12px; min-height: 36px; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.drop { display: block; position: relative; border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: 18px; cursor: pointer; text-align: center; color: var(--muted); font-weight: 600; }
.drop:hover, .drop:focus-within { border-color: var(--accent); color: var(--text); }
.drop__input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop__body { display: inline-flex; align-items: center; gap: 10px; overflow-wrap: anywhere; }
.progress { width: 100%; height: 8px; accent-color: var(--accent); }
.switch { display: flex; align-items: center; gap: 14px; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track { width: 48px; height: 28px; border-radius: 999px; background: var(--border); position: relative; flex: none; transition: background 0.15s; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.switch input:checked + .switch__track { background: var(--ok-solid); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch__text { display: flex; flex-direction: column; }

/* ── Hoja modal ── */
.sheet { border: 0; padding: 0; background: transparent; color: inherit; max-width: none; max-height: none; width: 100%; height: 100%; }
.sheet::backdrop { background: rgba(8, 14, 26, 0.55); }
.sheet[open] { display: grid; place-items: center; padding: 16px; }
.sheet__panel {
  width: min(560px, 100%); max-height: min(92vh, 900px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); overflow: hidden;
}
.sheet--wide .sheet__panel { width: min(760px, 100%); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 10px 22px; border-bottom: 1px solid var(--border); }
.sheet__title { font-size: 1.3rem; font-weight: 900; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.sheet__body { padding: 20px 22px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 560px) {
  .sheet[open] { padding: 0; place-items: end center; }
  .sheet__panel { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ── Gente / avatar ── */
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); font-weight: 700; flex: none; }
.avatar--lg { width: 56px; height: 56px; font-size: 1.4rem; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.people__row { display: flex; align-items: center; gap: 12px; }
.people__main { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.invite { border-top: 1px solid var(--border); padding-top: 16px; }
.account { flex-direction: row; align-items: center; gap: 16px; }
.account__main { display: flex; flex-direction: column; min-width: 0; }
.account__name { font-size: 1.15rem; overflow-wrap: anywhere; }

/* ── Estados vacíos ── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 48px 16px; max-width: 460px; margin: 0 auto; }
.empty__icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); }
.empty__icon .ic { width: 34px; height: 34px; }
.empty__title { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }

/* ── Gráfico de gasto ── */
.chart { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 190px; }
.chart__col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.chart__val { font-size: 0.7rem; color: var(--muted); font-family: var(--mono); height: 16px; white-space: nowrap; }
.chart__track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1.5px solid var(--border); }
.chart__bar { width: 100%; max-width: 90px; background: var(--text); border-radius: 12px 12px 0 0; min-height: 4px; }
.chart__lbl { font-size: 0.8rem; color: var(--muted); text-transform: capitalize; }

/* ── Mostrar documentos ──
   Pantalla oscura: es lo que se ve en un control, de noche o al sol. Las insignias
   pasan a píldoras claras para que el estado se lea sobre tinta. */
.is-present .main { background: var(--side-bg); color: #fff; }
.is-present .page-title { color: #fff; }
.is-present .muted { color: #c9d1dd; }
.is-present .main .back, .is-present .main a:not(.btn):not(.chip) { color: #fff; }
.is-present .chip { background: #1d2a42; border-color: #2a3a55; color: #fff; }
.is-present .chip.is-active { background: #fff; border-color: #fff; color: #101a2b; }
.is-present .stage { background: transparent; border: 0; padding: 0; }
.is-present .stage:fullscreen { background: var(--side-bg); padding: 24px; }
.is-present .stage .btn { background: transparent; border-color: #fff; color: #fff; }
.is-present .stage .btn:hover { background: #fff; color: #101a2b; }
.is-present .plate { font-size: clamp(2rem, 6vw, 3.5rem); padding: 4px 28px; border: 2px solid #fff; border-radius: 12px; color: #fff; }
.is-present .badge .ic { color: inherit; }
.is-present .b-expired { background: #fbe3e1; color: #b3261e; }
.is-present .b-critical, .is-present .b-soon { background: #fdefd2; color: #7a4b00; }
.is-present .b-ok { background: #ddf3ea; color: #0e5a41; }
.is-present .b-unknown, .is-present .b-missing { background: #e5e9f0; color: #5b6b86; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.tile {
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start; text-align: left; min-height: 190px; padding: 20px;
  background: #1d2a42; border: 2px solid transparent; border-radius: 28px; color: #fff; cursor: pointer; font: inherit;
}
.tile:hover { background: #26365a; }
.tile.is-active { border-color: #fff; }
.tile.is-missing { cursor: default; border: 2px dashed #2a3a55; background: transparent; color: #c9d1dd; }
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .tile { min-height: 150px; padding: 14px; border-radius: 22px; } }
.tile__code { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: #2a3a55; font-weight: 600; }
.tile__name { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; line-height: 1.15; }
.tile__foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.tile__sub { font-size: 0.85rem; color: #c9d1dd; }
.is-present .stage__title { color: #fff; }
.is-present .stage__file { background: #1d2a42; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text); font-family: var(--mono); font-weight: 500; }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.stage { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.stage:fullscreen { border-radius: 0; padding: 24px; overflow: auto; }
.stage__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stage__id { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.plate { font-size: 1.6rem; font-weight: 500; letter-spacing: 0.08em; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.strip__item {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 14px; border: 2px solid var(--border);
  background: var(--surface); font-family: var(--mono); font-weight: 500; cursor: pointer; flex: none; min-height: 44px; color: var(--text);
}
.strip__item.is-active { border-color: var(--accent); background: var(--accent-tint); }
.strip__item.s-expired .ic { color: var(--bad-fg); }
.strip__item.s-critical .ic, .strip__item.s-soon .ic { color: var(--warn-fg); }
.strip__item.s-ok .ic { color: var(--ok-fg); }
.strip__item.is-missing { border-style: dashed; color: var(--muted); cursor: default; opacity: 0.8; }
.stage__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stage__title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.stage__file { display: grid; place-items: center; min-height: 200px; background: var(--surface-2); border-radius: var(--radius); padding: 6px; margin-top: 12px; }
.stage__file img { max-height: 72vh; object-fit: contain; border-radius: 8px; }
.stage__file iframe { width: 100%; height: 72vh; border: 0; background: #fff; border-radius: 8px; }
.stage:fullscreen .stage__file img, .stage:fullscreen .stage__file iframe { max-height: 78vh; height: 78vh; }
.stage__nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ── Entrada ── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth__side { background: var(--side-bg); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; }
.auth__brand-lg { display: flex; align-items: center; gap: 12px; }
.auth__side .wordmark { font-size: 1.5rem; }
.auth__side .wordmark__a { color: #c9d1dd; }
.auth__side .wordmark__b { color: #fff; }
.auth__pitch { font-size: clamp(2.2rem, 4vw, 3.6rem); font-weight: 900; letter-spacing: -0.045em; line-height: 0.98; max-width: 520px; }
.auth__lead { margin-top: 20px; font-size: 1.1rem; line-height: 1.5; color: #c9d1dd; max-width: 440px; }
.auth__squares { display: flex; gap: 10px; }
.auth__squares span { width: 56px; height: 56px; border-radius: 16px; }
.auth__main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 48px 24px; }
.auth__card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth__brand { display: none; align-items: center; gap: 10px; }
.auth__title { font-size: 2rem; font-weight: 900; letter-spacing: -0.04em; }
.auth__legal, .auth__apps { font-size: 0.85rem; text-align: center; max-width: 420px; }
@media (max-width: 860px) {
  .auth { display: flex; flex-direction: column; justify-content: center; }
  .auth__side { display: none; }
  .auth__brand { display: flex; }
  .auth__card { background: var(--surface); border-radius: 24px; padding: 28px 24px; }
}

/* ── Avisos ── */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
@media (min-width: 861px) { .toasts { bottom: 24px; } }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }
.toast.t-error { background: var(--bad-fg); color: #fff; }
.toast.t-ok { background: var(--ok-fg); color: #fff; }
@media (prefers-color-scheme: dark) { .toast.t-ok { color: #06281d; } .toast.t-error { color: #2a0a07; } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .splash__a, .splash__b, .splash__c { opacity: 1; }
}
