/* =====================================================================
   NexCard — sistema visual (Fase 1)
   Paleta oficial: #0866FF · #00D5FF · #07152E · #FFFFFF · #F3F6FB
   ===================================================================== */

:root {
  --electric: #0866FF;
  --cyan: #00D5FF;
  --navy: #07152E;
  --navy-2: #0C2147;
  --white: #FFFFFF;
  --mist: #F3F6FB;

  --bg: var(--mist);
  --surface: #FFFFFF;
  --surface-2: #F7F9FD;
  --text: #07152E;
  --text-2: #4A5A75;
  --text-3: #7D8AA3;
  --line: #E1E7F2;
  --focus: #0866FF;

  --ok: #0E9F6E;      --ok-bg: #E3F7EF;
  --info: #0866FF;    --info-bg: #E6F0FF;
  --warn: #B45309;    --warn-bg: #FFF4DE;
  --danger: #D92D45;  --danger-bg: #FDE8EC;
  --muted-bg: #EEF1F6;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --shadow-1: 0 1px 2px rgba(7, 21, 46, .06), 0 2px 8px rgba(7, 21, 46, .04);
  --shadow-2: 0 10px 30px rgba(7, 21, 46, .12);

  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;

  --sidebar-w: 260px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
  :root:not([data-theme="light"]) {
    --bg: #050E20; --surface: #0B1A33; --surface-2: #0F2140; --text: #EAF1FF; --text-2: #A9B8D4;
    --text-3: #7486A8; --line: #1B2E52; --focus: #00D5FF;
    --ok-bg: rgba(14,159,110,.16); --info-bg: rgba(8,102,255,.18); --warn-bg: rgba(180,83,9,.2);
    --danger-bg: rgba(217,45,69,.18); --muted-bg: #13264A; --ok: #34D399; --info: #5CA0FF; --warn: #FBBF24; --danger: #FB7185;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 12px 36px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050E20; --surface: #0B1A33; --surface-2: #0F2140; --text: #EAF1FF; --text-2: #A9B8D4;
  --text-3: #7486A8; --line: #1B2E52; --focus: #00D5FF;
  --ok-bg: rgba(14,159,110,.16); --info-bg: rgba(8,102,255,.18); --warn-bg: rgba(180,83,9,.2);
  --danger-bg: rgba(217,45,69,.18); --muted-bg: #13264A; --ok: #34D399; --info: #5CA0FF; --warn: #FBBF24; --danger: #FB7185;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 12px 36px rgba(0,0,0,.45);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--electric); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
small, .small { font-size: .85rem; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "Cascadia Code", monospace; font-size: .85em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------ Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.1rem; border-radius: var(--r-md);
  border: 1px solid transparent; font: 600 .95rem/1 var(--font-body);
  cursor: pointer; text-decoration: none !important; transition: background .15s, border-color .15s, transform .1s;
  background: var(--surface-2); color: var(--text); border-color: var(--line);
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--primary { background: var(--electric); border-color: var(--electric); color: #fff; }
.btn--primary:hover { background: #0558D9; }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.btn--ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.btn--sm { min-height: 36px; padding: .45rem .8rem; font-size: .85rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading::after {
  content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------ Formularios */
.form-grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label, .label { font-weight: 600; font-size: .88rem; color: var(--text); }
.field .hint { font-size: .8rem; color: var(--text-3); margin: 0; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: .65rem .85rem; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 400 1rem/1.4 var(--font-body); transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 110px; resize: vertical; }
.input:focus { outline: none; border-color: var(--electric); box-shadow: 0 0 0 3px rgba(8, 102, 255, .18); }
.has-error .input { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .82rem; margin: 0; }
.input-group { position: relative; }
.input-group .input { padding-right: 3rem; }
.input-group .toggle-pass {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: 0; background: none; color: var(--text-3); cursor: pointer; border-radius: var(--r-sm);
}
.check { display: flex; align-items: flex-start; gap: .6rem; font-size: .92rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--electric); margin-top: 1px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { text-align: center; padding: .6rem .5rem; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--text-2); }
.segmented input:checked + label { background: var(--surface); color: var(--electric); box-shadow: var(--shadow-1); }
.segmented input:focus-visible + label { outline: 3px solid var(--focus); }

/* ------------------------------------------------ Avisos */
.flash-stack { display: grid; gap: .6rem; margin-bottom: 1.2rem; }
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--r-md); font-size: .93rem; }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert--success { background: var(--ok-bg); color: var(--ok); }
.alert--error { background: var(--danger-bg); color: var(--danger); }
.alert--info { background: var(--info-bg); color: var(--info); }
.alert--warn { background: var(--warn-bg); color: var(--warn); }
.alert p { margin: 0; color: var(--text); }
.alert .alert-close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 0 .2rem; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 99px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--muted { background: var(--muted-bg); color: var(--text-2); }
.tag { display: inline-block; padding: .15rem .5rem; border-radius: 6px; background: var(--muted-bg); color: var(--text-2); font-size: .78rem; font-weight: 600; }

/* ------------------------------------------------ Tarjetas de contenido */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.25rem; }
.panel + .panel { margin-top: 1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.panel--flush { padding: 0; overflow: hidden; }
.panel--flush .panel-head { padding: 1.1rem 1.25rem 0; }
.danger-zone { border-color: var(--danger-bg); }
.danger-zone h2 { color: var(--danger); }
.grid { display: grid; gap: 1rem; }
@media (min-width: 900px) { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .25rem 0 0; color: var(--text-2); }
.crumb { font-size: .85rem; color: var(--text-3); margin-bottom: .35rem; display: inline-block; }

/* ------------------------------------------------ KPIs */
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1rem; }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem 1.1rem; position: relative; overflow: hidden; }
.kpi-label { font-size: .82rem; color: var(--text-2); font-weight: 600; }
.kpi-value { font: 700 1.65rem/1.15 var(--font-display); margin: .35rem 0 .15rem; letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi-foot { font-size: .8rem; color: var(--text-3); }
.kpi--hero { background: var(--navy); border-color: var(--navy); color: #fff; grid-column: span 2; }
.kpi--hero .kpi-label, .kpi--hero .kpi-foot { color: #9FB6DD; }
.kpi--hero .kpi-value { font-size: 2.1rem; color: #fff; }
.kpi--hero::after {
  /* ondas NFC: el único gesto decorativo de la interfaz */
  content: ""; position: absolute; right: -40px; top: 50%; width: 180px; height: 180px; transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, transparent 38%, rgba(0,213,255,.35) 39%, transparent 41%, transparent 56%, rgba(0,213,255,.22) 57%, transparent 59%, transparent 74%, rgba(0,213,255,.12) 75%, transparent 77%);
  pointer-events: none;
}

/* ------------------------------------------------ Gráfico */
.chart { display: grid; grid-template-columns: repeat(6, 1fr); gap: .6rem; align-items: end; height: 190px; padding-top: .5rem; }
.chart-col { display: flex; flex-direction: column; align-items: center; gap: .35rem; height: 100%; justify-content: flex-end; }
.chart-bars { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart-bar { width: min(22px, 40%); border-radius: 6px 6px 2px 2px; background: var(--electric); min-height: 3px; position: relative; }
.chart-bar--alt { background: var(--cyan); }
.chart-label { font-size: .78rem; color: var(--text-3); font-weight: 600; }
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--text-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

/* ------------------------------------------------ Tablas (se apilan en celular) */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .78rem; font-weight: 700; color: var(--text-3); padding: .75rem 1.25rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .85rem 1.25rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .t-main { font-weight: 600; color: var(--text); }
.table .t-sub { font-size: .82rem; color: var(--text-3); }
.table .t-actions { text-align: right; white-space: nowrap; }
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { padding: .2rem 0; border: 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table td::before { content: attr(data-label); font-size: .8rem; color: var(--text-3); font-weight: 600; text-align: left; }
  .table td.t-first { display: block; text-align: left; margin-bottom: .3rem; }
  .table td.t-first::before { display: none; }
  .table .t-actions { justify-content: flex-end; padding-top: .5rem; }
  .table .t-actions::before { display: none; }
}

.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.toolbar .input { flex: 1 1 180px; min-height: 42px; }
.toolbar select.input { flex: 0 1 170px; }

.pagination { display: flex; gap: .35rem; justify-content: center; padding: 1rem; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--text-2); font-weight: 600; font-size: .88rem; padding: 0 .6rem; text-decoration: none; }
.pagination .is-current { background: var(--electric); border-color: var(--electric); color: #fff; }

.empty { text-align: center; padding: 2.5rem 1rem; }
.empty svg { width: 44px; height: 44px; color: var(--text-3); margin: 0 auto .8rem; }
.empty h3 { margin-bottom: .3rem; }
.empty p { color: var(--text-2); max-width: 36ch; margin: 0 auto 1rem; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.2rem; margin: 0; font-size: .92rem; }
.dl dt { color: var(--text-3); font-weight: 600; }
.dl dd { margin: 0; overflow-wrap: anywhere; }

.list { list-style: none; margin: 0; padding: 0; }
.list li svg { width: 18px; height: 18px; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

/* ------------------------------------------------ Layout administración */
.app { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--navy); color: #C9D6EE;
  display: flex; flex-direction: column; z-index: 40; transform: translateX(-100%); transition: transform .22s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
.sidebar.is-open { transform: none; box-shadow: var(--shadow-2); }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar-brand img { width: 42px; height: 42px; border-radius: 11px; }
.sidebar-brand strong { font: 700 1.15rem/1 var(--font-display); color: #fff; display: block; }
.sidebar-brand span { font-size: .72rem; color: #7F95BC; }
.nav { padding: .8rem .7rem; overflow-y: auto; flex: 1; }
.nav-group { font-size: .72rem; font-weight: 700; color: #5F77A2; padding: 1rem .7rem .4rem; }
.nav a, .nav .nav-soon {
  display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 10px;
  color: #C9D6EE; font-weight: 500; font-size: .93rem; text-decoration: none;
}
.nav a svg, .nav .nav-soon svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.is-active { background: linear-gradient(90deg, rgba(8,102,255,.35), rgba(8,102,255,.12)); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.nav .nav-soon { color: #5F77A2; cursor: default; white-space: nowrap; font-size: .88rem; }
.nav .nav-soon em { margin-left: auto; font-style: normal; font-size: .68rem; font-weight: 700; padding: .1rem .4rem; border-radius: 5px; background: rgba(255,255,255,.06); color: #7F95BC; }
.sidebar-foot { padding: .9rem 1.2rem; border-top: 1px solid rgba(255,255,255,.07); font-size: .75rem; color: #5F77A2; }
.backdrop { position: fixed; inset: 0; background: rgba(5, 14, 32, .55); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s; }
.backdrop.is-open { opacity: 1; pointer-events: auto; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .6rem;
  height: 64px; padding: 0 1rem; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-title { font: 600 1rem/1 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }
.icon-btn { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: var(--r-md); border: 1px solid transparent; background: none; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--text); }
.icon-btn svg { width: 21px; height: 21px; }
.user-chip { display: flex; align-items: center; gap: .55rem; padding: .25rem .35rem .25rem .25rem; border-radius: 99px; color: var(--text); text-decoration: none !important; }
.user-chip:hover { background: var(--surface); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--electric); color: #fff; font: 700 .85rem/1 var(--font-display); flex: none; }
.user-chip .who { display: none; line-height: 1.2; }
.user-chip .who b { display: block; font-size: .88rem; }
.user-chip .who small { color: var(--text-3); font-size: .75rem; }
.content { padding: 1.25rem 1rem 3rem; max-width: 1240px; margin: 0 auto; }

@media (min-width: 1024px) {
  .sidebar { transform: none; }
  .main { margin-left: var(--sidebar-w); }
  .menu-toggle, .backdrop { display: none; }
  .topbar { padding: 0 2rem; }
  .content { padding: 1.75rem 2rem 4rem; }
  .user-chip .who { display: block; }
}

/* ------------------------------------------------ Panel cliente */
.client-top { background: var(--navy); color: #fff; }
.client-top-inner { max-width: 980px; margin: 0 auto; display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; }
.client-top img { width: 38px; height: 38px; border-radius: 10px; }
.client-top strong { font: 700 1.05rem/1 var(--font-display); }
.client-top .icon-btn { color: #C9D6EE; }
.client-top .icon-btn:hover { background: rgba(255,255,255,.08); border-color: transparent; color: #fff; }
.client-content { max-width: 980px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.roadmap { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.roadmap li { display: flex; gap: .7rem; align-items: center; padding: .7rem .9rem; border-radius: var(--r-md); background: var(--surface-2); font-size: .92rem; }
.roadmap li b { font-family: var(--font-display); font-size: .78rem; color: var(--electric); min-width: 52px; }

/* ------------------------------------------------ Autenticación */
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; background: var(--navy); color: #fff;
}
.auth-art { display: none; }
.auth-side { display: flex; flex-direction: column; justify-content: center; padding: 1.5rem 1.1rem 2.5rem; }
.auth-logo { width: min(250px, 70vw); margin: 0 auto 1.25rem; border-radius: 16px; mix-blend-mode: lighten; }
.auth-card { background: var(--surface); color: var(--text); border-radius: var(--r-xl); padding: 1.6rem 1.3rem; width: 100%; max-width: 430px; margin: 0 auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.auth-card h1 { font-size: 1.45rem; margin-bottom: .25rem; }
.auth-card .lead { color: var(--text-2); margin-bottom: 1.4rem; font-size: .95rem; }
.auth-links { display: flex; justify-content: space-between; gap: 1rem; font-size: .88rem; margin-top: 1rem; flex-wrap: wrap; }
.auth-foot { text-align: center; color: #6E86B0; font-size: .8rem; margin-top: 1.5rem; }
@media (min-width: 960px) {
  .auth { grid-template-columns: 1.15fr 1fr; }
  .auth-art {
    display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 3rem; position: relative; overflow: hidden;
    background: radial-gradient(ellipse at 50% 45%, #0B2B66 0%, var(--navy) 62%);
  }
  .auth-art img { width: min(560px, 90%); border-radius: 24px; position: relative; z-index: 1; animation: rise .9s cubic-bezier(.2,.8,.2,1) both; mix-blend-mode: lighten; }
  .auth-art p { position: relative; z-index: 1; max-width: 40ch; text-align: center; color: #A9BEE3; font-size: 1.02rem; margin-top: 1.5rem; }
  .auth-art::before, .auth-art::after {
    content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(0, 213, 255, .14); left: 50%; top: 45%; transform: translate(-50%, -50%);
  }
  .auth-art::before { width: 720px; height: 720px; }
  .auth-art::after { width: 980px; height: 980px; border-color: rgba(0, 213, 255, .07); }
  .auth-side { background: var(--bg); padding: 3rem; }
  .auth-side .auth-logo { display: none; }
  .auth-card { box-shadow: var(--shadow-2); }
  .auth-foot { color: var(--text-3); }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------ Portada provisoria / errores */
.splash { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; text-align: center; background: radial-gradient(ellipse at 50% 40%, #0B2B66, var(--navy) 65%); color: #fff; padding: 2rem 1rem; }
.splash img { width: min(460px, 86vw); margin: 0 auto 1.5rem; border-radius: 20px; mix-blend-mode: lighten; }
.splash p { color: #A9BEE3; max-width: 44ch; margin: 0 auto 1.5rem; }
.splash .actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }
.splash .btn:not(.btn--primary) { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #fff; }
.error-code { font: 800 4.5rem/1 var(--font-display); background: linear-gradient(90deg, var(--electric), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: .5rem; }

.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row--end { justify-content: flex-end; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.divider { height: 1px; background: var(--line); margin: 1.25rem 0; border: 0; }
details.disclosure summary { cursor: pointer; font-weight: 600; color: var(--electric); list-style: none; }
details.disclosure summary::-webkit-details-marker { display: none; }
details.disclosure[open] summary { margin-bottom: 1rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------ Fase 2 */
.nav-count { margin-left: auto; font-style: normal; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--cyan); color: var(--navy); font-size: .74rem; font-weight: 800; display: inline-grid; place-items: center; }
.bell { position: relative; }
.bell-dot { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font: 700 .68rem/18px var(--font-body); text-align: center; }
.client-tabs { max-width: 980px; margin: 0 auto; display: flex; gap: .25rem; padding: 0 .6rem; overflow-x: auto; }
.client-tabs a { padding: .75rem .9rem; color: #A9BEE3; font-weight: 600; font-size: .92rem; text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.client-tabs a:hover { color: #fff; }
.client-tabs a.is-active { color: #fff; border-bottom-color: var(--cyan); }

.plan-picker { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plan-option { position: relative; }
.plan-option input { position: absolute; opacity: 0; pointer-events: none; }
.plan-option label { display: flex; flex-direction: column; gap: .3rem; height: 100%; padding: 1rem 1.1rem; border: 2px solid var(--line); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.plan-option label:hover { border-color: color-mix(in srgb, var(--electric) 45%, var(--line)); }
.plan-option input:checked + label { border-color: var(--electric); box-shadow: 0 0 0 3px rgba(8, 102, 255, .15); }
.plan-option input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.plan-option .po-name { font: 700 1.05rem/1.2 var(--font-display); display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.plan-option .po-price { font: 700 1.35rem/1.1 var(--font-display); color: var(--electric); }
.plan-option .po-meta { font-size: .82rem; color: var(--text-3); }
.plan-option ul { list-style: none; margin: .4rem 0 0; padding: 0; font-size: .85rem; color: var(--text-2); display: grid; gap: .2rem; }
.plan-option ul li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.plan-option.is-hidden { display: none; }

.total-box { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 1rem 1.1rem; border-radius: var(--r-md); background: var(--surface-2); border: 1px dashed var(--line); }
.total-box b { font: 700 1.5rem/1 var(--font-display); }
.instructions { white-space: pre-line; background: var(--surface-2); border-radius: var(--r-md); padding: 1rem 1.1rem; font-size: .93rem; margin: 0; }
.receipt-preview { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.receipt-preview img { margin: 0 auto; max-height: 70vh; width: auto; }
.status-hero { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.status-hero .big { font: 700 1.6rem/1.1 var(--font-display); }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { display: flex; gap: .9rem; padding: .95rem 1.25rem; border-bottom: 1px solid var(--line); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list li.is-unread { background: color-mix(in srgb, var(--electric) 6%, var(--surface)); }
.notif-list .n-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--info-bg); color: var(--info); flex: none; }
.notif-list .n-icon svg { width: 18px; height: 18px; }
.notif-list a { color: inherit; text-decoration: none; display: block; }
.notif-list a:hover b { color: var(--electric); }
.honey { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------ Fase 3: tarjetas */
.cta-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; border-color: var(--electric); background: linear-gradient(120deg, color-mix(in srgb, var(--electric) 9%, var(--surface)), var(--surface)); }
.cta-card h2 { margin-bottom: .2rem; }
.card-list { display: grid; gap: .75rem; }
.card-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.card-item + .card-item { margin-top: 0; }
.card-item-main { display: flex; gap: .9rem; align-items: center; min-width: 0; flex: 1; }
.card-item-photo { width: 56px; height: 56px; border-radius: 16px; object-fit: cover; flex: none; }
.card-item h2 { font-size: 1.05rem; }

.slug-field { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.slug-field:focus-within { border-color: var(--electric); box-shadow: 0 0 0 3px rgba(8, 102, 255, .18); }
.slug-prefix { display: flex; align-items: center; padding: 0 .2rem 0 .85rem; color: var(--text-3); font-size: .9rem; white-space: nowrap; background: var(--surface-2); }
.slug-field .input { border: 0; border-radius: 0; box-shadow: none !important; min-width: 0; }

/* Selector de plantillas con miniaturas */
.tpl-picker { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tpl-option { position: relative; }
.tpl-option input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-option label { display: flex; flex-direction: column; gap: .4rem; height: 100%; padding: .6rem; border: 2px solid var(--line); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; }
.tpl-option input:checked + label { border-color: var(--electric); box-shadow: 0 0 0 3px rgba(8, 102, 255, .15); }
.tpl-option input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.tpl-option.is-locked label { cursor: not-allowed; opacity: .6; }
.tpl-name { font-weight: 700; font-size: .9rem; display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.tpl-desc, .tpl-lock { font-size: .76rem; color: var(--text-3); line-height: 1.35; }
.tpl-lock { color: var(--warn); font-weight: 600; }
.tpl-mini { position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.tpl-mini .m-cover { position: absolute; inset: 0 0 auto 0; height: 34%; background: linear-gradient(135deg, var(--p), var(--a)); }
.tpl-mini--solid .m-cover { background: var(--p); }
.tpl-mini--diagonal .m-cover { clip-path: polygon(0 0, 100% 0, 100% 65%, 0 100%); }
.tpl-mini--none .m-cover { display: none; }
.tpl-mini .m-photo { position: absolute; top: 22%; left: 50%; width: 30%; aspect-ratio: 1; transform: translateX(-50%); background: color-mix(in srgb, var(--tx) 30%, var(--bg)); border: 3px solid var(--bg); }
.tpl-mini--left .m-photo { left: 12%; transform: none; }
.tpl-mini--none .m-photo { top: 8%; }
.m-circle { border-radius: 50%; } .m-rounded { border-radius: 30%; } .m-square { border-radius: 8%; }
.tpl-mini .m-line { position: absolute; height: 5%; border-radius: 3px; background: var(--tx); opacity: .8; left: 50%; transform: translateX(-50%); }
.tpl-mini .m-l1 { top: 50%; width: 58%; }
.tpl-mini .m-l2 { top: 58%; width: 38%; opacity: .35; }
.tpl-mini--left .m-line { left: 12%; transform: none; }
.tpl-mini--none .m-l1 { top: 38%; } .tpl-mini--none .m-l2 { top: 46%; }
.tpl-mini .m-btn { position: absolute; left: 10%; right: 10%; top: 69%; height: 9%; background: var(--a); border-radius: 6px; }
.m-pill { border-radius: 99px !important; } .m-square { border-radius: 2px; } .m-outline { background: transparent !important; border: 2px solid var(--a); }
.tpl-mini .m-row { position: absolute; left: 10%; right: 10%; top: 82%; height: 8%; display: flex; gap: 6%; }
.tpl-mini .m-row i { flex: 1; background: var(--sf); border-radius: 5px; }

/* Editor */
.editor { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 1100px) { .editor { grid-template-columns: minmax(0, 1fr) 380px; } }
.editor-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; scroll-margin-top: 80px; }
.editor-steps { display: flex; gap: .2rem; overflow-x: auto; padding: .5rem; background: var(--surface-2); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.editor-step { display: flex; align-items: center; gap: .45rem; padding: .55rem .8rem; border: 0; border-radius: 10px; background: none; color: var(--text-2); font: 600 .9rem var(--font-body); cursor: pointer; white-space: nowrap; }
.editor-step span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--muted-bg); font-size: .75rem; }
.editor-step.is-active { background: var(--surface); color: var(--electric); box-shadow: var(--shadow-1); }
.editor-step.is-active span { background: var(--electric); color: #fff; }
.editor-panel { padding: 1.25rem; }
.editor-panel > h2:first-child { margin-top: 0; }
.editor-actions { position: sticky; bottom: 0; display: flex; gap: .5rem; justify-content: flex-end; padding: .8rem 1.25rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 5; }
.editor-actions [data-prev] { margin-right: auto; }

.uploader { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.2rem; }
.uploader--compact { margin-bottom: 0; }
.uploader-thumb { width: 88px; height: 88px; flex: none; border-radius: 16px; background: var(--surface-2); border: 1px dashed var(--line); display: grid; place-items: center; overflow: hidden; color: var(--text-3); }
.uploader-thumb svg { width: 28px; height: 28px; }
.uploader-thumb img { width: 100%; height: 100%; object-fit: cover; }
.uploader-thumb--round { border-radius: 50%; }
.uploader-thumb--wide { width: 128px; height: 72px; border-radius: 12px; }
.uploader-thumb--logo { width: 110px; height: 64px; border-radius: 12px; }
.uploader-thumb--logo img { object-fit: contain; padding: 6px; background: #fff; }
.uploader-body b { display: block; }
.uploader-body .hint { margin: .1rem 0 .5rem; }
.uploader.is-busy .uploader-thumb, .gallery-add.is-busy { opacity: .5; }
.uploader.is-busy .uploader-thumb::after { content: "Subiendo…"; position: absolute; }

.repeater { display: grid; gap: .5rem; }
.repeater-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: .5rem; align-items: center; }
.repeater--stack .repeater-row { grid-template-columns: 1.4fr 1fr auto; padding: .6rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.repeater--stack .span-row { grid-column: 1 / 3; }
.repeater [data-add-row] { justify-self: start; }
@media (max-width: 560px) { .repeater-row { grid-template-columns: 1fr auto; } .repeater-row .input:nth-child(2) { grid-column: 1; } .repeater--stack .span-row { grid-column: 1; } }

.sections-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.sections-list li { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); flex-wrap: wrap; }
.sections-list .switch { display: flex; align-items: center; gap: .5rem; font-weight: 600; min-width: 170px; cursor: pointer; }
.sections-list .switch input { width: 20px; height: 20px; accent-color: var(--electric); }
.sections-list .input--sm { flex: 1; min-height: 38px; padding: .4rem .7rem; font-size: .9rem; min-width: 140px; }
.sec-move { display: flex; margin-left: auto; }
.sec-move .icon-btn { width: 36px; height: 36px; font-size: 1.05rem; }

.gallery-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .5rem; }
.gallery-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-del { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.1rem; cursor: pointer; line-height: 1; }
.gallery-add { aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; color: var(--text-3); font-size: .8rem; font-weight: 600; cursor: pointer; text-align: center; }
.gallery-add:hover { border-color: var(--electric); color: var(--electric); }

.color-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.color-field { display: flex; align-items: center; gap: .6rem; padding: .5rem; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
.color-field input { width: 40px; height: 40px; border: 0; padding: 0; background: none; cursor: pointer; flex: none; }
.color-field span { font-size: .82rem; font-weight: 600; line-height: 1.2; }
.color-field small { display: block; color: var(--text-3); font-weight: 400; font-family: ui-monospace, monospace; }
@media (max-width: 560px) { .color-grid { grid-template-columns: 1fr; } }
input[type="range"] { width: 100%; accent-color: var(--electric); }

/* Vista previa con forma de celular */
.editor-preview { position: sticky; top: 80px; }
.phone { position: relative; width: 100%; max-width: 360px; margin: 0 auto .6rem; aspect-ratio: 9 / 18.5; border-radius: 40px; padding: 12px; background: #0b1220; box-shadow: 0 30px 60px rgba(7, 21, 46, .25), inset 0 0 0 2px #26324a; }
.phone-notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 90px; height: 22px; border-radius: 20px; background: #0b1220; z-index: 2; }
.phone iframe { width: 100%; height: 100%; border: 0; border-radius: 30px; background: #fff; }
.phone-loading { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); padding: .3rem .8rem; border-radius: 99px; background: rgba(0,0,0,.7); color: #fff; font-size: .75rem; }
.preview-fab { position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 30; box-shadow: var(--shadow-2); }
@media (min-width: 1100px) { .preview-fab { display: none; } }
@media (max-width: 1099px) {
  .editor-preview { display: none; }
  body.show-preview .editor-preview { display: flex; flex-direction: column; justify-content: center; position: fixed; inset: 0; z-index: 25; background: var(--bg); padding: 1rem; }
  body.show-preview .phone { height: calc(100dvh - 120px); width: auto; max-width: 100%; aspect-ratio: 9 / 18.5; }
}
.client-content:has(.editor) { max-width: 1240px; }

/* ------------------------------------------------ Fase 4: QR y NFC */
.qr-frame { max-width: 360px; margin: 0 auto 1rem; padding: 1rem; border-radius: var(--r-lg); background: var(--surface-2); }
.qr-frame canvas { display: block; border-radius: 8px; }
.qr-downloads { display: grid; gap: .6rem; justify-items: center; text-align: center; }
.qr-downloads .row { justify-content: center; }
.qr-mini { width: 56px; height: 56px; flex: none; border-radius: 8px; overflow: hidden; background: #fff; padding: 2px; }
.code-big { font: 700 1.25rem/1 ui-monospace, "Cascadia Code", monospace; letter-spacing: .1em; }
.nfc-card { display: grid; gap: .8rem; }
.nfc-card + .nfc-card { margin-top: .75rem; }
.nfc-card:target { border-color: var(--electric); box-shadow: 0 0 0 3px rgba(8, 102, 255, .15); }
.nfc-head { display: flex; justify-content: space-between; gap: .8rem; align-items: center; flex-wrap: wrap; }
.stat-pills { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat-pill { padding: .55rem .9rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); text-decoration: none !important; color: var(--text); }
.stat-pill b { font: 700 1.2rem/1 var(--font-display); margin-right: .35rem; }
.stat-pill.is-active { border-color: var(--electric); box-shadow: 0 0 0 2px rgba(8, 102, 255, .15); }

/* ------------------------------------------------ Fase 5: estadísticas y contactos */
.daybars { display: flex; align-items: flex-end; gap: 2px; height: 190px; padding-bottom: 20px; position: relative; }
.daybar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; min-width: 2px; }
.daybar span { display: block; background: var(--electric); border-radius: 3px 3px 0 0; min-height: 2px; }
.daybar:hover span { background: var(--cyan); }
.daybar em { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: .68rem; color: var(--text-3); white-space: nowrap; }
.hbars { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; gap: .7rem; }
.hbar-label { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: .25rem; }
.hbar { height: 10px; border-radius: 99px; background: var(--muted-bg); overflow: hidden; }
.hbar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--electric), var(--cyan)); min-width: 2px; }
.big-number { font: 700 2.4rem/1 var(--font-display); margin: .2rem 0; }
.lead-item { display: grid; gap: .5rem; }
.lead-item + .lead-item { margin-top: .75rem; }
.lead-head { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; align-items: flex-start; }
.lead-msg { margin: 0; padding: .7rem .9rem; background: var(--surface-2); border-radius: var(--r-md); white-space: pre-line; font-size: .93rem; }
.lead-meta { display: flex; gap: .4rem 1rem; flex-wrap: wrap; font-size: .88rem; }
.lead-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.lead-actions form { display: inline; }
.tab-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin-left: .2rem; border-radius: 99px; background: var(--cyan); color: var(--navy); font-size: .72rem; font-weight: 800; }
.repeater-row--3 { grid-template-columns: 1fr 1fr 1fr auto !important; }
@media (max-width: 700px) { .repeater-row--3 { grid-template-columns: 1fr auto !important; } }
.pay-row { grid-template-columns: 1fr 1.4fr 1fr auto !important; }
.pay-row > input:nth-of-type(5) { grid-column: 1 / 4; }
.pay-row > .icon-btn { grid-column: 4; grid-row: 1; }
@media (max-width: 640px) { .pay-row { grid-template-columns: 1fr 1fr !important; } .pay-row > input:nth-of-type(5) { grid-column: 1 / 3; } .pay-row > .icon-btn { grid-column: 2; grid-row: auto; justify-self: end; } }

/* ------------------------------------------------ Tienda (panel) */
.prod-list { list-style: none; margin: 0; padding: 0; }
.prod-list li { display: flex; gap: .9rem; align-items: center; padding: .8rem 1.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.prod-list li:last-child { border-bottom: 0; }
.prod-list li.is-out .prod-thumb { opacity: .5; }
.prod-list li:target { background: color-mix(in srgb, var(--electric) 8%, var(--surface)); }
.prod-thumb { width: 56px; height: 56px; flex: none; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font: 700 1.3rem var(--font-display); color: var(--text-3); }
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod-thumb--lg { width: 88px; height: 88px; }
.prod-main { flex: 1; min-width: 160px; }
.prod-actions { display: flex; gap: .3rem; align-items: center; }
.prod-actions form { display: inline; }
.prod-actions .icon-btn { width: 36px; height: 36px; }
.po-shop { display: inline-block; width: fit-content; margin-top: .15rem; padding: .2rem .6rem; border-radius: 99px; background: var(--info-bg); color: var(--info); font-size: .78rem; font-weight: 700; }
.stars-txt { color: #F5A524; letter-spacing: 1px; } .stars-txt span { color: var(--line); }
.qr-frame--sm { max-width: 240px; padding: .7rem; }
.tpl-mini--wave .m-cover { clip-path: ellipse(120% 100% at 50% 0%); }
.tpl-mini--mesh .m-cover { background: radial-gradient(60% 80% at 15% 20%, var(--a), transparent 70%), radial-gradient(70% 90% at 80% 90%, color-mix(in srgb, var(--a) 55%, var(--p)), transparent 70%), var(--p); }
.repeater-row--4 { grid-template-columns: 1fr .8fr 1.2fr 2fr auto !important; } @media (max-width: 800px) { .repeater-row--4 { grid-template-columns: 1fr 1fr auto !important; } }
