/* =========================================================================
   Luvio · "Tinta azul"  (ver DESIGN.md)
   ========================================================================= */

@font-face {
  font-family: "Onest Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/static/fonts/onest.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Onest Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/static/fonts/onest-ext.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage Grotesque Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/static/fonts/bricolage.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/static/fonts/bricolage-ext.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --surface-3: #e3e9f3;
  --line: #e1e7f0;
  --line-strong: #cbd5e4;
  --ink: #0a1122;
  --ink-2: #26324b;
  --muted: #56627a;
  --faint: #67748b;
  --brand: #1e5eff;
  --brand-hover: #1650e6;
  --btn: #1e5eff;
  --btn-hover: #1650e6;
  --brand-ink: #ffffff;
  --brand-soft: #e7eeff;
  --brand-soft-ink: #1446c8;
  --night: #071334;
  --night-2: #0d2466;
  --ok: #0b8a60;
  --ok-soft: #e2f6ee;
  --warn: #8f5400;
  --warn-soft: #fff3da;
  --bad: #c42131;
  --bad-soft: #fdebed;
  --gold: #f5b938;
  --shadow-sm: 0 1px 2px rgba(10, 17, 34, .06);
  --shadow: 0 1px 2px rgba(10, 17, 34, .04), 0 8px 20px -8px rgba(10, 17, 34, .12);
  --shadow-lg: 0 20px 44px -16px rgba(12, 36, 110, .45);
  --ring: 0 0 0 4px rgba(30, 94, 255, .18);
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font: "Onest Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Bricolage Grotesque Variable", "Onest Variable", ui-sans-serif, system-ui, sans-serif;
  --tabbar-h: 66px;
  --sidebar-w: 248px;
  font-family: var(--font);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070b14;
    --surface: #0e1524;
    --surface-2: #131c2e;
    --surface-3: #1b263a;
    --line: #1e2940;
    --line-strong: #2d3b58;
    --ink: #e9eef8;
    --ink-2: #c3cde0;
    --muted: #97a3bb;
    --faint: #75829c;
    --brand: #4d7dff;
    --brand-hover: #6890ff;
    --btn: #3366ff;
    --btn-hover: #2b5cf0;
    --brand-soft: #142450;
    --brand-soft-ink: #b3c8ff;
    --ok: #34d399;
    --ok-soft: #0c2a22;
    --warn: #fbbf24;
    --warn-soft: #2b2110;
    --bad: #f87171;
    --bad-soft: #2d1418;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 24px -10px rgba(0, 0, 0, .6);
    --shadow-lg: 0 22px 48px -18px rgba(0, 0, 0, .8);
    --ring: 0 0 0 4px rgba(77, 125, 255, .3);
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 90px; }
body { margin: 0; background: var(--bg); line-height: 1.5; min-height: 100dvh; font-size: 15px; }
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
a { color: var(--brand); text-underline-offset: 3px; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; color: var(--ink); text-wrap: balance; }
h1 { font-family: var(--font-display); font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -.005em; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: .85em; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.icon { flex: none; display: block; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; padding: 10px 16px;
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none;
  background: var(--btn); color: var(--brand-ink); min-height: 44px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 6px 14px -6px color-mix(in srgb, var(--btn) 70%, transparent);
  transition: transform .15s var(--ease), background .15s ease, box-shadow .15s ease, opacity .15s ease;
  -webkit-user-select: none; user-select: none; white-space: nowrap;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .icon { width: 18px; height: 18px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.soft { background: var(--brand-soft); color: var(--brand-soft-ink); box-shadow: none; }
.btn.soft:hover { background: color-mix(in srgb, var(--brand-soft) 82%, var(--brand) 18%); }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.ok { background: #087a55; color: #fff; box-shadow: 0 6px 14px -6px rgba(8, 122, 85, .7); }
.btn.ok:hover { background: #066a4a; }
.btn.white { background: #fff; color: #0a1122; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .45); }
.btn.white:hover { background: #eef3ff; }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); box-shadow: none; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.big { font-size: 1rem; padding: 13px 22px; min-height: 52px; border-radius: 14px; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: transparent; border: 0; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--ink-2); }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 12px; padding: 11px 14px; background: var(--surface); min-height: 46px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { min-height: 100px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input[type=file] { font: inherit; font-size: .9rem; max-width: 100%; }
.field { margin-bottom: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--brand); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.inline { display: flex; gap: 10px; align-items: center; }

.switch { position: relative; width: 50px; height: 30px; flex: none; display: inline-block; margin: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 99px; transition: background .2s ease; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

.alert { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: .92rem; font-weight: 500; animation: rise .3s var(--ease); }
.alert .icon { width: 18px; height: 18px; margin-top: 1px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--brand-soft); color: var(--brand-soft-ink); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel-head .spacer { flex: 1; }
.tile { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-soft-ink); flex: none; }
.tile .icon { width: 19px; height: 19px; }
.tile.ok { background: var(--ok-soft); color: var(--ok); }
.tile.gold { background: color-mix(in srgb, var(--gold) 20%, transparent); color: color-mix(in srgb, var(--gold) 55%, var(--ink)); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.brand { background: var(--brand-soft); color: var(--brand-soft-ink); border-color: transparent; }
.badge.gold { background: color-mix(in srgb, var(--gold) 22%, transparent); color: color-mix(in srgb, var(--gold) 45%, var(--ink)); border-color: transparent; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; color: var(--muted); font-weight: 600; }
td { font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* =========================================================================
   Estructura de la app
   ========================================================================= */
.app-shell { min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s ease;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  display: flex; align-items: center; gap: 12px; min-height: 56px;
}
.topbar.scrolled { border-bottom-color: var(--line); }
/* Logo: símbolo a color + letras como máscara (toman el color del texto, sirven en claro y oscuro). */
.brand-mark { display: flex; align-items: center; gap: 9px; width: fit-content; color: var(--ink); text-decoration: none; }
.brand-symbol { width: auto; height: 32px; flex: none; }
.brand-word { position: relative; flex: none; height: 21px; aspect-ratio: 780 / 259; }
.brand-word::before, .brand-word::after { content: ""; position: absolute; }
.brand-word::before { inset: 0; background: currentColor; -webkit-mask: var(--word) center / contain no-repeat; mask: var(--word) center / contain no-repeat; }
.brand-word::after { left: 67.12%; top: .4%; width: 9.1%; aspect-ratio: 1; border-radius: 50%; background: #006afa; }
.topbar .biz { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .88rem; font-weight: 500; min-width: 0; text-decoration: none; }
.topbar .biz span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.biz-logo { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); flex: none; }
.main { padding: 4px 16px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); max-width: 1120px; margin: 0 auto; view-transition-name: main; }
.demo-bar { display: flex; gap: 8px; align-items: center; background: var(--warn-soft); color: var(--warn); font-size: .82rem; padding: 9px 12px; border-radius: 12px; margin: 4px 0 14px; font-weight: 500; }
.demo-bar .icon { width: 16px; height: 16px; }
.demo-bar a { color: inherit; font-weight: 650; margin-left: auto; white-space: nowrap; }

/* Barra inferior (celular) */
.tabbar {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
  height: var(--tabbar-h); padding: 0 6px;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 14px 34px -14px rgba(10, 17, 34, .35);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 54px; border-radius: 16px; color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 600; }
.tab .icon { width: 23px; height: 23px; position: relative; z-index: 1; transition: transform .2s var(--ease); }
.tab span { position: relative; z-index: 1; }
.tab.active { color: var(--brand-soft-ink); }
.tab .tab-pill { display: none; }
.tab.active .tab-pill { display: block; position: absolute; inset: 0 4px; border-radius: 16px; background: var(--brand-soft); view-transition-name: tab-pill; }
.tab:active .icon { transform: scale(.88); }
.tab-scan .scan-fab {
  width: 54px; height: 54px; border-radius: 18px; background: var(--btn); color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--brand) 85%, transparent), 0 0 0 4px var(--bg);
  transform: translateY(-16px); transition: transform .2s var(--ease);
}
.tab-scan .scan-fab .icon { width: 26px; height: 26px; }
.tab-scan .label { margin-top: -14px; }
.tab-scan:active .scan-fab { transform: translateY(-16px) scale(.92); }
.tab-scan.active { color: var(--brand); }
.tab-scan.active .tab-pill { display: none; }

/* Barra lateral (computadora) */
.sidebar { display: none; }
@media (min-width: 1024px) {
  .app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .tabbar, .mobile-only { display: none !important; }
  .topbar { grid-column: 2; padding: 14px 32px; }
  .main { grid-column: 2; padding: 4px 32px 56px; width: 100%; }
  .sidebar {
    display: flex; flex-direction: column; gap: 3px; grid-row: 1 / span 2; grid-column: 1;
    position: sticky; top: 0; height: 100dvh; padding: 20px 14px;
    background-color: var(--night); color: #c9d4ee;
    background-image: radial-gradient(circle at 20% -10%, rgba(77, 125, 255, .32), transparent 55%), radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1.2px);
    background-size: auto, 14px 14px;
  }
  .sidebar .brand-mark { color: #fff; padding: 4px 10px 18px; }
  .side-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: #a9b6d6; text-decoration: none; font-weight: 550; font-size: .92rem; transition: background .15s ease, color .15s ease; }
  .side-link .icon { width: 19px; height: 19px; }
  .side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
  .side-link.active { color: #fff; }
  .side-link .side-pill { display: none; }
  .side-link.active .side-pill { display: block; position: absolute; inset: 0; border-radius: 12px; background: rgba(77, 125, 255, .24); box-shadow: inset 0 0 0 1px rgba(122, 160, 255, .35); view-transition-name: side-pill; }
  .side-link > :not(.side-pill) { position: relative; }
  .side-scan { margin: 8px 0 14px; }
  .side-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 10px 8px; }
  .side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .05); }
  .side-foot .who { min-width: 0; flex: 1; }
  .side-foot strong { display: block; color: #fff; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-foot small { color: #8d9ac0; font-size: .75rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-foot .icon-btn { color: #8d9ac0; }
  .side-foot .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .topbar .brand-mark { display: none; }
}

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); max-width: 62ch; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.two-col > * { min-width: 0; }
@media (max-width: 1180px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.sticky { position: sticky; top: 84px; }
@media (max-width: 1180px) { .sticky { position: static; } }
.narrow { max-width: 760px; }

/* ---------- Transiciones entre pantallas ---------- */
@view-transition { navigation: auto; }
::view-transition-old(main) { animation: vt-out .14s ease both; }
::view-transition-new(main) { animation: vt-in .3s var(--ease) both; }
::view-transition-group(tab-pill), ::view-transition-group(side-pill) { animation-duration: .38s; animation-timing-function: var(--ease); }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* =========================================================================
   Inicio
   ========================================================================= */
.pass {
  position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 22px 22px 20px; margin-bottom: 16px;
  background: radial-gradient(circle at 85% -10%, rgba(91, 140, 255, .55), transparent 55%), linear-gradient(150deg, var(--night) 0%, var(--night-2) 60%, #1e5eff 140%);
  box-shadow: var(--shadow-lg);
  /* Muescas laterales, como una tarjeta de sellos troquelada */
  -webkit-mask: radial-gradient(circle 11px at 0 64%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 11px at 100% 64%, #0000 98%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 11px at 0 64%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 11px at 100% 64%, #0000 98%, #000) right / 51% 100% no-repeat;
}
.pass::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1.2px); background-size: 16px 16px; -webkit-mask: linear-gradient(180deg, #000, transparent 85%); mask: linear-gradient(180deg, #000, transparent 85%); }
.pass > * { position: relative; }
.pass h1 { color: #fff; font-size: 1.75rem; margin: 0 0 4px; }
.pass p { color: #c3d2f5; margin: 0; }
.pass-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 22px; padding-top: 16px; border-top: 1px dashed rgba(255, 255, 255, .24); }
.pass-today { display: flex; gap: 28px; }
.pass-today div { display: flex; flex-direction: column; }
.pass-today b { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.2; }
.pass-today small { color: #a9bce8; font-size: .78rem; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 16px; }
.metric { padding: 14px 16px; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; }
.metric .label { font-size: .78rem; color: var(--muted); font-weight: 550; }
.metric .value { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.3; }
.metric small { font-size: .76rem; color: var(--faint); }
@media (max-width: 640px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
}

.chart { position: relative; padding-top: 8px; }
.chart-max { position: absolute; left: 0; right: 0; top: 8px; border-top: 1px dashed var(--line); font-size: .72rem; color: var(--faint); }
.chart-max span { position: relative; top: -0.85em; background: var(--surface); padding-right: 6px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; border-bottom: 1px solid var(--line-strong); }
.bars .col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; outline: none; }
.bars .bar { width: 100%; max-width: 22px; background: color-mix(in srgb, var(--brand) 45%, var(--surface)); border-radius: 5px 5px 0 0; transform-origin: bottom; animation: grow .6s var(--ease) both; animation-delay: calc(var(--i) * 25ms); transition: background .15s ease; }
.bars .col.today .bar { background: var(--brand); }
.bars .col:hover .bar, .bars .col:focus .bar { background: var(--brand-hover); }
.bars .col .tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: .75rem; padding: 4px 8px; border-radius: 8px; white-space: nowrap; z-index: 2; font-weight: 600; }
.bars .col:hover .tip, .bars .col:focus .tip { display: block; }
@keyframes grow { from { transform: scaleY(0); } }
.bars-labels { display: flex; gap: 3px; font-size: .7rem; color: var(--faint); margin-top: 6px; }
.bars-labels span { flex: 1; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.steps-list { list-style: none; padding: 0; margin: 0; }
.steps-list li a { display: flex; gap: 12px; align-items: center; padding: 9px 0; color: var(--ink); text-decoration: none; font-weight: 550; font-size: .9rem; }
.steps-list .dot { width: 26px; height: 26px; border-radius: 50%; border: 1.5px dashed var(--line-strong); flex: none; display: grid; place-items: center; color: #fff; }
.steps-list .dot .icon { width: 14px; height: 14px; }
.steps-list .done .dot { background: var(--ok); border: 0; }
.steps-list .done a { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.steps-list li:not(.done) a:hover { color: var(--brand); }
.progress-line { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 2px 0 10px; }
.progress-line span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .6s var(--ease); }

.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .9rem; animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.feed li:last-child { border-bottom: 0; }
.feed .body { flex: 1; min-width: 0; color: var(--ink-2); }
.feed a { font-weight: 600; color: var(--ink); text-decoration: none; }
.feed a:hover { color: var(--brand); }
.feed time { color: var(--faint); font-size: .78rem; white-space: nowrap; }

.avatar { position: relative; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-weight: 650; font-size: .85rem; flex: none; color: hsl(var(--h) 50% 30%); background: hsl(var(--h) 65% 92%); }
@media (prefers-color-scheme: dark) { .avatar { color: hsl(var(--h) 70% 82%); background: hsl(var(--h) 30% 20%); } }
.avatar .ev { position: absolute; right: -5px; bottom: -5px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--brand); box-shadow: 0 0 0 2px var(--surface), var(--shadow-sm); }
.avatar .ev .icon { width: 12px; height: 12px; }
.avatar .ev.gold { color: color-mix(in srgb, var(--gold) 60%, var(--ink)); }
.avatar .ev.ok { color: var(--ok); }
.avatar.lg { width: 60px; height: 60px; border-radius: 19px; font-size: 1.15rem; }

/* =========================================================================
   Listas tipo app
   ========================================================================= */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 8px; margin: 0 -8px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); border-radius: 12px; transition: background .15s ease; animation: rise .4s var(--ease) both; animation-delay: calc(min(var(--i, 0), 12) * 22ms); }
.list-item:hover { background: var(--surface-2); }
.list > .list-item:last-child { border-bottom: 0; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { display: flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { font-size: .8rem; color: var(--muted); }
.list-item .chev { color: var(--faint); }
.mini-stamps { display: flex; gap: 3px; margin-top: 6px; flex-wrap: wrap; max-width: 220px; }
.mini-stamps i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); }
.mini-stamps i.on { background: var(--brand); }
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 0 14px; padding: 2px; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: .85rem; font-weight: 550; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.filter b { font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.filter:hover { border-color: var(--line-strong); }
.filter.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filter.active b { color: inherit; opacity: .7; }
.searchbar { position: relative; margin-bottom: 12px; }
.searchbar .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.searchbar input { padding-left: 44px; border-radius: 14px; }
.menu-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; background: none; width: 100%; font: inherit; font-weight: 600; cursor: pointer; text-align: left; transition: background .15s ease; }
.menu-item:hover { background: var(--surface-2); }
.menu-item:last-child { border-bottom: 0; }
.menu-item .body { flex: 1; min-width: 0; }
.menu-item small { display: block; font-weight: 400; font-size: .82rem; }
.menu-item .chev { color: var(--faint); }
.menu-label { font-size: .82rem; color: var(--muted); font-weight: 600; margin: 18px 4px 8px; }

.empty { text-align: center; color: var(--muted); padding: 30px 16px; }
.empty .art { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-soft-ink); }
.empty .art .icon { width: 28px; height: 28px; }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 1rem; }

/* =========================================================================
   Escáner
   ========================================================================= */
.scan-wrap { max-width: 520px; margin: 0 auto; }
.scanner { position: relative; border-radius: 26px; overflow: hidden; background: #050913; aspect-ratio: 1; box-shadow: var(--shadow-lg); }
#reader { position: absolute; inset: 0; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
#reader #qr-shaded-region { display: none !important; }
.reader-idle { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; color: #a9b8dc; padding: 24px; background: radial-gradient(circle at 50% 40%, rgba(30, 94, 255, .28), transparent 62%); }
.reader-idle > .icon { width: 44px; height: 44px; color: #fff; }
.scanner.live .reader-idle { display: none; }
.frame { position: absolute; inset: 17%; pointer-events: none; transition: inset .35s var(--ease); }
.frame i { position: absolute; width: 36px; height: 36px; border: 3px solid #fff; transition: border-color .2s ease; }
.frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 16px 0 0 0; }
.frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 16px 0 0; }
.frame i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 16px; }
.frame i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 16px 0; }
.frame .beam { position: absolute; left: 8%; right: 8%; height: 2px; top: 4%; background: linear-gradient(90deg, transparent, #8fb0ff, transparent); box-shadow: 0 0 14px 2px rgba(122, 162, 255, .55); opacity: 0; }
.scanner.live .frame .beam { opacity: 1; animation: beam 2.4s ease-in-out infinite; }
.scanner.found .frame { inset: 21%; }
.scanner.found .frame i { border-color: #4ade80; }
@keyframes beam { 0%, 100% { top: 4%; } 50% { top: 94%; } }
.manual { display: flex; gap: 8px; margin-top: 14px; }
.camera-msg { color: var(--muted); font-size: .88rem; text-align: center; margin: 10px 0 0; min-height: 1.3em; }

.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow-lg); padding: 22px 18px 16px; text-align: center; animation: sheet-in .45s var(--ease) both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(36px) scale(.98); } }
.sheet .who { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.scan-name { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.stamp-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin: 18px auto 10px; max-width: 340px; }
.stamp { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 2px dashed var(--line-strong); color: var(--faint); }
.stamp svg { width: 22px; height: 22px; }
.stamp.on { border: 0; background: var(--stamp-bg, var(--brand)); color: var(--stamp-ink, #fff); box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--stamp-bg, var(--brand)) 75%, transparent); }
.stamp.reward { border-color: var(--stamp-bg, var(--brand)); color: var(--stamp-bg, var(--brand)); }
.stamp.press { animation: press .55s var(--ease) both; }
.stamp.press::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--stamp-bg, var(--brand)); animation: ink .6s var(--ease) .12s both; }
@keyframes press { 0% { transform: scale(1.7) rotate(-14deg); opacity: 0; } 55% { transform: scale(.9) rotate(3deg); opacity: 1; } 100% { transform: none; } }
@keyframes ink { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
.stamp-row.complete .stamp { animation: wave .6s var(--ease) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes wave { 40% { transform: translateY(-8px) scale(1.06); } }
.progress-text { color: var(--muted); font-size: .92rem; margin: 0 0 16px; }
.progress-text b { color: var(--ink); }
.reward-banner { display: flex; align-items: center; gap: 12px; text-align: left; background: color-mix(in srgb, var(--gold) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); border-radius: 16px; padding: 12px 14px; margin: 0 0 16px; animation: rise .4s var(--ease); }
.reward-banner .tile { background: var(--gold); color: #3a2600; }
.reward-banner strong { display: block; color: var(--ink); }
.reward-banner small { color: var(--muted); }
.sheet .primary-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.sheet .secondary-actions { display: flex; justify-content: center; gap: 4px; margin-top: 12px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; width: max-content; bottom: calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); opacity: 0; display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: .92rem; transition: opacity .2s ease, transform .3s var(--ease); z-index: 60; max-width: calc(100% - 32px); pointer-events: none; box-shadow: var(--shadow-lg); }
.toast .icon { width: 18px; height: 18px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
@media (min-width: 1024px) { .toast { bottom: 28px; left: calc(50% + var(--sidebar-w) / 2); } }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -14px; width: 8px; height: 13px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), 108vh, 0) rotate(var(--r)); } }

/* =========================================================================
   Tarjeta (vista previa Google / Apple)
   ========================================================================= */
.wcard { --card-bg: #1f2937; --card-ink: #fff; background: var(--card-bg); color: var(--card-ink); border-radius: 22px; overflow: hidden; box-shadow: 0 24px 50px -22px rgba(7, 19, 52, .55); width: 100%; max-width: 360px; margin: 0 auto; transition: background .3s ease, color .3s ease; }
.wcard-body { padding: 18px 18px 14px; }
.wcard-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.wcard-logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: rgba(255, 255, 255, .2); flex: none; }
.wcard-issuer { font-size: .95rem; font-weight: 550; opacity: .95; }
.wcard-title { font-size: 1.3rem; font-weight: 550; margin-bottom: 16px; }
.wcard-fields { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.wcard-fields small { color: inherit; opacity: .72; font-size: .74rem; display: block; }
.wcard-fields b { font-size: 1.05rem; font-weight: 550; font-variant-numeric: tabular-nums; }
.wcard-fields div:last-child { text-align: right; }
.wcard-qr { background: #fff; border-radius: 14px; width: 150px; margin: 4px auto 12px; padding: 10px 10px 6px; text-align: center; color: #111; }
.wcard-qr svg { display: block; width: 100%; height: auto; }
.wcard-qr small { color: #444; font-size: .78rem; letter-spacing: .05em; }
.wcard-hero svg, .wcard-hero img { display: block; width: 100%; height: auto; }

.acard { --card-bg: #1f2937; --card-ink: #fff; --card-label: #f59e0b; background: var(--card-bg); color: var(--card-ink); border-radius: 16px; overflow: hidden; box-shadow: 0 24px 50px -22px rgba(7, 19, 52, .55); max-width: 340px; margin: 0 auto; transition: background .3s ease; }
.acard-top { display: flex; align-items: center; gap: 8px; padding: 12px 14px; }
.acard-top img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.acard-top .name { font-weight: 550; font-size: .95rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard-top .hdr { text-align: right; }
.acard small { display: block; color: var(--card-label); font-size: .62rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.acard b { font-weight: 500; font-size: 1.05rem; }
.acard-strip svg { display: block; width: 100%; height: auto; }
.acard-fields { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px 0; }
.acard-fields .r { text-align: right; }
.acard-qr { background: #fff; border-radius: 10px; width: 120px; margin: 14px auto 16px; padding: 8px; }
.acard-qr svg { display: block; width: 100%; height: auto; }

.wallet-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: #000; color: #fff; border-radius: 14px; padding: 12px 22px; font-weight: 600; text-decoration: none; min-height: 52px; min-width: 260px; border: 1px solid #2a2a2a; transition: transform .15s var(--ease); }
.wallet-btn:active { transform: scale(.98); }
.wallet-btn .icon { width: 22px; height: 22px; }
.wallet-buttons { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* =========================================================================
   Diseñador de tarjeta
   ========================================================================= */
.designer { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.designer > * { min-width: 0; }
.designer .preview-col { position: sticky; top: 84px; }
@media (max-width: 1180px) {
  .designer { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .designer .preview-col { order: -1; position: static; }
}
.design-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 14px; position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 6; box-shadow: 0 8px 18px -12px rgba(10, 17, 34, .3); }
@media (min-width: 1024px) { .design-tabs { top: 72px; } }
.design-tabs::-webkit-scrollbar { display: none; }
.design-tabs button { position: relative; flex: 1 0 auto; border: 0; background: none; font: inherit; font-weight: 600; font-size: .88rem; color: var(--muted); padding: 8px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; transition: color .15s ease, background .2s ease, box-shadow .2s ease; display: flex; align-items: center; justify-content: center; gap: 7px; }
.design-tabs button .icon { width: 16px; height: 16px; }
.design-tabs button:hover { color: var(--ink); }
.design-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.design-section { display: none; margin: 0 0 16px; }
.design-section.active { display: block; animation: rise .25s var(--ease); }
.group + .group { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.group-head h3 { margin: 0; }
.group-head .current { font-size: .82rem; color: var(--muted); font-weight: 500; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme-card { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); padding: 0; cursor: pointer; font: inherit; text-align: left; color: var(--ink); transition: transform .2s var(--ease), box-shadow .2s ease, border-color .15s ease; }
.theme-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.theme-card .art { display: block; aspect-ratio: 516 / 168; overflow: hidden; }
.theme-card .art svg { display: block; width: 100%; height: 100%; }
.theme-card .name { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; font-weight: 600; font-size: .82rem; }
.theme-card .tick { display: none; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; place-items: center; }
.theme-card .tick .icon { width: 12px; height: 12px; }
.theme-card.active { border-color: var(--brand); box-shadow: var(--ring); }
.theme-card.active .tick { display: grid; }

.choice-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.choice { position: relative; margin: 0; font-weight: inherit; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .face { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: .78rem; font-weight: 600; color: var(--ink-2); background: var(--surface); text-align: center; min-height: 44px; transition: border-color .15s ease, background .15s ease, transform .15s var(--ease); }
.choice .face:hover { border-color: var(--line-strong); }
.choice:active .face { transform: scale(.95); }
.choice input:checked + .face { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-soft-ink); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input:focus-visible + .face { box-shadow: var(--ring); }
.choice .thumb-slot { display: block; width: 40px; height: 40px; }
.choice .thumb-slot svg { width: 40px; height: 40px; display: block; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.segmented .face { flex-direction: row; min-height: 42px; font-size: .85rem; }
.segmented .face .icon { width: 16px; height: 16px; }
.icon-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.icon-grid .face { aspect-ratio: 1; padding: 0; min-height: 0; }
.icon-grid .face svg { width: 21px; height: 21px; }
.icon-grid .face img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.pattern-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.pattern-grid .face { padding: 0; overflow: hidden; gap: 0; }
.pattern-grid .face .sw { display: block; width: 100%; height: auto; aspect-ratio: 8 / 3; }
.pattern-grid .face .sw svg { width: 100%; height: 100%; display: block; }
.pattern-grid .face .lbl { padding: 6px 4px; }

.color-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.color-pick { position: relative; display: inline-flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 5px 12px 5px 5px; font-weight: 600; font-size: .85rem; cursor: pointer; margin: 0; color: var(--ink-2); }
.color-pick input[type=color] { width: 34px; height: 34px; border-radius: 9px; border: 0; padding: 0; background: none; cursor: pointer; }
.color-pick input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color-pick input[type=color]::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, .12); border-radius: 9px; }
.color-pick input[type=color]::-moz-color-swatch { border: 1px solid rgba(0, 0, 0, .12); border-radius: 9px; }
.color-pick code { background: none; border: 0; padding: 0; color: var(--muted); font-size: .78rem; }
.swatches { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); cursor: pointer; padding: 0; transition: transform .15s var(--ease), box-shadow .15s ease; }
.swatch:hover { transform: scale(1.12); }
.swatch.on { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14), 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
input[type=range] { width: 100%; accent-color: var(--brand); }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { font-weight: 650; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.upload-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upload-row .thumb { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.preview-box { position: relative; border-radius: 26px; padding: 16px 16px 18px; background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--brand) 16%, var(--surface)), var(--surface-2) 70%); border: 1px solid var(--line); }
.preview-toggle { display: flex; background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin: 0 auto 14px; max-width: 240px; }
.preview-toggle button { flex: 1; border: 0; background: none; font: inherit; font-weight: 600; font-size: .84rem; padding: 7px; border-radius: 9px; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: background .2s ease, color .2s ease; }
.preview-toggle button.active { background: var(--ink); color: var(--bg); }
.preview-toggle .icon { width: 15px; height: 15px; }
.preview-stage { perspective: 1200px; }
.preview-stage > div:not([hidden]) { animation: flip-in .45s var(--ease); }
@keyframes flip-in { from { opacity: 0; transform: rotateY(-14deg) translateY(6px); } }
.preview-stamps { margin-top: 14px; display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--muted); }
.preview-stamps input { flex: 1; }
.preview-stamps output { font-weight: 650; color: var(--ink); min-width: 18px; text-align: right; }
@media (max-width: 1180px) {
  /* En el celular la vista previa va arriba y compacta, para que las opciones queden a la mano. */
  .preview-box { padding: 10px 10px 12px; border-radius: 22px; }
  .preview-toggle { margin-bottom: 10px; }
  .preview-box .wcard, .preview-box .acard { max-width: 300px; }
  .preview-box .wcard-qr, .preview-box .acard-qr, .preview-box .wcard-fields, .preview-box .acard-fields { display: none; }
  .preview-box .wcard-body { padding: 14px 16px 10px; }
  .preview-box .wcard-top { margin-bottom: 8px; }
  .preview-box .wcard-title { margin-bottom: 6px; font-size: 1.1rem; }
  .preview-stamps { margin-top: 10px; }
}
.save-bar { position: sticky; bottom: 0; padding: 14px 0 6px; z-index: 5; background: linear-gradient(transparent, var(--bg) 35%); }
@media (max-width: 1023px) { .save-bar { bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom)); } }

/* =========================================================================
   Mensajes
   ========================================================================= */
.segments { display: grid; gap: 8px; }
.segment { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 11px 12px; cursor: pointer; font-weight: 550; margin: 0; color: var(--ink); background: var(--surface); transition: border-color .15s ease, background .15s ease; }
.segment input { accent-color: var(--brand); width: 18px; height: 18px; flex: none; margin: 0; }
.segment .grow { flex: 1; }
.segment:hover { border-color: var(--line-strong); }
.segment:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font: inherit; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); border-radius: 999px; padding: 4px 10px; cursor: pointer; transition: background .15s ease; }
.chip:hover { background: var(--brand-soft); color: var(--brand-soft-ink); border-color: transparent; }
.lockscreen { position: relative; border-radius: 34px; padding: 26px 14px 34px; overflow: hidden; color: #fff; background: radial-gradient(circle at 30% 10%, rgba(120, 160, 255, .55), transparent 50%), radial-gradient(circle at 90% 90%, rgba(30, 94, 255, .7), transparent 55%), linear-gradient(160deg, #0b1636, #071334); box-shadow: var(--shadow-lg); border: 6px solid #0b0f1a; max-width: 340px; margin: 0 auto; }
.lockscreen .clock { text-align: center; font-family: var(--font-display); font-size: 3.4rem; font-weight: 600; letter-spacing: -.03em; line-height: 1; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.lockscreen .date { text-align: center; font-size: .85rem; opacity: .8; margin-bottom: 28px; }
.notif { background: rgba(255, 255, 255, .92); color: #0a1122; border-radius: 18px; padding: 12px 14px; font-size: .9rem; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); animation: notif-in .5s var(--ease); }
@keyframes notif-in { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
.notif .app { font-size: .74rem; color: #56627a; display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.notif .app .icon { width: 15px; height: 15px; }
.notif .app time { margin-left: auto; }
.notif strong { display: block; }
.notif .txt { color: #3c4760; }
.history-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: 0; }
.history-item .body { flex: 1; min-width: 0; }
.history-item p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.history-item .stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* Automatizaciones */
.auto { padding: 0; overflow: hidden; }
.auto-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.auto-head .body { flex: 1; min-width: 0; }
.auto-head h2 { margin: 0 0 2px; }
.auto-head p { margin: 0; color: var(--muted); font-size: .88rem; }
.auto-body { padding: 0 18px 18px 70px; display: grid; gap: 12px; transition: opacity .2s ease; }
.auto.off .auto-body { opacity: .45; }
.auto.off .tile { filter: grayscale(1); opacity: .7; }
@media (max-width: 640px) { .auto-body { padding-left: 18px; } }
.auto-body .field { margin: 0; }
.auto-body textarea { min-height: 76px; }
.inline-num { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .92rem; color: var(--ink-2); font-weight: 500; margin: 0; }
.inline-num input { width: 84px; text-align: center; }

/* =========================================================================
   Entrada / registro
   ========================================================================= */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; background: var(--bg); }
.auth-art { position: relative; overflow: hidden; color: #fff; padding: calc(28px + env(safe-area-inset-top)) 24px 76px; background: radial-gradient(circle at 80% 0%, rgba(91, 140, 255, .6), transparent 55%), linear-gradient(160deg, var(--night) 0%, var(--night-2) 65%, #1e5eff 150%); }
.auth-art::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1.2px); background-size: 18px 18px; -webkit-mask: linear-gradient(180deg, #000 30%, transparent); mask: linear-gradient(180deg, #000 30%, transparent); }
.auth-art > * { position: relative; }
.auth-art .brand-mark { color: #fff; }
.auth-art h1 { color: #fff; font-size: 2rem; margin: 26px 0 8px; max-width: 16ch; }
.auth-art p { color: #c3d2f5; margin: 0; max-width: 40ch; }
.float-card { display: none; }
.auth-card { background: var(--surface); border-radius: 24px; margin: -48px 16px 20px; padding: 24px 20px; box-shadow: var(--shadow-lg); position: relative; z-index: 1; border: 1px solid var(--line); }
.auth-card h2 { font-size: 1.3rem; font-family: var(--font-display); font-weight: 700; }
.auth-foot { text-align: center; color: var(--muted); padding-bottom: calc(24px + env(safe-area-inset-bottom)); font-size: .92rem; }
@media (min-width: 960px) {
  .auth { grid-template-columns: 1.1fr 1fr; }
  .auth-art { display: flex; flex-direction: column; padding: 40px 56px; }
  .auth-art h1 { font-size: 2.8rem; margin-top: 0; }
  .float-card { display: block; position: relative; margin: auto 0; max-width: 360px; animation: float 7s ease-in-out infinite; transform: rotate(-4deg); }
  .float-card .wcard { margin: 0; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .8); }
  .auth-side { display: flex; flex-direction: column; justify-content: center; padding: 40px; }
  .auth-card { margin: 0 auto; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
  .auth-foot { padding-top: 16px; }
}
@keyframes float { 50% { transform: rotate(-2deg) translateY(-12px); } }

/* =========================================================================
   Páginas públicas (cliente final) y landing
   ========================================================================= */
.public-wrap { max-width: 480px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 16px 48px; }
.brand-head { text-align: center; margin-bottom: 20px; }
.brand-head img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; box-shadow: var(--shadow); }
.brand-head h1 { margin-bottom: 4px; }
.messages-list { list-style: none; padding: 0; margin: 0; }
.messages-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.messages-list li:last-child { border-bottom: 0; }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.contact-list .icon { width: 18px; height: 18px; color: var(--muted); }

.landing-top { display: flex; align-items: center; gap: 10px; max-width: 1120px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 20px 14px; }
.landing-top .spacer { flex: 1; }
.landing { max-width: 1120px; margin: 0 auto; padding: 0 20px 64px; }
.landing section { margin: 56px 0; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; padding: 40px 0; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding-top: 12px; gap: 36px; } }
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.4rem); letter-spacing: -.03em; line-height: 1.05; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p { font-size: 1.1rem; color: var(--ink-2); max-width: 46ch; }
.hero .float-card { display: block; max-width: 360px; margin: 0 auto; animation: float 7s ease-in-out infinite; transform: rotate(-3deg); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.feature { padding: 22px; box-shadow: 1px 1px 0 var(--line); }
.feature .tile { margin-bottom: 12px; }
.feature p { color: var(--muted); margin: 0; font-size: .92rem; }
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.steps div::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1.5px dashed var(--brand); color: var(--brand); font-weight: 700; margin-bottom: 10px; }
.steps p { color: var(--muted); }
.cta-band { border-radius: 24px; padding: 40px 28px; text-align: center; color: #fff; background: radial-gradient(circle at 80% 0%, rgba(91, 140, 255, .55), transparent 55%), linear-gradient(150deg, var(--night), var(--night-2) 60%, #1e5eff 150%); }
.cta-band h2 { color: #fff; font-family: var(--font-display); font-size: 1.8rem; }
.cta-band p { color: #c3d2f5; }

/* Cartel imprimible */
.poster { background: #fff; color: #0a1122; max-width: 600px; margin: 0 auto; padding: 44px 36px; text-align: center; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.poster h1 { font-size: 2.2rem; color: #0a1122; }
.poster .qr { width: 300px; max-width: 100%; margin: 24px auto; padding: 14px; border-radius: 20px; border: 2px dashed #cbd5e4; }
.poster .qr svg { width: 100%; height: auto; display: block; }
@media print {
  .topbar, .tabbar, .sidebar, .no-print, .demo-bar { display: none !important; }
  .app-shell { display: block; }
  body { background: #fff; }
  .main { padding: 0; }
  .poster { border: 0; box-shadow: none; }
}

/* Movimiento reducido: sin desplazamientos; se conservan los cambios de color y opacidad. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
