/* Portal de demos BYLAPERA
 * Estilo aireado y elegante: fondo blanco, sombras suaves, botones en píldora con el color principal.
 * --brand lo fija layout.php (Configuración general o color personal del usuario).
 */

:root {
  color-scheme: light;
  --ink: #16181d;
  --ink-2: #5b6070;
  --muted: #6b7080;
  --bg: #f6f7f9;
  --line: #eceef1;
  --line-strong: #d5d8df;
  --canvas: var(--bg);
  --surface: #ffffff;
  --chrome: #f6f7f9;
  --focus: #2b59c3;
  --pear: #a4c639;
  --danger: #a3241d;
  --danger-bg: #fbeceb;
  --ok: #1f5e2c;
  --ok-bg: #e8f4ea;
  --warn: #7a4b00;
  --warn-bg: #fff3d6;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-soft: 0 1px 2px rgba(22, 24, 29, .04), 0 10px 30px -12px rgba(22, 24, 29, .16);
  --font: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: 16px;
  /* Color principal. layout.php lo sobrescribe (Configuración general o color personal). */
  --brand: #18212e;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
}

@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 1024px) { :root { --gutter: 40px; } }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
  overflow-wrap: break-word;
}

h1, h2 { line-height: 1.15; text-wrap: balance; }
h1 { font-size: 1.75rem; font-weight: 500; letter-spacing: -.01em; margin: 0 0 .5em; }
h2 { font-size: 1.25rem; font-weight: 500; letter-spacing: -.005em; margin: 1.75em 0 .5em; }
p { margin: 0 0 1em; }

a { color: var(--brand-link, var(--ink)); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

img { max-width: 100%; }

.pd-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Cabecera ---------- */

.pd-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 10px var(--gutter);
  background: #fff;
}
.pd-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  text-decoration: none;
  flex-shrink: 0;
}
.pd-brand img { display: block; height: 30px; width: auto; }
.pd-brand-sub { color: var(--ink-2); font-size: .9375rem; font-weight: 500; line-height: 1.2; }

/* Marco del portal: izquierda, logo al centro, acciones a la derecha. */
.pd-app .pd-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  position: relative;
  box-shadow: 0 1px 0 var(--line);
}
.pd-top-left { display: flex; align-items: center; justify-self: start; min-width: 0; }
.pd-top-actions { display: flex; align-items: center; justify-self: end; gap: 10px; min-width: 0; }
.pd-logout { display: flex; align-items: center; gap: 10px; margin: 0; min-width: 0; }
.pd-user {
  color: var(--ink-2);
  font-size: .9375rem;
  max-width: 22ch;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Acceso a administración: píldora con colores invertidos respecto al botón principal. */
.pd-top .pd-top-admin {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 40px;
  padding: 0 16px;
  color: var(--brand-link, var(--brand));
  background: #fff;
  border: 1.5px solid var(--brand);
  border-radius: 999px;
  font-size: .9375rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.pd-top .pd-top-admin:hover { background: var(--brand); color: var(--brand-ink); }
.pd-top .pd-top-admin:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Botón de cierre de sesión: círculo del color principal con sombra suave. */
button.pd-logout-btn {
  flex: none;
  width: 40px;
  height: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 60%, transparent);
}

/* Selector de color personal. */
.pd-accent {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}
.pd-accent button {
  flex: none;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(22, 24, 29, .12);
  border-radius: 50%;
}
.pd-accent button:hover { transform: scale(1.12); border-color: rgba(22, 24, 29, .12); box-shadow: none; }
.pd-accent button[aria-pressed=true] { outline: 2px solid var(--brand); outline-offset: 2px; }
.pd-accent button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (max-width: 719px) {
  .pd-user { display: none; }
  .pd-accent { gap: 6px; padding: 7px 9px; }
  .pd-top .pd-top-admin { width: 40px; padding: 0; justify-content: center; }
  .pd-top .pd-top-admin span {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}
@media (max-width: 479px) {
  .pd-app .pd-top { grid-template-columns: 1fr auto; gap: 8px; }
  .pd-app .pd-top-left { display: none; }
  .pd-app .pd-brand { justify-self: start; }
  .pd-app .pd-brand img { height: 24px; }
}

/* ---------- Contenedor ---------- */

.pd-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px var(--gutter) 56px;
}
@media (min-width: 1024px) { .pd-main { padding-top: 40px; } }

/* ---------- Marco de acceso: login, código, invitación, recuperación ---------- */

.pd-auth { background: radial-gradient(ellipse at center, #fff 0%, #f1f2f4 70%) fixed #f1f2f4; overflow-x: hidden; }
.pd-fly { position: fixed; inset: 0; overflow: hidden; perspective: 900px; pointer-events: none; z-index: 0; }
.pd-auth .pd-main {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px var(--gutter);
}
.pd-auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  padding: 32px 22px 26px;
  text-align: center;
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(20, 24, 32, .16);
}
@media (min-width: 640px) { .pd-auth-card { padding: 38px 34px 30px; } }
.pd-auth-brand { display: flex; justify-content: center; margin: 0 0 18px; }
.pd-auth-brand img { display: block; height: 34px; width: auto; }

/* Webs-maqueta genéricas que vuelan al fondo (las genera initFly() en portal.js). Solo transform y opacity. */
.pd-mk {
  position: absolute; left: 50%; top: 50%; width: 150px; height: 94px; margin: -47px 0 0 -75px;
  display: grid; grid-template-rows: 9px 1fr; overflow: hidden;
  border-radius: 6px; background: #fff; box-shadow: 0 10px 28px rgba(0, 0, 0, .14);
  opacity: 0; animation: pdFly 12s linear infinite; animation-delay: var(--d);
  will-change: transform, opacity;
}
.pd-mk .bar { display: flex; gap: 2px; align-items: center; padding: 0 4px; background: #f3f4f6; }
.pd-mk .bar i { width: 3px; height: 3px; border-radius: 50%; background: #d5d8dd; }
.pd-mk .pg { display: grid; gap: 4px; align-content: start; padding: 6px; }
.pd-mk .row { display: flex; gap: 4px; }
.pd-mk b { display: block; border-radius: 2px; background: var(--c); }
.pd-mk s { display: block; height: 3px; border-radius: 2px; background: #e4e6ea; }
/* Móvil: tarjetas más pequeñas (~100px) con la propiedad `scale`, que no interfiere con la animación de transform. */
@media (max-width: 699px) { .pd-mk { scale: .67; } }
@keyframes pdFly {
  0% { opacity: 0; transform: translate3d(calc(var(--x) * .12), calc(var(--y) * .12), -1200px) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)); }
  15%, 85% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--x), var(--y), 300px) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)); }
}
@media (prefers-reduced-motion: reduce) {
  .pd-mk {
    animation: none; opacity: .7; will-change: auto;
    transform: translate3d(calc(var(--x) * .8), calc(var(--y) * .8), -250px) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz));
  }
}

/* Las vistas de acceso envuelven su contenido en .pd-box; dentro de la tarjeta no añade marco propio. */
.pd-box { max-width: 420px; margin: 24px auto; padding: 28px 24px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.pd-auth-card .pd-box { max-width: none; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
.pd-box h1 { margin: 4px 0 6px; font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; text-align: center; }
.pd-box > p { color: var(--ink-2); font-size: .9375rem; }
.pd-auth-card form { text-align: left; }
.pd-auth-card .pd-resend { text-align: center; }
.pd-auth-card label { margin-top: 14px; font-size: .875rem; }
.pd-auth-card .pd-error, .pd-auth-card .pd-info, .pd-auth-card .pd-warn { margin: 0 0 14px; text-align: left; }
.pd-box button[type=submit]:not(.pd-link) { width: 100%; }
.pd-box > p:last-child { margin: 20px 0 0; font-size: .9375rem; text-align: center; }

/* El código: grande, centrado y con cifras de ancho fijo para leerlo de un vistazo. */
.pd-box input.pd-code {
  font-size: 2rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5em;
  text-indent: .5em;
  text-align: center;
  min-height: 64px;
}
.pd-resend { margin: 8px 0 0; text-align: center; }

/* ---------- Formularios ---------- */

label { display: block; margin: 16px 0 6px; font-size: .9375rem; font-weight: 500; color: var(--ink); }
form > label:first-of-type, form > input[type=hidden] + label { margin-top: 0; }

input[type=email], input[type=password], input[type=text], input[type=number],
input[type=url], input[type=date], select {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 18px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
}
input:disabled { background: var(--bg); color: var(--ink-2); }

/* Botón en píldora del color principal. */
button, .pd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  margin-top: 24px;
  padding: 0 28px;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--brand-ink);
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
button:hover, .pd-btn:hover {
  background: color-mix(in srgb, var(--brand) 88%, #fff);
  border-color: color-mix(in srgb, var(--brand) 88%, #fff);
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--brand) 70%, transparent);
}
button:focus-visible, .pd-btn:focus-visible { outline-offset: 3px; }

.pd-btn-secondary { color: var(--ink); background: #fff; border-color: var(--line-strong); }
.pd-btn-secondary:hover { background: var(--bg); border-color: var(--ink-2); box-shadow: none; }

button.pd-danger { background: var(--danger); border-color: var(--danger); }
button.pd-danger:hover { background: #861c16; border-color: #861c16; }

button.pd-link {
  min-height: 44px;
  margin: 0;
  padding: 0 8px;
  color: var(--ink-2);
  background: none;
  border: 0;
  box-shadow: none;
  font-size: .9375rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.pd-link:hover { background: none; box-shadow: none; color: var(--ink); text-decoration-thickness: 2px; }

.pd-error, .pd-info, .pd-warn {
  padding: 10px 16px;
  border-radius: var(--radius);
  border-left: 4px solid currentColor;
  font-size: .9375rem;
}
.pd-error { color: var(--danger); background: var(--danger-bg); }
.pd-info { color: var(--ok); background: var(--ok-bg); }
.pd-warn { color: var(--warn); background: var(--warn-bg); }

/* ---------- Selector de categorías (portal) ---------- */

.pd-tabs { margin: 0 0 28px; overflow-x: auto; scrollbar-width: none; }
.pd-tabs::-webkit-scrollbar { display: none; }
.pd-selector { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pd-selector a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}
.pd-selector a:hover { color: var(--ink); border-color: var(--ink-2); }
.pd-selector a[aria-current=page] { color: var(--brand-ink); background: var(--brand); border-color: var(--brand); }

/* ---------- Marco del panel: barra lateral + contenido ---------- */

.pd-admin { background: var(--bg); }
.pd-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: #fff;
}
.pd-side .pd-top { min-height: 0; padding: 0 0 12px; }
.pd-side .pd-brand { flex-direction: column; align-items: flex-start; gap: 4px; flex-shrink: 1; max-width: 100%; }
.pd-side-nav { display: flex; flex-direction: column; gap: 2px; }
.pd-side-nav a, .pd-side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 11px 12px;
  color: var(--ink-2);
  font: inherit;
  font-size: .9375rem;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  cursor: pointer;
}
.pd-side-nav a, .pd-side-link { justify-content: flex-start; }
.pd-side-nav a svg, .pd-side-link svg { flex: none; }
.pd-side-nav a:hover, .pd-side-link:hover { background: var(--bg); color: var(--ink); box-shadow: none; transform: none; }
.pd-side-nav a[aria-current=page] { background: var(--brand-soft); color: var(--brand-link, var(--ink)); font-weight: 600; }
.pd-side-nav a[aria-current=page] svg { stroke-width: 2; }
.pd-side-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.pd-side-logout { margin: 0; }

.pd-admin .pd-main { max-width: none; margin: 0; padding: 20px var(--gutter) 56px; min-width: 0; }

/* Móvil: la columna es un cajón que se abre con .pd-side-toggle. */
.pd-side {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  width: min(280px, 86vw);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform .2s ease, visibility 0s linear .2s;
}
.pd-side-open .pd-side { transform: none; visibility: visible; transition: transform .2s ease; }
.pd-scrim { position: fixed; z-index: 20; inset: 0; background: rgba(22, 24, 29, .35); }
.pd-scrim[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .pd-side, .pd-side-open .pd-side { transition: none; } }

@media (min-width: 900px) {
  /* El degradado pinta la columna blanca a toda la altura de la página; la barra pegajosa va encima. */
  .pd-admin {
    display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start;
    background: linear-gradient(to right, #fff 0 219px, var(--line) 219px 220px, var(--bg) 220px);
  }
  .pd-side {
    position: sticky;
    top: 0;
    width: auto;
    height: 100vh;
    padding: 24px 16px;
    transform: none;
    visibility: visible;
    box-shadow: none;
  }
  .pd-scrim { display: none; }
  .pd-side-toggle { display: none !important; }
  .pd-admin .pd-main { padding: 26px 34px 56px; }
}

/* Barra superior del panel */
.pd-titlebar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 14px; margin: 0 0 24px; }
.pd-titlebar h1 { margin: 0 auto 0 0; font-size: 1.625rem; letter-spacing: -.02em; min-width: 0; }
.pd-titlebar h1 small { display: block; margin-top: 4px; color: var(--muted); font-size: .8125rem; font-weight: 400; letter-spacing: 0; }
.pd-titlebar-right { display: flex; align-items: center; gap: 14px; }
.pd-titlebar .pd-accent { box-shadow: none; }
button.pd-side-toggle {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}
button.pd-side-toggle:hover { background: var(--bg); box-shadow: none; transform: none; }
button.pd-side-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pd-me { display: flex; align-items: center; gap: 10px; font-size: .8125rem; }
.pd-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  color: var(--brand-ink);
  background: var(--brand);
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 600;
}
.pd-me-name { max-width: 22ch; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 719px) {
  .pd-me-name { display: none; }
  .pd-titlebar h1 { flex: 1 1 0; }
  .pd-titlebar-right { flex: 1 0 100%; justify-content: space-between; }
}

/* Paneles, tarjetas de resumen y píldoras */
.pd-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
section.pd-panel { padding: 18px 20px; }
.pd-panel-h { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.pd-panel-h h2 { margin: 0 auto 0 0; font-size: 1rem; }
.pd-panel-h .pd-btn { margin: 0; }
section.pd-panel .pd-scroll { border: 0; border-radius: 0; background: none; }
.pd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin: 0 0 22px; }
.pd-stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.pd-stat-ic { display: grid; place-items: center; flex: none; width: 40px; height: 40px; color: var(--brand); background: var(--brand-soft); border-radius: 12px; }
.pd-stat b { display: block; font-size: 1.25rem; line-height: 1.2; }
.pd-stat span { color: var(--muted); font-size: .8125rem; }
.pd-pill { display: inline-block; padding: 4px 10px; color: #227a46; background: #eef7f1; border-radius: 20px; font-size: .75rem; font-weight: 500; white-space: nowrap; }
.pd-pill-inv { color: #a46a00; background: #fff6e6; }
.pd-pill-off { color: var(--ink-2); background: var(--bg); }
/* ---------- Landing de categoría ---------- */

.pd-hero { margin: 0 0 40px; text-align: center; }
@media (min-width: 1080px) { .pd-hero { margin-bottom: 56px; } }
.pd-hero h1 {
  margin: 0;
  font-size: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.05;
}
.pd-dot { color: var(--brand-link, var(--brand)); }
.pd-count {
  display: inline-block;
  margin: 14px 0 0;
  padding: 6px 14px;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--brand-link, var(--ink));
  background: var(--brand-soft);
  border-radius: 999px;
}
.pd-hero .pd-tabs { margin: 22px 0 0; overflow: visible; }
.pd-hero .pd-selector { flex-wrap: wrap; justify-content: center; }
.pd-hero .pd-selector a { min-height: 40px; font-size: .875rem; background: #f3f4f6; border-color: transparent; }
.pd-hero .pd-selector a:hover { color: var(--ink); background: #e9ebef; border-color: transparent; }
.pd-hero .pd-selector a[aria-current=page] {
  color: var(--brand-ink);
  background: var(--brand);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--brand) 60%, transparent);
}

.pd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 56px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pd-grid > li { display: flex; min-width: 0; }
@media (min-width: 700px) { .pd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px 36px; } }
@media (min-width: 1080px) { .pd-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 72px 48px; } }

.pd-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-lg);
}
.pd-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 8px; }

/* Marco con la captura: al pasar el ratón la imagen larga recorre la demo entera. */
.pd-frame {
  position: relative;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: #eceef1;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(22, 24, 29, .12);
  transition: box-shadow .4s, transform .5s cubic-bezier(.22, .8, .24, 1);
}
.pd-thumb {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: auto;
  transition: transform 1.4s cubic-bezier(.22, .8, .24, 1);
}
.pd-frame:not(.pd-scrolls) .pd-thumb { height: 100%; object-fit: cover; object-position: top center; }
.pd-thumb-empty {
  inset: 0;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  font-size: .875rem;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(24, 33, 46, .035) 14px 28px),
    #e9edf1;
}
.pd-label {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 1;
  max-width: calc(100% - 28px);
  padding: 7px 12px;
  font-size: .9375rem;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.3;
  background: #fff;
  border-radius: 3px;
}

.pd-card-desc {
  margin: 18px 10px 0;
  text-align: center;
  color: var(--ink-2);
  font-size: .875rem;
  line-height: 1.55;
}
.pd-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 12px 0 0; }
.pd-tag {
  padding: 2px 10px;
  font-size: .75rem;
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}
.pd-card-btn {
  margin: auto auto 0;
  padding-block: 0;
  box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--brand) 45%, transparent);
  transition: transform .35s, box-shadow .35s, background-color .15s;
}
.pd-card > :not(.pd-card-btn) { margin-bottom: 0; }
.pd-card > :nth-last-child(2) { margin-bottom: 18px; }
.pd-card-btn i { font-style: normal; transition: transform .35s; }

.pd-card:is(:hover, :focus-visible) .pd-frame { transform: translateY(-4px); box-shadow: 0 26px 50px rgba(22, 24, 29, .18); }
.pd-card:is(:hover, :focus-visible) .pd-card-btn { transform: translateY(-2px); box-shadow: 0 14px 30px -8px color-mix(in srgb, var(--brand) 55%, transparent); }
.pd-card:is(:hover, :focus-visible) .pd-card-btn i { transform: translateX(4px); }
.pd-card:is(:hover, :focus-visible) .pd-scrolls .pd-thumb {
  transform: translateY(calc(-1 * var(--dist)));
  transition: transform var(--dur, 14s) cubic-bezier(.35, .05, .45, 1) .25s;
}

/* Estado vacío: una ventana en blanco, dibujada solo con la línea. */
.pd-empty {
  position: relative;
  max-width: 560px;
  padding: 72px 24px 48px;
  text-align: center;
  color: var(--ink-2);
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
}
.pd-empty::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 30px;
  border-bottom: 1.5px dashed var(--line-strong);
}
.pd-empty p { margin: 0; }
.pd-empty-title { margin-bottom: 4px !important; color: var(--ink); font-weight: 600; font-size: 1.0625rem; }

/* ---------- Panel de administración ---------- */

.pd-note { color: var(--ink-2); font-size: .9375rem; }
.pd-export-list { list-style: none; margin: 0; padding: 4px 20px; }
.pd-export-list li { padding: 12px 0; border-top: 1px solid var(--line, #e3e7ed); overflow-wrap: anywhere; }
.pd-export-list li:first-child { border-top: 0; }
.pd-toolbar { margin: 0 0 20px; }
.pd-toolbar .pd-btn { margin: 0; }
.pd-back { margin-top: 24px; }

.pd-form {
  max-width: 560px;
  margin: 0 0 8px;
  padding: 24px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
@media (min-width: 640px) { .pd-form { padding: 28px; } }

fieldset {
  margin: 20px 0 0;
  padding: 8px 16px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
legend { padding: 0 6px; font-size: .9375rem; font-weight: 600; }
.pd-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  font-weight: 400;
}
.pd-check input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }

.pd-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.pd-inline { display: inline; }
.pd-inline button { margin: 0; }

/* Filtro del registro de accesos: en una fila a partir de tablet. */
@media (min-width: 768px) {
  .pd-filter {
    display: grid;
    max-width: none;
    grid-template-rows: auto auto;
    grid-auto-flow: column;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
    column-gap: 16px;
    align-items: end;
    padding: 20px 24px;
  }
  .pd-filter label { margin: 0 0 6px; }
  .pd-filter button { grid-row: 2; margin: 0; }
}
.pd-filter + .pd-note { margin-top: 20px; }

/* Tablas */
.pd-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.pd-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.pd-table th, .pd-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.pd-table th {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--chrome);
  white-space: nowrap;
}
.pd-table tbody tr:last-child td { border-bottom: 0; }
.pd-table tbody tr:hover td { background: #f8fafb; }
.pd-table .pd-cell-title { font-weight: 600; }
.pd-table .pd-cell-action { text-align: right; }
.pd-table .pd-cell-action a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -12px 0;
  padding: 0 8px;
  font-weight: 600;
}
.pd-table .pd-wrap { min-width: 220px; max-width: 360px; font-size: .8125rem; color: var(--ink-2); }

/* Móvil: cada fila pasa a ser una tarjeta con la etiqueta de la columna delante del valor. */
@media (max-width: 639px) {
  .pd-scroll { overflow: visible; background: none; border: 0; border-radius: 0; }
  .pd-table-cards, .pd-table-cards tbody, .pd-table-cards tr, .pd-table-cards td { display: block; }
  .pd-table-cards thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .pd-table-cards tr {
    margin: 0 0 12px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
  }
  .pd-table-cards tbody tr:hover td { background: none; }
  .pd-table-cards td {
    display: grid;
    grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr);
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }
  .pd-table-cards tbody tr td:last-child { border-bottom: 0; }
  .pd-table-cards td::before {
    content: attr(data-label);
    color: var(--ink-2);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1.6;
  }
  .pd-table-cards .pd-cell-title { display: block; font-size: 1.0625rem; }
  .pd-table-cards .pd-cell-title::before { content: none; }
  .pd-table-cards .pd-cell-title:empty { display: none; }
  .pd-table-cards .pd-cell-action { display: block; text-align: left; padding-top: 4px; }
  .pd-table-cards .pd-cell-action::before { content: none; }
  .pd-table-cards .pd-cell-action a { margin: 0; padding: 0; }
  .pd-table .pd-wrap { min-width: 0; max-width: none; }
}

/* ---------- Registro del envío SMTP (panel) ---------- */

.pd-transcript-box { margin-top: 24px; }
.pd-transcript-box h3 { margin: 0 0 8px; font-size: 1rem; }
.pd-transcript-box .pd-muted { color: var(--ink-2); }
.pd-transcript {
  margin: 8px 0 0;
  padding: 12px 14px;
  max-height: 420px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .8125rem;
  line-height: 1.5;
  white-space: pre;
  color: var(--ink);
  background: var(--chrome);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- Configuración general (identidad y emails) ---------- */

.pd-subtabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.pd-subtabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.pd-subtabs a:hover { border-color: var(--line-strong); color: var(--ink); }
.pd-subtabs a[aria-current=page] { color: var(--brand-ink); background: var(--brand); border-color: var(--brand); }
.pd-subtabs-sm { margin-bottom: 16px; }
.pd-subtabs-sm a { min-height: 40px; padding: 0 12px; font-size: .9375rem; }
.pd-subtabs-sm a .pd-badge { margin-left: 6px; }

.pd-form-wide { max-width: 720px; }
.pd-form-title { margin: 0 0 4px; }
.pd-hint { margin: 6px 0 0; color: var(--ink-2); font-size: .875rem; }
.pd-hint code, .pd-vars code {
  font-size: .875em;
  padding: 1px 5px;
  background: var(--chrome);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.pd-color { display: flex; gap: 10px; align-items: stretch; }
.pd-color input[type=color] { flex: none; width: 52px; min-height: 48px; padding: 4px; cursor: pointer; }
.pd-color input[type=text] { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.pd-upload { padding-bottom: 16px; }
.pd-upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 8px 0 4px; }
.pd-upload-state { margin: 0; color: var(--ink-2); font-size: .9375rem; }
.pd-upload input[type=file] {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px;
  font: inherit;
  font-size: .9375rem;
  background: var(--chrome);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
/* Fondo de cuadros para ver las transparencias. */
.pd-checker {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e3e7ec 25%, transparent 25%),
    linear-gradient(-45deg, #e3e7ec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e3e7ec 75%),
    linear-gradient(-45deg, transparent 75%, #e3e7ec 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.pd-preview-logo { min-width: 180px; min-height: 64px; }
.pd-preview-logo img { display: block; max-height: 48px; max-width: 240px; }
.pd-preview-favicon { width: 64px; height: 64px; }
.pd-preview-favicon img { display: block; width: 32px; height: 32px; object-fit: contain; }

.pd-badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: .75rem;
  font-weight: 600;
  border-radius: 999px;
  color: var(--warn);
  background: var(--warn-bg);
}
.pd-vars { margin: 8px 0 0; padding: 0; list-style: none; font-size: .875rem; color: var(--ink-2); }
.pd-vars li { margin: 4px 0; }
.pd-req { color: var(--danger); font-weight: 600; }
textarea {
  display: block;
  width: 100%;
  min-height: 260px;
  padding: 10px 12px;
  font: inherit;
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  resize: vertical;
}
textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--ink); }
textarea.pd-textarea-short { min-height: 0; }
.pd-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.pd-buttons button { margin: 0; }
.pd-preview { max-width: 720px; margin-top: 28px; }
.pd-preview h2 { margin-top: 0; }
.pd-preview-subject {
  margin: 0 0 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: .9375rem;
}
.pd-preview iframe {
  display: block;
  width: 100%;
  height: 560px;
  background: #f4f4f4;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

/* Páginas de administración a dos columnas (edición | prueba o vista previa). */
.pd-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.pd-hint + .pd-cols { margin-top: 16px; }
.pd-cols-main, .pd-cols-side { min-width: 0; }
.pd-cols .pd-form, .pd-cols .pd-form-wide, .pd-cols .pd-preview { max-width: none; }
.pd-cols-side h2:first-child { margin-top: 0; }
.pd-cols-side .pd-transcript-box { margin-top: 20px; }
.pd-cols .pd-preview { margin-top: 0; }
.pd-cols .pd-preview-empty { padding: 24px 20px; }
@media (min-width: 1080px) {
  .pd-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
  .pd-cols-edit .pd-cols-side { position: sticky; top: 24px; }
}

/* ---------- Movimiento ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .pd-card:is(:hover, :focus-visible) .pd-frame,
  .pd-card:is(:hover, :focus-visible) .pd-card-btn,
  .pd-card:is(:hover, :focus-visible) .pd-card-btn i,
  .pd-card:is(:hover, :focus-visible) .pd-scrolls .pd-thumb { transform: none; }
}

/* Panel de administración en móvil: las filas ya son tarjetas, sin marco doble. */
@media (max-width: 639px) {
  .pd-scroll.pd-panel, section.pd-panel { padding: 0; background: none; border: 0; border-radius: 0; }
}
