/* ============================================================
   Apollo — 40 private (login, admin panel, client portal, demo viewer)
   Re-skin de pantallas privadas con la identidad "cobalto sobre papel frio".
   Todo scopeado bajo .private-shell / .admin-layout / .portal-hero /
   .demo-viewer-shell para NO contaminar el sitio publico.
   Solo role tokens; el tema claro/oscuro funciona solo via prefers-color-scheme.
   ============================================================ */

/* ============================================================
   0. Primitivas compartidas dentro del scope privado
   .eyebrow / .form-status / .form-row / .form-note se usan en privado
   y se estilizan SOLO bajo los contenedores privados para no pisar
   los modulos publicos.
   ============================================================ */
.private-shell .eyebrow,
.admin-layout .eyebrow,
.portal-hero .eyebrow,
.demo-viewer-shell .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--accent);
}
.private-shell .eyebrow::before,
.admin-layout .eyebrow::before,
.portal-hero .eyebrow::before,
.demo-viewer-shell .eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.private-shell .form-status,
.admin-layout .form-status,
.demo-viewer-shell .form-status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.private-shell .form-status.error,
.admin-layout .form-status.error,
.demo-viewer-shell .form-status.error {
  color: #d23b3b;
  font-weight: 600;
}
.private-shell .form-status.success,
.admin-layout .form-status.success,
.demo-viewer-shell .form-status.success {
  color: #1f9d5b;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .private-shell .form-status.error,
  .admin-layout .form-status.error,
  .demo-viewer-shell .form-status.error { color: #ff7a7a; }
  .private-shell .form-status.success,
  .admin-layout .form-status.success,
  .demo-viewer-shell .form-status.success { color: #4fd089; }
}

.demo-viewer-shell .form-note {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.admin-layout .form-row,
.demo-viewer-shell .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
@media (max-width: 860px) {
  .admin-layout .form-row,
  .demo-viewer-shell .form-row { grid-template-columns: 1fr; }
}

/* ============================================================
   1. Botones legacy (.button) dentro del scope privado
   Les damos el look de los nuevos .btn usando tokens.
   .primary -> cobalto solido | .secondary -> ghost | .danger -> rojo ghost
   ============================================================ */
.private-shell .button,
.admin-layout .button,
.portal-hero .button,
.demo-card .button,
.demo-viewer-shell .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.8em 1.3em;
  min-height: 46px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-micro) var(--ease-out),
    background var(--dur-micro) ease, border-color var(--dur-micro) ease,
    box-shadow var(--dur) var(--ease-out), color var(--dur-micro) ease;
}

.private-shell .button.primary,
.admin-layout .button.primary,
.portal-hero .button.primary,
.demo-card .button.primary,
.demo-viewer-shell .button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 8px 24px -10px var(--accent-glow);
}
.private-shell .button.primary:hover,
.admin-layout .button.primary:hover,
.portal-hero .button.primary:hover,
.demo-card .button.primary:hover,
.demo-viewer-shell .button.primary:hover {
  background: var(--accent-press);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px -10px var(--accent-glow);
}
.private-shell .button.primary:active,
.admin-layout .button.primary:active,
.portal-hero .button.primary:active,
.demo-card .button.primary:active,
.demo-viewer-shell .button.primary:active { transform: translateY(0); }

.private-shell .button.secondary,
.admin-layout .button.secondary,
.portal-hero .button.secondary,
.demo-card .button.secondary,
.demo-viewer-shell .button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.private-shell .button.secondary:hover,
.admin-layout .button.secondary:hover,
.portal-hero .button.secondary:hover,
.demo-card .button.secondary:hover,
.demo-viewer-shell .button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.private-shell .button.danger,
.admin-layout .button.danger {
  background: transparent;
  color: #d23b3b;
  border-color: color-mix(in srgb, #d23b3b 38%, transparent);
}
.private-shell .button.danger:hover,
.admin-layout .button.danger:hover {
  background: color-mix(in srgb, #d23b3b 10%, transparent);
  border-color: #d23b3b;
  transform: translateY(-1px);
}
@media (prefers-color-scheme: dark) {
  .private-shell .button.danger,
  .admin-layout .button.danger { color: #ff8585; border-color: color-mix(in srgb, #ff8585 36%, transparent); }
  .private-shell .button.danger:hover,
  .admin-layout .button.danger:hover { background: color-mix(in srgb, #ff8585 12%, transparent); border-color: #ff8585; }
}

.private-shell .button[disabled],
.admin-layout .button[disabled],
.portal-hero .button[disabled],
.demo-card .button[disabled],
.demo-viewer-shell .button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ============================================================
   2. Campos de formulario dentro del scope privado
   El markup usa <label>Texto <input></label> (sin .field/.input),
   asi que estilizamos label/input/textarea/select directamente.
   ============================================================ */
.private-shell label,
.admin-layout form label,
.demo-viewer-shell form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.private-shell input,
.private-shell textarea,
.private-shell select,
.admin-layout form input,
.admin-layout form textarea,
.admin-layout form select,
.demo-viewer-shell form input,
.demo-viewer-shell form textarea,
.demo-viewer-shell form select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.85rem;
  transition: border-color var(--dur-micro) ease, box-shadow var(--dur-micro) ease;
}
.private-shell input[type="file"],
.admin-layout form input[type="file"] {
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.private-shell input::placeholder,
.private-shell textarea::placeholder,
.admin-layout form input::placeholder,
.admin-layout form textarea::placeholder,
.demo-viewer-shell form input::placeholder,
.demo-viewer-shell form textarea::placeholder { color: var(--muted); }

.private-shell input:focus,
.private-shell textarea:focus,
.private-shell select:focus,
.admin-layout form input:focus,
.admin-layout form textarea:focus,
.admin-layout form select:focus,
.demo-viewer-shell form input:focus,
.demo-viewer-shell form textarea:focus,
.demo-viewer-shell form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.private-shell textarea,
.admin-layout form textarea,
.demo-viewer-shell form textarea { resize: vertical; min-height: 96px; }

.private-shell input:disabled,
.admin-layout form input:disabled,
.admin-layout form select:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
}

/* ============================================================
   3. Login publico + login admin + portal login + config required
   .private-shell envuelve un .admin-card centrado tipo "login-card".
   ============================================================ */
.private-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 72px);
  padding-block: clamp(48px, 9vw, 120px);
  background:
    radial-gradient(120% 70% at 50% -10%, var(--accent-soft) 0%, transparent 55%),
    var(--bg);
}
.private-shell .admin-card {
  width: 100%;
  max-width: 460px;
}
.login-public-shell .public-login-card,
.private-shell .login-card {
  max-width: 460px;
  margin-inline: auto;
}

/* Login cards: titulo grande, ayuda, campos apilados, botones full-width */
.private-shell .login-card h1,
.private-shell .admin-card h1 {
  font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.6rem);
  line-height: 1.02;
  margin-bottom: 0.35rem;
}
.private-shell .admin-help {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 0.5rem;
}
.private-shell .login-card .button,
.private-shell .admin-card .button {
  width: 100%;
  margin-top: 0.25rem;
}
.private-shell .form-status { margin-block: 0.25rem; }

/* ============================================================
   4. Admin layout: grid sidebar + main
   ============================================================ */
/* Admin is a full-screen internal tool with its own sidebar brand: hide the
   public marketing chrome so the ONLY logo is the sidebar one (no duplicate
   header logo). Same proven pattern as the demo viewer. */
body:has(.admin-layout) { padding-bottom: 0 !important; }
body:has(.admin-layout) #nav,
body:has(.admin-layout) .scroll-progress,
body:has(.admin-layout) .float-cta,
body:has(.admin-layout) .mobile-cta,
body:has(.admin-layout) .site-footer { display: none !important; }

.admin-layout {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* ---- Sidebar ---- */
.admin-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: clamp(1.4rem, 2vw, 2rem) 1.1rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.admin-logo {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.6rem;
  align-items: center;
  padding: 0.4rem 0.5rem 1.2rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.admin-logo img {
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  border-radius: 9px;
}
.admin-logo strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.admin-logo span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-top: -2px;
}

.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--r-sm);
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color var(--dur-micro) ease, background var(--dur-micro) ease;
}
.admin-sidebar nav a i {
  display: grid;
  place-items: center;
  width: 1.4rem;
  font-style: normal;
  font-size: 0.95rem;
  color: var(--muted);
  transition: color var(--dur-micro) ease;
}
.admin-sidebar nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.admin-sidebar nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.admin-sidebar nav a.active i { color: var(--accent); }

.admin-sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.9rem 0.95rem;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.admin-sidebar-foot b {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}
.admin-sidebar-foot span {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---- Main column ---- */
.admin-main {
  display: flex;
  flex-direction: column;
  gap: clamp(1.1rem, 2vw, 1.6rem);
  padding: clamp(1.4rem, 3vw, 2.6rem) clamp(1.4rem, 3.5vw, 3rem) clamp(3rem, 5vw, 4.5rem);
  min-width: 0;
}
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.admin-topbar a {
  color: var(--accent);
  font-weight: 500;
  transition: color var(--dur-micro) ease;
}
.admin-topbar a:hover { color: var(--accent-press); }

/* Login admin queda centrado dentro del shell */
.admin-main > .login-card {
  width: 100%;
  max-width: 460px;
  margin: clamp(2rem, 6vw, 5rem) auto;
}

/* ============================================================
   5. Heads / section heads
   ============================================================ */
.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.admin-head h1 {
  font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.6rem);
  line-height: 1;
}
.admin-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.admin-section-head {
  margin-top: clamp(0.6rem, 1.5vw, 1.2rem);
}
.admin-section-head h2 { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); }

/* ============================================================
   6. Cards genericas
   ============================================================ */
.admin-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: clamp(1.3rem, 2.2vw, 1.9rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.admin-card h2 {
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
  line-height: 1.1;
}
.admin-card h2 + p,
.admin-card .admin-help { margin-top: -0.4rem; }
.admin-card ol {
  list-style: decimal;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.55;
}
.admin-help {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

/* ============================================================
   7. Hero panel (dashboard) + acciones
   ============================================================ */
.admin-hero-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.4rem;
  padding: clamp(1.6rem, 3vw, 2.6rem);
  background:
    radial-gradient(140% 120% at 100% 0%, var(--accent-soft) 0%, transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.admin-hero-panel h1 {
  font-size: clamp(1.9rem, 1.4rem + 2vw, 3rem);
  line-height: 1;
  margin-block: 0.1rem 0.5rem;
}
.admin-hero-panel p:not(.eyebrow) {
  max-width: 62ch;
  color: var(--text);
  line-height: 1.6;
}
.admin-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ============================================================
   8. KPI stats (.admin-stats)
   ============================================================ */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(0.8rem, 1.5vw, 1.1rem);
}
.admin-stats > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: clamp(1.1rem, 2vw, 1.5rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.admin-stats > div small {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.admin-stats > div b {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 1.5rem + 1.6vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.admin-stats > div span {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ============================================================
   9. System note
   ============================================================ */
.admin-system-note {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.2rem;
  border-radius: var(--r);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.admin-system-note b {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}
.admin-system-note span {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text);
}

/* ============================================================
   10. Grids de cards / forms
   ============================================================ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
}
.admin-grid-form {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
}
.admin-wide-card { width: 100%; }

.admin-fieldset {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

/* Guide card (workflow) */
.admin-guide-card { background: var(--surface-2); }

/* Share client card */
.share-client-card .admin-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.admin-share-actions button {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.6em 1.05em;
  min-height: 42px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--r-pill);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  transition: border-color var(--dur-micro) ease, color var(--dur-micro) ease, transform var(--dur-micro) var(--ease-out);
}
.admin-share-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Link group (administrar / portal / demo directa) */
.admin-link-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}
.admin-link-group a {
  display: inline-flex;
  align-items: center;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent);
  transition: color var(--dur-micro) ease;
}
.admin-link-group a:hover { color: var(--accent-press); text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   11. Tablas (lista de filas tipo article)
   .admin-table contiene <article> filas; client-table / config-table variantes.
   ============================================================ */
.table-card .admin-table { margin-top: 0.4rem; }
.admin-table {
  display: flex;
  flex-direction: column;
}
.admin-table > article {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0.2rem;
  border-top: 1px solid var(--line);
}
.admin-table > article:first-child { border-top: none; }
.admin-table > p {
  padding: 1.2rem 0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-demo-main {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.admin-demo-main strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.admin-demo-main > span {
  font-size: 0.9rem;
  color: var(--text);
}
.admin-demo-main small {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.admin-demo-main .admin-link-group { margin-top: 0.25rem; }
.admin-demo-main .admin-share-actions { margin-top: 0.35rem; }

.admin-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  min-width: 140px;
}
.admin-state > span {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}
.admin-views {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  min-width: 70px;
  text-align: right;
}
.admin-views b {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink);
}
.admin-views span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

/* Analytics rows: article con dos columnas (info / fecha) */
.table-card .admin-table > article > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.table-card .admin-table > article strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}
.table-card .admin-table > article span {
  font-size: 0.85rem;
  color: var(--text);
}
.table-card .admin-table > article a {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}
.table-card .admin-table > article a:hover { color: var(--accent-press); }

/* Config table: article -> [label/detail] + status-pill, dos columnas */
.config-table > article {
  grid-template-columns: 1fr auto;
}
.config-table > article div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.config-table > article strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}
.config-table > article span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

/* Client table: misma estructura que admin-table base */
.client-table > article {
  grid-template-columns: 1fr auto;
  align-items: start;
}

/* ============================================================
   12. Status pills (5 variantes) — ready / draft / expired / error / muted
   ============================================================ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.32em 0.8em;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
}
.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.ready {
  color: #1f9d5b;
  background: color-mix(in srgb, #1f9d5b 12%, transparent);
  border-color: color-mix(in srgb, #1f9d5b 32%, transparent);
}
.status-pill.draft {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.status-pill.expired {
  color: #b07400;
  background: color-mix(in srgb, #b07400 12%, transparent);
  border-color: color-mix(in srgb, #b07400 30%, transparent);
}
.status-pill.error {
  color: #d23b3b;
  background: color-mix(in srgb, #d23b3b 12%, transparent);
  border-color: color-mix(in srgb, #d23b3b 32%, transparent);
}
.status-pill.muted {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--line);
}
@media (prefers-color-scheme: dark) {
  .status-pill.ready { color: #4fd089; background: color-mix(in srgb, #4fd089 14%, transparent); border-color: color-mix(in srgb, #4fd089 34%, transparent); }
  .status-pill.expired { color: #e8b14d; background: color-mix(in srgb, #e8b14d 14%, transparent); border-color: color-mix(in srgb, #e8b14d 32%, transparent); }
  .status-pill.error { color: #ff8585; background: color-mix(in srgb, #ff8585 14%, transparent); border-color: color-mix(in srgb, #ff8585 34%, transparent); }
}

/* ============================================================
   13. Upload status
   ============================================================ */
.upload-status {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  transition: border-color var(--dur-micro) ease, background var(--dur-micro) ease;
}
.upload-status b {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}
.upload-status span {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}
.upload-status.working {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.upload-status.working b { color: var(--accent); }

/* ============================================================
   14. Flash (success / error)
   ============================================================ */
.admin-flash {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: clamp(1.1rem, 2vw, 1.5rem);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.admin-flash.success {
  border-color: color-mix(in srgb, #1f9d5b 32%, transparent);
  background: color-mix(in srgb, #1f9d5b 7%, var(--surface));
}
.admin-flash.error {
  border-color: color-mix(in srgb, #d23b3b 32%, transparent);
  background: color-mix(in srgb, #d23b3b 7%, var(--surface));
}
.admin-flash h2 {
  font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.4rem);
  margin-top: 0.1rem;
}
.admin-flash p:not(.eyebrow) {
  color: var(--text);
  font-size: 0.92rem;
  margin-top: 0.3rem;
}
.admin-flash .eyebrow { color: var(--accent); }
.admin-flash.success .eyebrow { color: #1f9d5b; }
.admin-flash.error .eyebrow { color: #d23b3b; }
@media (prefers-color-scheme: dark) {
  .admin-flash.success .eyebrow { color: #4fd089; }
  .admin-flash.error .eyebrow { color: #ff8585; }
}
.admin-flash.success .eyebrow::before { background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); }
.admin-flash.error .eyebrow::before { background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); }

.admin-flash-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.6rem;
}
.admin-flash-list span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.admin-flash-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

/* ============================================================
   15. Demo editor (ficha de cliente)
   ============================================================ */
.demo-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
}
.demo-editor { gap: 1rem; }
.demo-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.demo-editor-head > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.demo-editor-head h2 { font-size: clamp(1.15rem, 1rem + 0.5vw, 1.4rem); }
.demo-editor-head .status-pill { align-self: flex-start; }
.demo-editor form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.demo-editor > form:last-of-type,
.demo-editor > form:last-child { gap: 0; }

/* ============================================================
   16. Activity card
   ============================================================ */
.activity-card > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}
.activity-card > div:first-of-type { border-top: none; }
.activity-card b {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.activity-card span {
  font-size: 0.84rem;
  color: var(--muted);
  text-align: right;
}

/* ============================================================
   17. Portal de clientes — hero + grid de demos
   ============================================================ */
.portal-hero {
  padding: clamp(4.5rem, 9vw, 7.5rem) var(--gutter) clamp(2.5rem, 5vw, 4rem);
  background:
    radial-gradient(120% 80% at 50% -10%, var(--accent-soft) 0%, transparent 55%),
    var(--bg);
}
.portal-hero > div {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
}
.portal-hero h1 {
  font-size: clamp(2.4rem, 1.6rem + 3.4vw, 4.4rem);
  line-height: 0.98;
  margin-block: 0.4rem 0.7rem;
}
.portal-hero > div > p {
  max-width: 52ch;
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.25rem);
  color: var(--text);
  line-height: 1.55;
}
.portal-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
}
.portal-pills span {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.5em 0.95em;
  border-radius: var(--r-pill);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
}
.portal-pills span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Section heading dentro del portal */
.section-heading {
  margin-bottom: clamp(1.4rem, 3vw, 2.4rem);
}
.section-heading h2 {
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.8rem);
  line-height: 1;
}

/* La seccion .section.light-section del portal usa container manual */
.portal-hero + .section { padding-block: clamp(2rem, 4vw, 3.5rem) var(--section-y); }
.portal-hero ~ .section > .section-heading,
.portal-hero ~ .section > .demo-card-grid {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---- Demo cards ---- */
.demo-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(1.1rem, 2.4vw, 1.8rem);
}
.demo-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.1rem 1.1rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur-micro) ease;
}
.demo-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.demo-preview {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  aspect-ratio: 16 / 10;
}
.demo-preview > * { width: 100%; height: 100%; }
.demo-card > div:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.demo-card > div:nth-child(2) > span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.demo-card h3 { font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.45rem); }
.demo-card > div:nth-child(2) > p {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}
.demo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.6rem;
  margin-top: auto;
  border-top: 1px solid var(--line);
}
.demo-meta small {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.demo-card .button { width: 100%; }

/* ============================================================
   18. Demo viewer (iframe a pantalla completa con barra)
   ============================================================ */
.demo-viewer-shell {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
}
/* The viewer takes over the screen: hide the marketing chrome behind it. */
body:has(.demo-viewer-shell) { overflow: hidden; padding-bottom: 0 !important; }
body:has(.demo-viewer-shell) #nav,
body:has(.demo-viewer-shell) .scroll-progress,
body:has(.demo-viewer-shell) .float-cta,
body:has(.demo-viewer-shell) .mobile-cta,
body:has(.demo-viewer-shell) .site-footer { display: none !important; }
.demo-viewer-bar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: clamp(0.8rem, 2vw, 1.6rem);
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.demo-viewer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.demo-viewer-brand img { width: 32px; height: 32px; border-radius: 8px; }
.demo-viewer-brand span {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.demo-viewer-brand strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.demo-viewer-brand small {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-top: 2px;
}
.demo-viewer-title {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  margin-right: auto;
  padding-left: clamp(0.8rem, 2vw, 1.6rem);
  border-left: 1px solid var(--line);
}
.demo-viewer-title b {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-viewer-title span {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-viewer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.6rem;
  min-width: 0;
}
.demo-viewer-actions .button { min-height: 42px; padding-block: 0.72em; }

/* Iframe: NO tocar src/sandbox, solo presentacion */
.demo-viewer-frame {
  flex: 1 1 auto;
  width: 100%;
  border: none;
  background: var(--surface);
  min-height: 0;
}

/* Feedback panel (slide-in lateral) */
.demo-feedback-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 2010;
  width: min(420px, 100%);
  height: 100vh;
  height: 100dvh;
  padding: clamp(1.5rem, 3vw, 2.2rem);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--dur-slow) var(--ease-out-expo), visibility var(--dur);
  overflow-y: auto;
}
.demo-feedback-panel.open {
  transform: translateX(0);
  visibility: visible;
}
.demo-feedback-panel form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.demo-feedback-panel form > div:first-child {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.5rem;
}
.demo-feedback-panel form > div:first-child h2 {
  grid-column: 1;
  font-size: 1.4rem;
}
.demo-feedback-panel form > div:first-child .eyebrow { grid-column: 1; }
.demo-feedback-panel form > div:first-child button {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 1.3rem;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--dur-micro) ease, color var(--dur-micro) ease;
}
.demo-feedback-panel form > div:first-child button:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.demo-feedback-panel .button { width: 100%; }

/* ============================================================
   19. Responsive
   ============================================================ */
@media (max-width: 1080px) {
  .admin-grid-form { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  /* Sidebar pasa a barra horizontal arriba */
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.8rem;
    padding: 0.8rem var(--gutter);
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .admin-logo {
    grid-template-rows: auto;
    padding: 0;
    margin: 0 auto 0 0;
    border-bottom: none;
  }
  .admin-logo span { display: none; }
  .admin-sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .admin-sidebar nav a span { display: none; }
  .admin-sidebar nav a {
    padding: 0.55rem;
    width: 44px;
    height: 44px;
    justify-content: center;
  }
  .admin-sidebar nav a i { width: auto; font-size: 1.1rem; }
  .admin-sidebar-foot { display: none; }

  .admin-main { padding: clamp(1.2rem, 4vw, 1.8rem) var(--gutter) 3rem; }

  /* Tablas: filas en bloque vertical */
  .admin-table > article {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }
  .admin-state,
  .admin-views { align-items: flex-start; text-align: left; min-width: 0; }
  .config-table > article,
  .client-table > article { grid-template-columns: 1fr; }

  .demo-viewer-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "title title";
    gap: 0.65rem 0.8rem;
    padding: 0.65rem max(14px, env(safe-area-inset-right, 0px)) 0.75rem max(14px, env(safe-area-inset-left, 0px));
  }
  .demo-viewer-brand { grid-area: brand; }
  .demo-viewer-brand small { display: none; }
  .demo-viewer-title {
    grid-area: title;
    display: flex;
    margin-right: 0;
    padding-left: 0;
    border-left: 0;
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
  }
  .demo-viewer-actions {
    grid-area: actions;
    justify-content: flex-end;
    gap: 0.45rem;
  }
  .demo-viewer-actions .button { padding-inline: 0.9em; font-size: 0.85rem; }
}

@media (max-width: 520px) {
  .admin-hero-panel,
  .admin-head,
  .admin-flash { flex-direction: column; align-items: flex-start; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .demo-viewer-bar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "title"
      "actions";
  }
  .demo-viewer-actions {
    justify-content: stretch;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .demo-viewer-actions .button {
    width: 100%;
    min-width: 0;
    padding-inline: 0.7em;
    font-size: 0.82rem;
  }
}

/* ============================================================
   20. Motion reducido
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .demo-card,
  .private-shell .button,
  .admin-layout .button,
  .demo-feedback-panel,
  .admin-share-actions button { transition: none; }
  .demo-card:hover,
  .private-shell .button:hover,
  .admin-layout .button:hover { transform: none; }
}
