/* ==========================================================
   BACKOFFICE THE DOC — estilos
   Mismos colores y tipografías que la web pública.
   ========================================================== */
:root {
  --red: #c61b18;
  --red-deep: #773231;
  --red-grad: linear-gradient(115deg, var(--red) 0%, var(--red-deep) 100%);
  --black: #0a0a0a;
  --ink: #141414;
  --steel: #1e1e1e;
  --line: rgba(255, 255, 255, .1);
  --white: #fff;
  --muted: #9a9a9a;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Roboto", system-ui, sans-serif;   /* textos */
  --font-ui: "Barlow", system-ui, sans-serif;      /* navegación, menús y botones */
  --skew: -12deg;
  --ease: cubic-bezier(.7, 0, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--white);
  background: var(--black);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ---------- Piezas comunes ---------- */
.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--red);
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 1.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--white);
  background: none;
  border: 0;
  cursor: pointer;
  isolation: isolate;
}
.btn--race::before,
.btn--race::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: skewX(var(--skew));
}
.btn--race::before { background: var(--red-grad); }
.btn--race::after {
  background: var(--white);
  transform: skewX(var(--skew)) scaleX(0);
  transform-origin: right;
  transition: transform .45s var(--ease);
}
.btn--race { transition: color .45s var(--ease); }
.btn--race:hover { color: var(--black); }
.btn--race:hover::after { transform: skewX(var(--skew)) scaleX(1); transform-origin: left; }

.field { display: flex; flex-direction: column; gap: .45rem; }
.field__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.field input {
  width: 100%;
  height: 50px;
  padding: 0 1rem;
  font: inherit;
  font-size: 1rem;
  color: var(--white);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  transition: border-color .25s, background-color .25s;
}
.field input::placeholder { color: #5c5c5c; }
.field input:focus { outline: none; border-color: var(--red); background: var(--steel); }

.field__pass { position: relative; display: block; }
.field__pass input { padding-right: 3.2rem; }
.field__toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color .25s;
}
.field__toggle:hover,
.field__toggle[aria-pressed="true"] { color: var(--white); }
.field__toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.check {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-size: .92rem;
  color: #bdbdbd;
  cursor: pointer;
}
.check input { width: 17px; height: 17px; accent-color: var(--red); }

/* ==========================================================
   LOGIN — pantalla partida: marca a la izquierda, acceso a la derecha
   ========================================================== */
.login {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100svh;
}

/* Marca */
.login__brand {
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(2rem, 5vw, 4rem);
  overflow: hidden;
  isolation: isolate;
  background: var(--black);
}
.login__photo {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
  filter: grayscale(1) contrast(1.15) brightness(.5);
}
/* oscurecido + franja roja en diagonal, como las portadas de la web */
.login__brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(115deg, transparent 58%, rgba(198, 27, 24, .22) 58%, rgba(119, 50, 49, .12) 100%),
    radial-gradient(ellipse at center, rgba(10, 10, 10, .55) 0%, rgba(10, 10, 10, .2) 70%),
    repeating-linear-gradient(-58deg, transparent 0 40px, rgba(255, 255, 255, .03) 40px 42px);
}
.login__logo { width: 120px; height: auto; }
/* Logo grande, centrado sobre la foto */
.login__logo--big {
  width: min(360px, 55%);
  filter: drop-shadow(0 10px 40px rgba(0, 0, 0, .6));
}

.login__heading em {
  background: var(--red-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: .08em;
}
/* Acceso */
.login__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(2rem, 5vw, 4rem) clamp(1.2rem, 4vw, 3rem);
  background: var(--ink);
  border-left: 3px solid var(--red);
}
.login__box { width: min(400px, 100%); }
.login__logo--mobile { display: none; }
.login__heading {
  margin-top: .5rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 4vw, 3.4rem);
  line-height: .9;
  text-transform: uppercase;
}
.login__intro { margin-top: 1rem; font-size: 1rem; line-height: 1.55; color: var(--muted); }

.login__form { display: grid; gap: 1.3rem; margin-top: 2.2rem; }
.login__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
}
.login__forgot {
  font-size: .9rem;
  color: #bdbdbd;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .25s;
}
.login__forgot:hover { color: var(--white); }

.login__error {
  padding: .75rem 1rem;
  font-size: .92rem;
  border-left: 3px solid var(--red);
  background: rgba(198, 27, 24, .14);
}
.login__error.is-info { border-left-color: var(--muted); background: rgba(255, 255, 255, .05); color: #c4c4c4; }
.login__submit { width: 100%; height: 54px; margin-top: .4rem; font-size: 1.05rem; }

.login__foot { margin-top: 2rem; font-size: .88rem; line-height: 1.55; color: var(--muted); }
.login__foot a { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }
.login__copy {
  position: absolute;
  bottom: 1.4rem;
  font-size: .78rem;
  letter-spacing: .06em;
  color: #5c5c5c;
}

/* ---------- Móvil y tablet: solo el acceso ---------- */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login__brand { display: none; }
  .login__panel { border-left: 0; border-top: 3px solid var(--red); padding-bottom: 5rem; }
  .login__logo--mobile { display: block; width: 96px; margin-bottom: 2rem; }
}


/* ==========================================================
   APP — interior del backoffice
   Navbar arriba (menú en píldoras) + barra flotante de iconos
   a la izquierda. Tema claro por defecto; oscuro con
   <html data-theme="dark">. El login no usa estos tokens.
   ========================================================== */
:root {
  --bg: #eceeea;
  --bg-glow: radial-gradient(1200px 600px at 85% -10%, #f6f7ee 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 110%, #e3e7e8 0%, transparent 60%);
  --surface: rgba(255, 255, 255, .72);
  --surface-solid: #ffffff;
  --surface-2: rgba(0, 0, 0, .045);
  --hover: rgba(0, 0, 0, .06);
  --border: rgba(0, 0, 0, .07);
  --text: #141414;
  --text-muted: #6f706c;
  --pill-active-bg: var(--ink);
  --pill-active-text: var(--white);
  --shadow: 0 20px 50px rgba(20, 20, 20, .12);
  --logo-filter: invert(1);

  --radius-xl: 28px;
  --radius-lg: 20px;
  --nav-h: 76px;
  --rail-w: 60px;
}
:root[data-theme="dark"] {
  --bg: var(--black);
  --bg-glow: radial-gradient(1000px 520px at 90% -10%, rgba(198, 27, 24, .16) 0%, transparent 60%),
             radial-gradient(900px 500px at -10% 110%, rgba(255, 255, 255, .05) 0%, transparent 60%);
  --surface: rgba(30, 30, 30, .72);
  --surface-solid: var(--steel);
  --surface-2: rgba(255, 255, 255, .06);
  --hover: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .08);
  --text: var(--white);
  --text-muted: var(--muted);
  --pill-active-bg: var(--white);
  --pill-active-text: var(--black);
  --shadow: 0 20px 50px rgba(0, 0, 0, .5);
  --logo-filter: none;
}

.app-page {
  min-height: 100vh;
  color: var(--text);
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  transition: background-color .3s, color .3s;
}
.app-page svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Botón redondo (iconos de la navbar) ---------- */
.round-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color .2s, transform .2s;
}
.round-btn:hover,
.round-btn[aria-expanded="true"] { background: var(--hover); }
.round-btn:active { transform: scale(.94); }
.round-btn svg { width: 20px; height: 20px; }

.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  font: 700 .72rem/16px var(--font-ui);
  text-align: center;
  color: var(--white);
  background: var(--red);
  border: 2px solid var(--surface-solid);
  border-radius: 10px;
}

/* Claro / oscuro: se ve el icono del modo al que cambias */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--nav-h);
  padding: 0 clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(14px);
}
.navbar__brand { display: flex; align-items: center; gap: .8rem; }
.navbar__brand img { width: 44px; filter: var(--logo-filter); transition: transform .3s var(--ease); }
.navbar__brand:hover img { transform: skewX(var(--skew)) translateX(3px); }

/* Menú en píldoras: la activa, rellena */
.pills {
  display: flex;
  gap: .25rem;
  padding: .3rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.pills a {
  display: block;
  padding: .55rem 1.2rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-radius: 999px;
  transition: color .2s, background-color .2s;
}
.pills a:hover { color: var(--text); background: var(--hover); }
.pills a.is-active { color: var(--pill-active-text); background: var(--pill-active-bg); }

.navbar__actions { display: flex; align-items: center; gap: .6rem; }

.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .04em;
  color: var(--white);
  background: var(--red-grad);
  border: 2px solid var(--surface-solid);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
}

/* ---------- Desplegables ---------- */
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 250px;
  padding: .4rem;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.98);
  transform-origin: top right;
  transition: opacity .2s, transform .25s var(--ease), visibility .25s;
}
.dropdown.is-open .dropdown__menu { opacity: 1; visibility: visible; transform: none; }
.dropdown__who { display: flex; align-items: center; gap: .8rem; padding: .7rem .7rem .9rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.dropdown__who .avatar { width: 40px; height: 40px; cursor: default; }
.dropdown__who strong { display: block; font-weight: 600; }
.dropdown__who small { font-size: .82rem; color: var(--text-muted); }
.dropdown__item {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .75rem .8rem;
  font: 500 .95rem var(--font-ui);
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.dropdown__item svg { width: 18px; height: 18px; }
.dropdown__item:hover { background: var(--hover); }
.dropdown__item--danger:hover { color: var(--red); background: rgba(198, 27, 24, .1); }

/* Notificaciones */
.notif { width: min(380px, calc(100vw - 2rem)); }
.notif__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .8rem .9rem; }
.notif__head strong { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; text-transform: uppercase; letter-spacing: .04em; }
.notif__all { font: 600 .82rem var(--font-ui); color: var(--red); background: none; border: 0; cursor: pointer; }
.notif__all:hover { text-decoration: underline; text-underline-offset: 3px; }
.notif__list { display: grid; gap: .2rem; max-height: 380px; overflow-y: auto; list-style: none; }
.notif__item {
  display: grid;
  grid-template-columns: 40px 1fr 8px;
  gap: .8rem;
  width: 100%;
  padding: .75rem .8rem;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  transition: background-color .2s;
}
.notif__item:hover { background: var(--hover); }
.notif__item.is-unread { background: rgba(198, 27, 24, .07); }
.notif__icon { display: grid; place-items: center; width: 40px; height: 40px; color: var(--red); background: var(--surface-2); border-radius: 50%; }
.notif__icon svg { width: 18px; height: 18px; }
.notif__text strong { display: block; font-weight: 600; font-size: .92rem; }
.notif__text span { display: block; margin-top: .15rem; font-size: .85rem; line-height: 1.4; color: var(--text-muted); }
.notif__text time { display: block; margin-top: .3rem; font-size: .75rem; color: var(--text-muted); }
.notif__dot { width: 8px; height: 8px; margin-top: .45rem; border-radius: 50%; background: var(--red); visibility: hidden; }
.is-unread .notif__dot { visibility: visible; }
.notif__empty { padding: 2rem 1rem; text-align: center; font-size: .9rem; color: var(--text-muted); }

/* ---------- Barra flotante de iconos (sidebar) ---------- */
.rail {
  position: fixed;
  left: clamp(.8rem, 1.6vw, 1.4rem);
  top: 50%;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .55rem;
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transform: translateY(-50%);
}
.rail__link {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #a9a9a9;
  background: rgba(255, 255, 255, .06);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: color .2s, background-color .2s;
}
.rail__link svg { width: 20px; height: 20px; }
.rail__link:hover { color: var(--white); background: rgba(255, 255, 255, .14); }
.rail__link.is-active { color: var(--white); background: var(--red-grad); }
/* Aviso de pendientes sobre el icono: el borde imita el fondo de la barra */
.rail .badge { top: -3px; right: -3px; border-color: var(--ink); }
.rail__sep { width: 22px; height: 1px; margin: .3rem 0; background: rgba(255, 255, 255, .12); }
/* Nombre al pasar por encima */
.rail__link[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 14px);
  padding: .4rem .75rem;
  font: 600 .85rem var(--font-ui);
  white-space: nowrap;
  color: var(--white);
  background: var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow);
  pointer-events: none;
}

/* ---------- Contenido ---------- */
.content {
  padding: clamp(.8rem, 2vw, 1.4rem) clamp(1rem, 3vw, 2rem) 3rem;
  padding-left: calc(var(--rail-w) + clamp(1.6rem, 4vw, 3rem));
}
.page-head { display: flex; align-items: center; gap: 1rem; }
.page-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  line-height: .95;
  text-transform: uppercase;
}
.page-title em {
  font-style: italic;
  background: var(--red-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: .08em;
}
.page-sub { margin-top: .4rem; color: var(--text-muted); }

/* ---------- Móvil: el menú de píldoras se va; la barra flotante baja ---------- */
@media (max-width: 700px) {
  .rail {
    top: auto;
    bottom: .9rem;
    left: 50%;
    flex-direction: row;
    transform: translateX(-50%);
  }
  .rail__sep { width: 1px; height: 22px; margin: 0 .3rem; }
  .rail__link[data-tip]:hover::after { display: none; }
  .content { padding-left: clamp(1rem, 3vw, 2rem); padding-bottom: 6rem; }
  .dropdown { position: static; }
  .dropdown__menu { right: 1rem; left: 1rem; top: calc(var(--nav-h) - 6px); min-width: 0; width: auto; }
}

/* ==========================================================
   PÁGINAS — listado de tarjetas
   ========================================================== */
.page-sub { max-width: 640px; line-height: 1.5; }

.page-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.4rem);
  margin-top: clamp(1.4rem, 3vw, 2.2rem);
}

.page-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(10px);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}
.page-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(198, 27, 24, .35); }

/* Foto de la página, con el tratamiento de las portadas de la web */
.page-card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  margin: .5rem .5rem 0;
  overflow: hidden;
  border-radius: calc(var(--radius-xl) - .5rem);
  background: var(--ink);
}
.page-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.1) brightness(.62);
  transition: transform .6s var(--ease), filter .4s;
}
.page-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 62%, rgba(198, 27, 24, .4) 62%, rgba(119, 50, 49, .25) 100%);
}
.page-card:hover .page-card__media img { transform: scale(1.06); filter: grayscale(.2) contrast(1.05) brightness(.7); }

.page-card__body { display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem 1.4rem 1.4rem; }
.page-card__body strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.9rem;
  line-height: 1;
  text-transform: uppercase;
}
.page-card__desc { font-size: .92rem; line-height: 1.45; color: var(--text-muted); }

/* Qué parte de la página viene de otro módulo */
.page-card__tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.page-card__tags span {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .65rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 999px;
}
.page-card__tags svg { width: 12px; height: 12px; }

/* Flecha redonda sobre la foto */
.page-card__go {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--black);
  background: var(--white);
  border-radius: 50%;
  transform: rotate(-45deg);
  transition: transform .35s var(--ease), background-color .25s, color .25s;
}
.page-card__go svg { width: 18px; height: 18px; }

/* 3 columnas en escritorio, 2 en tablet, 1 en móvil */
@media (max-width: 1100px) { .page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .page-grid { grid-template-columns: 1fr; } }
.page-card:hover .page-card__go { color: var(--white); background: var(--red); transform: rotate(0); }

/* ==========================================================
   PÁGINA — editor: vista previa de la web + panel de contenido
   ========================================================== */
.content--editor { padding-bottom: clamp(.8rem, 2vw, 1.4rem); }

.editor {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-h) - clamp(1.6rem, 4vw, 2.8rem));
  min-height: 560px;
}
.editor.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 60;
  height: auto;
  padding: 1.2rem;
  background: var(--bg-glow), var(--bg);
}
.editor.is-fullscreen .back-link { display: none; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  align-self: flex-start;
  margin-bottom: .6rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color .2s;
}
.back-link svg { width: 16px; height: 16px; }
.back-link:hover { color: var(--red); }

.editor__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.editor__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.editor:not(.is-editing) .show-editing,
.editor.is-editing .hide-editing { display: none; }

/* Botones en píldora */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  height: 44px;
  padding: 0 1.2rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.btn-pill svg { width: 17px; height: 17px; }
.btn-pill:active { transform: scale(.97); }
.btn-pill--red { color: var(--white); background: var(--red-grad); }
.btn-pill--red:hover { background: var(--red); }
.btn-pill--ghost { color: var(--text); background: var(--surface); border-color: var(--border); }
.btn-pill--ghost:hover { background: var(--hover); }

.editor__grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 1.2rem;
}

/* ---------- Vista previa ---------- */
.preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}
.preview__bar {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .6rem .7rem .6rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.preview__dots { display: flex; gap: 6px; }
.preview__dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.preview__dots i:first-child { background: var(--red); box-shadow: none; }
.preview__label {
  margin-right: auto;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.preview__size {
  padding: .25rem .6rem;
  font: .72rem ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 999px;
}
.round-btn--sm { width: 36px; height: 36px; }
.round-btn--sm svg { width: 17px; height: 17px; }

.preview__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--black);
}
.preview__stage iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  background: var(--black);
  transform-origin: 0 0;
}

/* Selector segmentado (dispositivo, pestañas del panel) */
.seg {
  display: flex;
  gap: .2rem;
  padding: .25rem;
  background: var(--surface-2);
  border-radius: 999px;
}
.seg button {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 36px;
  padding: 0 1rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s, background-color .2s;
}
.seg button:hover { color: var(--text); }
.seg button.is-active { color: var(--pill-active-text); background: var(--pill-active-bg); }
.seg svg { width: 17px; height: 17px; }
.seg--sm button { min-height: 30px; padding: 0 .7rem; }

/* ---------- Panel de contenido ---------- */
.ed-panel {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  min-height: 0;
  overflow-y: auto;
  padding: 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}
.ed-status {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  align-self: flex-start;
  padding: .35rem .8rem;
  font-size: .8rem;
  font-weight: 600;
  color: #1f9d55;
  background: rgba(31, 157, 85, .1);
  border-radius: 999px;
}
.ed-status span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

#editor-view, #editor-form { display: flex; flex-direction: column; gap: 1.2rem; }
#editor-view[hidden], #editor-form[hidden], .ed-group[hidden] { display: none; }

.ed-group { display: flex; flex-direction: column; gap: .9rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
#editor-view .ed-group:first-child { padding-top: 0; border-top: 0; }
.ed-group__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.ed-label {
  display: block;
  margin-bottom: .35rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ed-read p { font-size: .95rem; line-height: 1.5; }
.ed-help { display: block; margin-top: .35rem; font-size: .78rem; color: var(--text-muted); }
.muted { color: var(--text-muted); font-style: italic; }
.red { color: var(--red); }

.ed-field input[type="text"],
.ed-field input[type="date"],
.ed-field input[type="number"],
.ed-field input[type="tel"],
.ed-field input[type="email"],
.ed-field textarea {
  width: 100%;
  padding: .7rem .95rem;
  font: inherit;
  font-size: .95rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  resize: vertical;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.ed-field input:focus,
.ed-field textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(198, 27, 24, .15); }
.ed-title { display: grid; gap: .4rem; }
.ed-field .ed-title input.is-red { color: var(--red); font-weight: 600; }

/* Imágenes */
.ed-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.ed-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; }
.ed-thumb figcaption { margin-top: .35rem; font-size: .75rem; color: var(--text-muted); }
.ed-image__box { position: relative; overflow: hidden; border-radius: 18px; }
.ed-image__box img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.ed-image__change {
  position: absolute;
  right: .6rem;
  bottom: .6rem;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem .9rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--white);
  background: rgba(10, 10, 10, .78);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .2s;
}
.ed-image__change:hover { background: var(--red); }
.ed-image__change svg { width: 16px; height: 16px; }

/* Lo que se edita en otro módulo */
.locked-note {
  display: flex;
  gap: .6rem;
  padding: .75rem .9rem;
  font-size: .85rem;
  line-height: 1.45;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 14px;
}
.locked-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: .1rem; }
.locked-note a { font-weight: 600; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.locked-note a:hover { color: var(--red); }

/* Aviso flotante */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 80;
  padding: .8rem 1.3rem;
  font-weight: 600;
  font-size: .92rem;
  color: var(--white);
  background: var(--ink);
  border-left: 3px solid var(--red);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: toast-in .35s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- Tablet y móvil: vista previa arriba, panel debajo ---------- */
@media (max-width: 1100px) {
  .editor { height: auto; min-height: 0; }
  .editor__grid { grid-template-columns: 1fr; }
  .preview { height: 62vh; }
  .ed-panel { overflow: visible; }
}
@media (max-width: 700px) {
  .preview__label, .preview__size { display: none; }
  .preview__bar { justify-content: space-between; }
  .toast { bottom: 5.5rem; }
}

/* ==========================================================
   LISTADOS — cabecera + datatable
   ========================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1.2rem, 2.5vw, 1.8rem);
}

.dt {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(10px);
}

/* Barra de búsqueda y filtros */
.dt__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .7rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.dt__search {
  position: relative;
  flex: 1 1 260px;
  max-width: 380px;
}
.dt__search svg { position: absolute; left: .95rem; top: 50%; width: 18px; height: 18px; color: var(--text-muted); transform: translateY(-50%); }
.dt__search input,
.dt__select select {
  width: 100%;
  height: 42px;
  font: inherit;
  font-size: .92rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color .2s, box-shadow .2s;
}
.dt__search input { padding: 0 1rem 0 2.6rem; }
.dt__search input:focus,
.dt__select select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(198, 27, 24, .15); }
.dt__select { margin-left: auto; }
.dt__select select {
  padding: 0 2.4rem 0 1rem;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .9rem center;
  background-size: 16px;
}
.dt__select option { color: #141414; }

/* Tabla */
.dt__scroll { overflow-x: auto; }
.dt__table { width: 100%; min-width: 860px; border-collapse: collapse; }
.dt__table th {
  padding: .8rem 1.1rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.dt__table th button {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
/* flecha de orden */
.dt__table th button::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: .3;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .25s, opacity .2s;
}
.dt__table th button:hover { color: var(--text); }
.dt__table th button.is-sorted { color: var(--text); }
.dt__table th button.is-sorted::after { opacity: 1; border-color: var(--red); }
.dt__table th button[aria-sort="ascending"]::after { transform: translateY(2px) rotate(225deg); }

.dt__table td {
  padding: .8rem 1.1rem;
  font-size: .92rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.dt__table tbody tr { transition: background-color .2s; }
.dt__table tbody tr:hover { background: var(--hover); }
.dt__table tbody tr:last-child td { border-bottom: 0; }
.dt__empty { padding: 3rem 1rem !important; text-align: center; color: var(--text-muted); }

.dt-race { display: flex; align-items: center; gap: .9rem; }
.dt-race img {
  flex-shrink: 0;
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 12px;
  filter: grayscale(1) contrast(1.1) brightness(.8);
  transition: filter .3s;
}
.dt__table tr:hover .dt-race img { filter: none; }
.dt-race strong { display: block; font-weight: 600; font-size: .98rem; }
.dt-race span { display: inline-flex; align-items: center; gap: .3rem; margin-top: .15rem; font-size: .82rem; color: var(--text-muted); }
.dt-race span svg { width: 13px; height: 13px; }

/* Fecha con el estilo del calendario de la web */
.dt-date { display: flex; align-items: center; gap: .45rem; }
.dt-date b { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 1.7rem; line-height: 1; }
.dt-date span { font-family: var(--font-display); font-weight: 700; font-size: .7rem; line-height: 1.05; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }
.dt-sub { display: block; margin-top: .15rem; font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.dt-num { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }

/* Etiquetas */
.chip {
  display: inline-block;
  padding: .3rem .7rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-radius: 999px;
  background: var(--surface-2);
}
.chip--mtb { color: var(--red); background: rgba(198, 27, 24, .1); }
.chip--gravel { color: #a86b1d; background: rgba(214, 150, 60, .14); }
.chip--road { color: #2d6fb0; background: rgba(60, 130, 200, .13); }

.status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--finalizada { color: var(--text-muted); background: var(--surface-2); }
.status--curso { color: #1f9d55; background: rgba(31, 157, 85, .12); }
.status--curso::before { animation: pulse 1.6s infinite; }
.status--proxima { color: #2d6fb0; background: rgba(60, 130, 200, .13); }
@keyframes pulse { 50% { opacity: .3; } }

/* Interruptor */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background-color .25s;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .25s var(--ease);
}
.switch input:checked + span { background: var(--red); border-color: var(--red); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(198, 27, 24, .25); }

.dt__actions { white-space: nowrap; text-align: right; }
.dt__actions .round-btn { display: inline-grid; margin-left: .3rem; }
.dt__actions .round-btn:hover { color: var(--white); background: var(--red); border-color: var(--red); }
.dt__actions-col { width: 1%; }

/* Pie: info + paginación */
.dt__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .9rem 1.1rem;
  border-top: 1px solid var(--border);
}
.dt__info { font-size: .85rem; color: var(--text-muted); }
.dt__pager { display: flex; gap: .3rem; }
.pager-btn {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 .5rem;
  font: 600 .88rem var(--font-ui);
  color: var(--text);
  background: var(--surface-2);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.pager-btn svg { width: 16px; height: 16px; }
.pager-btn:hover:not(:disabled) { background: var(--hover); }
.pager-btn.is-active { color: var(--pill-active-text); background: var(--pill-active-bg); }
.pager-btn:disabled { opacity: .35; cursor: default; }

@media (max-width: 700px) {
  .dt__search { max-width: none; }
  .dt__select { margin-left: 0; flex: 1; }
}

/* ==========================================================
   MODAL (alta de carrera y futuros)
   ========================================================== */
.modal {
  width: min(720px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 0;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .35);
  overflow: hidden;
}
.modal[open] { animation: modal-in .35s var(--ease); }
.modal::backdrop { background: rgba(10, 10, 10, .55); backdrop-filter: blur(4px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.modal__box { display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
.modal__head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 1.5rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.modal__head::after {
  content: "";
  position: absolute;
  left: 1.5rem;
  bottom: -2px;
  width: 64px;
  height: 3px;
  background: var(--red-grad);
  transform: skewX(var(--skew));
}
.modal__title {
  margin-top: .2rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2rem;
  line-height: .95;
  text-transform: uppercase;
}
.modal__title em {
  background: var(--red-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: .08em;
}

.modal__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.1rem;
  padding: 1.3rem 1.5rem;
  overflow-y: auto;
}
.mf { min-width: 0; margin: 0; padding: 0; border: 0; }
.mf--full { grid-column: 1 / -1; }
.mf[hidden] { display: none; }
.ed-label small { font-family: var(--font-body); font-weight: 500; letter-spacing: 0; text-transform: none; }
.mf__error { display: block; min-height: 0; margin-top: .3rem; font-size: .8rem; color: var(--red); }
.mf__error:empty { display: none; }
.ed-field .is-invalid { border-color: var(--red) !important; }
.mf .dt__select { display: block; margin: 0; }
.mf .dt__select select { border-radius: 14px; height: 46px; }
.ed-field input[type="date"] { min-height: 46px; color-scheme: light; }
:root[data-theme="dark"] .ed-field input[type="date"] { color-scheme: dark; }

/* Opciones en tarjeta (modalidad) o píldora (formato, recorrido) */
.pick { display: flex; gap: .5rem; }
.pick--3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.pick__opt { position: relative; flex: 1; cursor: pointer; }
.pick__opt input { position: absolute; opacity: 0; pointer-events: none; }
.pick__opt span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  height: 100%;
  padding: 1rem .6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  transition: color .2s, background-color .2s, border-color .2s, box-shadow .2s;
}
.pick__opt svg { width: 30px; height: 30px; }
.pick__opt:hover span { color: var(--text); }
.pick__opt input:checked + span { color: var(--red); background: rgba(198, 27, 24, .08); border-color: var(--red); box-shadow: 0 0 0 3px rgba(198, 27, 24, .12); }
.pick__opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(198, 27, 24, .3); }
.pick__opt--sm span {
  flex-direction: row;
  min-height: 46px;
  padding: 0 .9rem;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .9rem;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 14px;
}

.modal__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem 1.3rem;
  border-top: 1px solid var(--border);
}
.modal__note { display: flex; gap: .55rem; max-width: 360px; font-size: .82rem; line-height: 1.45; color: var(--text-muted); }
.modal__note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: .05rem; }
.modal__note strong { color: var(--text); }
.modal__btns { display: flex; gap: .5rem; margin-left: auto; }

/* Fila recién creada en la tabla */
.dt-race .dt-race__ph {   /* .dt-race delante: gana a ".dt-race span" (que lo dejaba alineado a la izquierda) */
  display: grid;
  place-items: center;
  margin-top: 0;
  flex-shrink: 0;
  width: 64px;
  height: 48px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.dt-race__ph svg { width: 20px; height: 20px; }
.dt-new {
  margin-left: .4rem;
  padding: .12rem .5rem;
  font-style: normal;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--red-grad);
  border-radius: 999px;
  vertical-align: middle;
}
.dt__table tbody tr.is-new { animation: row-new 2.4s ease-out; }
@keyframes row-new { from { background: rgba(198, 27, 24, .18); } }
.round-btn.is-off { opacity: .3; cursor: not-allowed; }
.dt__actions .round-btn.is-off:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }

@media (max-width: 600px) {
  .modal__body { grid-template-columns: 1fr; }
  .pick__opt span { font-size: .95rem; padding: .8rem .4rem; }
  .modal__btns { width: 100%; }
  .modal__btns .btn-pill { flex: 1; justify-content: center; }
}

/* ==========================================================
   FICHA DE CARRERA — extras del panel
   ========================================================== */
.editor__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .6rem; }
.editor__meta-txt { font-size: .9rem; color: var(--text-muted); }
.ed-status.is-off { color: var(--text-muted); background: var(--surface-2); }

.ed-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.ed-row--price { grid-template-columns: 1fr 110px; }
.ed-field .dt__select { display: block; margin: 0; }
.ed-field .dt__select select { height: 46px; border-radius: 14px; }
.ed-para { font-size: .92rem; line-height: 1.55; color: var(--text-muted); }

.ed-plans { display: grid; gap: .4rem; list-style: none; }
.ed-plans li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .7rem .9rem;
  font-size: .92rem;
  background: var(--surface-2);
  border-radius: 14px;
}
.ed-plans b { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }

.ed-plans-form { display: grid; gap: .8rem; }
.plan-card {
  display: grid;
  gap: .7rem;
  padding: .9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px;
}
.plan-card .ed-field input,
.plan-card .ed-field textarea { background: var(--surface-solid); }
.plan-card__head { display: flex; align-items: center; justify-content: space-between; }
.plan-card__n {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--white);
  background: var(--red-grad);
  border-radius: 50%;
}
.plan-card__head .round-btn:hover { color: var(--white); background: var(--red); border-color: var(--red); }
.check-row { display: inline-flex; align-items: center; gap: .55rem; font-size: .88rem; cursor: pointer; }
.check-row input { width: 17px; height: 17px; accent-color: var(--red); }
.ed-add { align-self: flex-start; }

.ed-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  background: var(--surface-2);
  border-radius: 16px;
  cursor: pointer;
}
.ed-toggle strong { display: block; font-size: .95rem; }
.ed-toggle small { display: block; margin-top: .15rem; font-size: .8rem; color: var(--text-muted); }
/* Pestañas del panel: caben 4 en el ancho del panel */
.ed-panel .seg button { padding: 0 .4rem; letter-spacing: .08em; }

/* ==========================================================
   PRODUCTOS — extras del listado
   ========================================================== */
/* Fotos de producto recortadas sobre blanco (como product__media--contain de la web) */
.dt-race img.is-contain { object-fit: contain; padding: 3px; background: #fff; }

/* Categorías de la tienda */
.chip--ocasion { color: #a86b1d; background: rgba(214, 150, 60, .14); }
.chip--ofertas { color: var(--red); background: rgba(198, 27, 24, .1); }
.chip--componentes { color: #2d6fb0; background: rgba(60, 130, 200, .13); }
.chip--equipamiento { color: #1f9d55; background: rgba(31, 157, 85, .12); }
.chip--electronica { color: #7a4fc4; background: rgba(122, 79, 196, .13); }
.chip--ropa { color: var(--text-muted); background: var(--surface-2); }

/* Descuento: mismo corte en cuña que el badge de la web */
.dt-dto {
  display: inline-block;
  padding: .2rem .55rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  font-size: .95rem;
  color: var(--white);
  background: var(--red-grad);
  border-radius: 6px;
  transform: skewX(var(--skew));
}

/* Filtros de categoría: píndolas .seg con las etiquetas de grupo de la tienda (Bicis / Accesorios) */
.seg--cats { flex-wrap: wrap; align-items: center; }
.seg--cats button { flex: 0 0 auto; }
.seg__group {
  margin: 0 .15rem 0 .7rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--red);
}
#dt-productos .dt__search { margin-left: auto; }

@media (max-width: 700px) {
  .seg--cats { border-radius: 18px; }
  #dt-productos .dt__search { margin-left: 0; max-width: none; }
}

/* Producto sin foto: logo de The Doc atenuado */
.dt-race .dt-race__ph--logo { border-style: solid; }
.dt-race .dt-race__ph--logo img {
  width: 30px;
  height: auto;
  border-radius: 0;
  object-fit: contain;
  filter: var(--logo-filter);
  opacity: .22;
}
.dt__table tr:hover .dt-race__ph--logo img { filter: var(--logo-filter); }

/* ==========================================================
   FICHA DE PRODUCTO — extras del panel
   ========================================================== */
.editor__meta .dt-dto { font-size: .85rem; }

/* Características (vista de lectura) */
.ed-specs { display: grid; gap: .35rem; padding-left: 1.1rem; font-size: .92rem; line-height: 1.45; color: var(--text-muted); }
.ed-specs li::marker { color: var(--red); }

/* Tallas: disponibles en sólido, el resto tachadas */
.ed-sizes { display: flex; flex-wrap: wrap; gap: .35rem; }
.ed-sizes span {
  min-width: 38px;
  padding: .3rem .6rem;
  font-family: var(--font-display);
  font-weight: 700;
  text-align: center;
  color: var(--text-muted);
  text-decoration: line-through;
  background: var(--surface-2);
  border-radius: 10px;
}
.ed-sizes span.is-on { color: var(--pill-active-text); text-decoration: none; background: var(--pill-active-bg); }
.pick--sizes { flex-wrap: wrap; }
.pick--sizes .pick__opt { flex: 0 0 auto; min-width: 58px; }

/* Galería */
.gal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; list-style: none; }
.gal li {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: opacity .2s, box-shadow .2s;
}
.gal li[draggable="true"] { cursor: grab; }
.gal li img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.gal li:first-child[data-i] { box-shadow: 0 0 0 2px var(--red); }
.gal li.is-dragging { opacity: .35; }
.gal li.is-over { box-shadow: 0 0 0 2px var(--red), 0 0 0 6px rgba(198, 27, 24, .18); }
.gal__main, .gal__n {
  position: absolute;
  top: .4rem;
  left: .4rem;
  padding: .12rem .5rem;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--white);
  background: rgba(10, 10, 10, .7);
  border-radius: 999px;
}
.gal__main { background: var(--red-grad); }
.gal__tools {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: center;
  gap: .25rem;
  padding: .35rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55));
  opacity: 0;
  transition: opacity .2s;
}
.gal li:hover .gal__tools, .gal li:focus-within .gal__tools { opacity: 1; }
.gal__tools .round-btn { width: 28px; height: 28px; background: var(--surface-solid); }
.gal__tools .round-btn svg { width: 15px; height: 15px; }
.gal__tools .round-btn:disabled { opacity: .35; cursor: default; }
.gal__tools .gal__del:hover { color: var(--white); background: var(--red); border-color: var(--red); }
.gal__add { background: var(--surface-2) !important; border-style: dashed !important; }
.gal__add label {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: .3rem;
  height: 100%;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .2s;
}
.gal__add label:hover { color: var(--red); }
.gal__add svg { width: 22px; height: 22px; }
.gal--read { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gal--read li:first-child { box-shadow: 0 0 0 2px var(--red); }

/* ==========================================================
   MARCAS — extras del listado
   ========================================================== */
/* Los logos son blancos (como en la web): siempre sobre fondo oscuro */
.logo-tile {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 150px;
  height: 54px;
  padding: 0 .8rem;
  background: var(--black);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
}
.logo-tile img { max-width: 100%; width: auto; object-fit: contain; opacity: .85; transition: opacity .3s; }
.logo-tile b { font-family: var(--font-display); font-weight: 800; font-size: .9rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .45); }
.dt__table tr:hover .logo-tile img { opacity: 1; }
.dt__table tr[data-off] .logo-tile { opacity: .45; }

.dt-brand { display: flex; align-items: center; gap: 1rem; }
.dt-brand strong { font-weight: 600; font-size: .98rem; }

.dt-order { display: flex; align-items: center; gap: .5rem; }
.dt-order .dt-num { min-width: 1.2rem; }

/* Reordenar arrastrando: asa, fila arrastrada y línea roja donde caerá */
.dt-grip {
  display: grid;
  place-items: center;
  width: 26px;
  height: 34px;
  padding: 0;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: grab;
  transition: color .2s, background-color .2s;
}
.dt-grip svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.dt-grip:hover, .dt-grip:focus-visible { color: var(--red); background: var(--surface-2); outline: none; }
.dt-grip.is-off { opacity: .25; cursor: not-allowed; }
.dt-grip { touch-action: none; }   /* en táctil se arrastra desde el asa; el resto de la fila hace scroll */
.dt__table tr[data-drag] { cursor: grab; user-select: none; }
.dt__table tr.is-dragging {
  position: relative;
  z-index: 2;
  cursor: grabbing;
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}
.dt__table tr.is-dragging td { border-bottom-color: transparent; }
.is-reordering, .is-reordering * { cursor: grabbing !important; }
.dt__table tr.is-drop-before td { box-shadow: inset 0 3px 0 var(--red); }
.dt__table tr.is-drop-after td { box-shadow: inset 0 -3px 0 var(--red); }
.dt__table tbody tr.is-moved { animation: row-new 1.6s ease-out; }

.dt-pages { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.dt-pages span {
  padding: .22rem .6rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 999px;
}

/* Alta: zona para subir el logo */
.logo-drop {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .7rem;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color .2s;
}
.logo-drop:hover { border-color: var(--red); }
.logo-drop__txt { font-size: .82rem; line-height: 1.45; color: var(--text-muted); }
.logo-tile--lg { width: 180px; height: 70px; }
.logo-tile--lg img { max-height: 46px; }
.logo-tile img { -webkit-user-drag: none; user-select: none; }

/* ==========================================================
   CLIENTES — extras del listado
   ========================================================== */
.dt-client { display: flex; align-items: center; gap: .85rem; }
.dt-client strong { display: block; font-weight: 600; font-size: .98rem; white-space: nowrap; }
.dt-client span:not(.dt-avatar):not(.dt-club) { display: block; margin-top: .1rem; font-size: .82rem; color: var(--text-muted); }
.dt-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .04em;
  border-radius: 50%;
}
.dt-avatar--0 { color: var(--white); background: var(--red-grad); }
.dt-avatar--1 { color: #2d6fb0; background: rgba(60, 130, 200, .14); }
.dt-avatar--2 { color: #a86b1d; background: rgba(214, 150, 60, .16); }
.dt-avatar--3 { color: var(--pill-active-text); background: var(--pill-active-bg); }
.dt__table tr[data-off] .dt-avatar { opacity: .45; }
.dt-club {
  margin-left: .3rem;
  padding: .1rem .45rem;
  font-family: var(--font-display);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--red);
  border: 1px solid rgba(198, 27, 24, .35);
  border-radius: 999px;
  vertical-align: middle;
}
.dt-nowrap { white-space: nowrap; }
.dt-sub--inline { display: inline; margin: 0 0 0 .2rem; }

.status--activo { color: #1f9d55; background: rgba(31, 157, 85, .12); }
.status--pendiente { color: #a86b1d; background: rgba(214, 150, 60, .14); }
.status--baja { color: var(--text-muted); background: var(--surface-2); }
.seg button { white-space: nowrap; }   /* "Sin verificar" en una línea */

/* ==========================================================
   OPORTUNIDADES — embudo, estados y extras del listado
   ========================================================== */
/* Colores de cada estado (embudo, selector de la tabla) */
.st--nuevo, .pipe .pipe__card--nuevo { --st: #2d6fb0; --st-bg: rgba(60, 130, 200, .13); }
.st--contactado, .pipe .pipe__card--contactado { --st: #13867f; --st-bg: rgba(19, 134, 127, .12); }
.st--cualificado, .pipe .pipe__card--cualificado { --st: #a86b1d; --st-bg: rgba(214, 150, 60, .15); }
.st--presupuesto, .pipe .pipe__card--presupuesto { --st: #7a4fc4; --st-bg: rgba(122, 79, 196, .13); }
.st--negociacion, .pipe .pipe__card--negociacion { --st: #d1661a; --st-bg: rgba(230, 120, 40, .14); }
.st--ganada, .pipe .pipe__card--ganada { --st: #1f9d55; --st-bg: rgba(31, 157, 85, .13); }
.st--perdida, .pipe .pipe__card--perdida { --st: var(--red); --st-bg: rgba(198, 27, 24, .1); }
.st--pausa, .pipe .pipe__card--pausa { --st: #8a8b86; --st-bg: rgba(138, 139, 134, .13); }

/* Embudo: tarjetas tintadas con el color de su estado */
.pipe { display: flex; gap: 1.2rem; margin-bottom: 1.2rem; overflow-x: auto; padding: .2rem .1rem .5rem; }
.pipe__group { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.pipe__group--total { flex: 2 0 240px; }
.pipe__group--flow { flex: 5 0 600px; }
.pipe__group--closed { flex: 3 0 360px; }
.pipe__title {
  padding-left: .2rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pipe__cards { display: flex; gap: .5rem; flex: 1; }
.pipe__card {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 108px;
  padding: .8rem .9rem .75rem;
  overflow: hidden;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--st-bg);
  border: 1.5px solid transparent;
  border-radius: 18px;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
/* franja de color arriba */
.pipe__card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--st); opacity: .85; }
.pipe__card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .08); }
.pipe__card.is-active { border-color: var(--st); box-shadow: 0 0 0 3px var(--st-bg), 0 10px 24px rgba(0, 0, 0, .08); }
.pipe__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--st);
}
.pipe__n { margin-top: .2rem; font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 2.3rem; line-height: 1; color: var(--st); }
.pipe__sum { margin-top: .15rem; font-size: .82rem; font-weight: 600; color: var(--text); opacity: .75; white-space: nowrap; }
.pipe__bar { width: 100%; height: 5px; margin-top: .6rem; background: rgba(127, 127, 127, .16); border-radius: 999px; overflow: hidden; }
.pipe__bar i { display: block; height: 100%; background: var(--st); border-radius: inherit; transition: width .4s var(--ease); }

/* Resumen: Todas en negro / blanco, Abiertas en rojo de marca */
.pipe__card--todas { --st: var(--pill-active-text); --st-bg: var(--pill-active-bg); color: var(--pill-active-text); }
.pipe__card--abiertas { --st: var(--white); --st-bg: var(--red-grad); color: var(--white); background: var(--red-grad); }
.pipe__card--todas::before, .pipe__card--abiertas::before { display: none; }
.pipe__card--todas .pipe__sum, .pipe__card--abiertas .pipe__sum { color: inherit; }
.pipe__card--todas .pipe__bar, .pipe__card--abiertas .pipe__bar { background: rgba(255, 255, 255, .22); }
:root[data-theme="dark"] .pipe__card--todas .pipe__bar { background: rgba(0, 0, 0, .15); }
.pipe__card--todas.is-active, .pipe__card--abiertas.is-active { border-color: transparent; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--red); }

/* Estado: selector con forma de pastilla */
.st { position: relative; display: inline-flex; }
.st select {
  appearance: none;
  -webkit-appearance: none;
  padding: .32rem 1.7rem .32rem .75rem;
  font: 600 .8rem/1.2 var(--font-ui);
  color: var(--st);
  background: var(--st-bg);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s;
}
.st select:hover, .st select:focus-visible { border-color: var(--st); outline: none; }
.st select option, .st select optgroup { color: #141414; font-weight: 500; }
.st::after {
  content: "";
  position: absolute;
  right: .7rem;
  top: 50%;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid var(--st);
  border-bottom: 1.5px solid var(--st);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* Celdas */
.dt-op strong { display: block; max-width: 340px; font-weight: 600; font-size: .95rem; line-height: 1.3; }
.dt-op span { display: block; margin-top: .15rem; font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.dt-origin { display: inline-flex; align-items: center; gap: .4rem; font-size: .86rem; white-space: nowrap; }
.dt-origin svg { width: 16px; height: 16px; color: var(--text-muted); }
.dt-follow { font-weight: 600; font-size: .88rem; }
.dt-follow--late { color: var(--red); }
.dt-follow--today { color: #d1661a; }
.dt-follow--ok { color: #1f9d55; }
.dt__table tr[data-closed] .dt-op strong, .dt__table tr[data-closed] .dt-num { color: var(--text-muted); }

.chip--tipo-taller { color: #2d6fb0; background: rgba(60, 130, 200, .13); }
.chip--tipo-montaje { color: var(--red); background: rgba(198, 27, 24, .1); }
.chip--tipo-formulario { color: #a86b1d; background: rgba(214, 150, 60, .14); }
.chip--tipo-otros { color: var(--text-muted); background: var(--surface-2); }

/* Modal pequeño: perdida / en pausa */
.modal--sm { width: min(480px, calc(100vw - 2rem)); }
.modal--sm .modal__body { grid-template-columns: 1fr; }
.pick--motivos { flex-wrap: wrap; }
.pick--motivos .pick__opt { flex: 0 0 auto; }

/* ==========================================================
   OPORTUNIDADES — vista Kanban
   ========================================================== */
.dt__view { margin-left: auto; }
.dt__view button { display: inline-flex; align-items: center; gap: .35rem; }
.dt__view svg { width: 15px; height: 15px; }
.dt.is-kanban .dt__scroll, .dt.is-kanban .dt__foot { display: none; }

.kb {
  display: flex;
  align-items: stretch;   /* columnas a toda la altura: se puede soltar en cualquier punto */
  gap: .75rem;
  padding: 1rem 1.1rem 1.2rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}
.kb[hidden], .pipe[hidden] { display: none; }

.kb-col {
  flex: 0 0 272px;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: .55rem;
  background: var(--st-bg);
  border: 1.5px solid transparent;
  border-radius: 20px;
  scroll-snap-align: start;
  transition: border-color .2s, box-shadow .2s, opacity .3s;
}
.kb-col.is-over { border-color: var(--st); box-shadow: 0 0 0 4px var(--st-bg); }

.kb-col__head {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .1rem .5rem;
  padding: .7rem .7rem .55rem;
  overflow: hidden;
  background: var(--surface-solid);
  border-radius: 14px;
}
.kb-col__head::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--st); }
.kb-col__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--st);
  white-space: nowrap;
}
.kb-col__n {
  grid-row: span 2;
  align-self: center;
  min-width: 34px;
  padding: .1rem .5rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  font-size: 1.3rem;
  text-align: center;
  color: var(--st);
  background: var(--st-bg);
  border-radius: 10px;
}
.kb-col__sum { font-size: .78rem; font-weight: 600; color: var(--text-muted); }

.kb-list { flex: 1; display: flex; flex-direction: column; gap: .5rem; min-height: 70px; }
.kb-empty {
  display: grid;
  place-items: center;
  min-height: 70px;
  font-size: .8rem;
  color: var(--text-muted);
  border: 1.5px dashed rgba(127, 127, 127, .3);
  border-radius: 14px;
}

.kb-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: .75rem .8rem .7rem;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
  cursor: grab;
  user-select: none;
  touch-action: pan-y;   /* en táctil: deslizar en vertical hace scroll; en horizontal, arrastra */
  transition: box-shadow .2s, transform .2s var(--ease);
}
/* franja del color del estado arriba, de extremo a extremo (como las tarjetas del embudo) */
.kb-card { overflow: hidden; }
.kb-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--st); }
.kb-card:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, .1); transform: translateY(-1px); }
.kb-card:focus-visible { outline: 2px solid var(--st); outline-offset: 2px; }
.kb-card.is-new { animation: row-new 2.4s ease-out; }
.kb-card.is-placeholder { opacity: .3; }
.kb-card__top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.kb-card__top .chip { padding: .2rem .55rem; font-size: .68rem; }
.kb-card__val { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.kb-card__title { font-family: var(--font-body); font-weight: 600; font-size: .9rem; line-height: 1.3; }
.kb-card__who { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--text-muted); }
.kb-card__who .dt-origin svg { width: 14px; height: 14px; }
.kb-card__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; padding-top: .4rem; border-top: 1px solid var(--border); }
.kb-card__follow { min-width: 0; font-size: .82rem; }
.kb-card__follow .dt-follow { font-size: .82rem; }
.kb-card__follow .dt-sub { white-space: normal; }
.kb-card__acts { display: flex; gap: .25rem; flex-shrink: 0; }
.kb-card__acts .round-btn { width: 30px; height: 30px; }
.kb-card__acts .round-btn svg { width: 15px; height: 15px; }
.kb-col[data-col="ganada"] .kb-card, .kb-col[data-col="perdida"] .kb-card { opacity: .85; }

/* Tarjeta que sigue al cursor */
.kb-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  cursor: grabbing;
  transform: rotate(2.5deg) scale(1.02);
  box-shadow: var(--shadow);
}

.kb-more {
  padding: .5rem;
  font: 600 .78rem/1.2 var(--font-ui);
  color: var(--st);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.kb-more:hover { background: var(--surface-solid); }

@media (max-width: 700px) {
  .dt__view { margin-left: 0; }
  .kb { padding: .8rem; }
  .kb-col { flex-basis: calc(100% - 1.2rem); }
}

/* Clientes: alta manual */
.dt-invite { font-weight: 600; font-size: .88rem; color: #2d6fb0; }
.mf--check { display: flex; align-items: flex-end; padding-bottom: .7rem; }

/* Barra de iconos: en pantallas bajas (portátiles pequeños) se compacta para que quepa entera */
@media (min-width: 701px) and (max-height: 760px) {
  .rail { gap: .2rem; padding: .4rem; }
  .rail__link { width: 36px; height: 36px; }
  .rail__link svg { width: 17px; height: 17px; }
  .rail__sep { margin: .15rem 0; }
}

/* ==========================================================
   VENTAS — listado, tiquet de reparación y factura simplificada
   ========================================================== */
.chip--venta-tienda { color: #1f9d55; background: rgba(31, 157, 85, .12); }
.chip--venta-servicio { color: #a86b1d; background: rgba(214, 150, 60, .14); }
.chip--venta-reparacion { color: var(--red); background: rgba(198, 27, 24, .1); }
.dt-numdoc { font-family: var(--font-display); font-weight: 700; font-size: .95rem; letter-spacing: .04em; }


/* Líneas del tiquet (página Nuevo tiquet) */
.tl-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.tl-iva { font-size: .82rem; color: var(--text-muted); }
.tl-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; }
.tl { width: 100%; min-width: 640px; border-collapse: collapse; table-layout: fixed; }
.tl__c-cant { width: 76px; }
.tl__c-precio { width: 108px; }
.tl__c-dto { width: 84px; }
.tl__c-iva { width: 92px; }
.tl__c-imp { width: 110px; }
.tl__c-del { width: 52px; }
.tl th {
  padding: .55rem .5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-muted);
  background: var(--surface-2);
}
.tl td { padding: .35rem .3rem; border-top: 1px solid var(--border); vertical-align: middle; }
.tl td:first-child, .tl th:first-child { padding-left: .6rem; }
.tl td:last-child { padding-right: .5rem; text-align: right; }
.tl__concepto { min-width: 0; }
.tl th.tl__num { text-align: right; }
.tl input, .tl select {
  width: 100%;
  height: 38px;
  padding: 0 .55rem;
  font: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 10px;
}
.tl td.tl__num input { text-align: right; }
.tl th.tl__num, .tl td.tl__num { padding-left: .4rem; padding-right: .4rem; }
.tl input:focus, .tl select:focus { outline: none; border-color: var(--red); background: var(--surface-solid); }
.tl input.is-invalid { border-color: var(--red); background: rgba(198, 27, 24, .06); }
.tl__imp { font-weight: 600; text-align: right; white-space: nowrap; }
.tl .round-btn:hover { color: var(--white); background: var(--red); border-color: var(--red); }

.pick--pago { flex-wrap: wrap; }
.pick--pago .pick__opt { flex: 1 0 auto; }

/* Totales del tiquet */
.ticket__totals { display: grid; gap: .35rem; margin: 0; }
.ticket__totals > div { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }

/* Factura simplificada: papel blanco en los dos temas */
.modal--ticket { width: min(520px, calc(100vw - 2rem)); }
.modal__body--ticket { display: block; background: var(--surface-2); }
.ticket {
  display: grid;
  gap: 1rem;
  padding: 1.6rem 1.5rem 1.3rem;
  font-size: .86rem;
  color: #141414;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}
.ticket__head { display: grid; justify-items: center; gap: .15rem; text-align: center; color: #555; font-size: .78rem; }
.ticket__brand { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 1.6rem; color: #141414; letter-spacing: .02em; }
.ticket__brand em { font-size: .9rem; color: var(--red); }
.ticket__doc, .ticket__who { display: grid; gap: .1rem; padding: .7rem 0; border-top: 1px dashed #ccc; }
.ticket__doc b { font-family: var(--font-display); font-size: 1rem; letter-spacing: .12em; text-transform: uppercase; }
.ticket__doc span, .ticket__who span { color: #555; }
.ticket__who > span:first-child { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: #888; }
.ticket__race { color: var(--red) !important; font-weight: 600; }
.ticket__lines { width: 100%; border-collapse: collapse; }
.ticket__lines th { padding: .4rem 0 .4rem .5rem; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: #888; text-align: right; border-bottom: 1px solid #ddd; }
.ticket__lines th:first-child { padding-left: 0; text-align: left; }
.ticket__lines td { padding: .45rem 0 .45rem .4rem; text-align: right; vertical-align: top; border-bottom: 1px dashed #e3e3e3; white-space: nowrap; }
.ticket__lines td:first-child { padding-left: 0; text-align: left; white-space: normal; }
.ticket__lines small { display: block; font-size: .72rem; color: #888; }
.ticket__totals dt { color: #555; }
.ticket__totals dd { margin: 0; white-space: nowrap; }
.ticket__totals .is-tax { font-size: .78rem; }
.ticket__totals .is-tax dt, .ticket__totals .is-tax dd { color: #888; }
.ticket__totals .is-total { margin-top: .3rem; padding-top: .6rem; border-top: 2px solid #141414; }
.ticket__totals .is-total dt { font-weight: 700; color: #141414; text-transform: uppercase; letter-spacing: .06em; }
.ticket__totals .is-total dd { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; }
.ticket__pay { padding: .5rem .7rem; font-weight: 600; text-align: center; background: #f3f3f1; border-radius: 6px; }
.ticket__notes { font-size: .8rem; font-style: italic; color: #555; }
.ticket__foot { padding-top: .6rem; font-size: .76rem; text-align: center; color: #888; border-top: 1px dashed #ccc; }
.ticket-cobro { display: flex; align-items: center; gap: .5rem; }
.ticket-cobro .dt__select { margin: 0; }


/* Imprimir: solo el tiquet */
@media print {
  body * { visibility: hidden !important; }
  #modal-ticket, #modal-ticket .ticket, #modal-ticket .ticket * { visibility: visible !important; }
  #modal-ticket { position: absolute; inset: 0; width: auto; max-height: none; border: 0; box-shadow: none; background: #fff; }
  #modal-ticket::backdrop { background: #fff; }
  #modal-ticket .ticket { box-shadow: none; max-width: 80mm; margin: 0 auto; padding: 0; }
}

/* ==========================================================
   NUEVO TIQUET — página
   ========================================================== */
.tk { display: flex; flex-direction: column; gap: 1rem; }
.tk .back-link { align-self: flex-start; }
.tk-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.tk-head .eyebrow { display: block; margin-bottom: .3rem; }
.tk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; align-items: start; gap: 1.2rem; }
.tk-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.tk-card {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding: 1.3rem 1.4rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
}
.tk-card__title {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tk-card__title span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: .85rem;
  color: var(--white);
  background: var(--red-grad);
  border-radius: 50%;
}
.tk-card .tl-head { margin-bottom: 0; }
.tk-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.1rem; }
.tk-fields textarea { min-height: 0; }

/* Cliente elegido */
.tk-client {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .6rem;
  padding: .65rem .8rem;
  background: var(--surface-2);
  border-radius: 14px;
}
.tk-client[hidden] { display: none; }
.tk-client strong { display: block; font-size: .95rem; }
.tk-client small { display: block; font-size: .8rem; color: var(--text-muted); }

.tl-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }

/* Vista previa a la derecha, fija al hacer scroll */
.tk-side { position: sticky; top: calc(var(--nav-h) + 1rem); }
.tk-side__inner {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  padding: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.tk-side .ticket { max-height: calc(100vh - var(--nav-h) - 9rem); overflow-y: auto; }
.tk-side__btns { display: flex; gap: .5rem; }
.tk-side__btns .btn-pill { flex: 1; justify-content: center; }
.tk-side__btns [hidden], .editor__actions [hidden] { display: none; }
.btn-pill svg { flex-shrink: 0; }
.ticket__empty { color: #aaa !important; font-style: italic; }

@media (max-width: 1100px) {
  .tk-grid { grid-template-columns: 1fr; }
  .tk-side { position: static; }
  .tk-side .ticket { max-height: none; }
}
@media (max-width: 600px) {
  .tk-fields { grid-template-columns: 1fr; }
}

/* Ventas: borradores */
.status--borrador { color: var(--text-muted); background: var(--surface-2); }
.dt-numdoc.is-draft { font-style: italic; color: var(--text-muted); }
.ticket { position: relative; overflow: hidden; }
.ticket.is-draft::after {
  content: "BORRADOR";
  position: absolute;
  top: 42%;
  left: 50%;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4.2rem;
  letter-spacing: .1em;
  color: rgba(198, 27, 24, .08);
  transform: translate(-50%, -50%) rotate(-24deg);
  pointer-events: none;
}
.ticket-cobro { flex-wrap: wrap; }
.ticket-cobro .btn-pill svg { width: 15px; height: 15px; }

/* Líneas del tiquet: sin flechas en los números (se alinean a la derecha como su cabecera) */
.tl input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.tl input[type="number"]::-webkit-outer-spin-button,
.tl input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tl select { padding-right: .3rem; }
.tl th:nth-child(5) { padding-left: .95rem; text-align: left; }   /* "IVA" alineado con el texto del desplegable */

/* ==========================================================
   PROMOCIONES — listado y resultados
   ========================================================== */
.dt[hidden] { display: none; }

.status--pr-borrador { color: var(--text-muted); background: var(--surface-2); }
.status--pr-programada { color: #2d6fb0; background: rgba(60, 130, 200, .13); }
.status--pr-activa { color: #1f9d55; background: rgba(31, 157, 85, .12); }
.status--pr-activa::before { animation: pulse 1.6s infinite; }
.status--pr-finalizada { color: #7a4fc4; background: rgba(122, 79, 196, .12); }

.pr-kpis { display: flex; flex-direction: column; gap: .1rem; font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
.pr-kpis b { color: var(--text); font-weight: 600; }

/* Modal con contenido libre (resultados, clientes de un segmento, confirmación) */
.modal__body--block { display: block; }
.pr-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.pr-stats > div { display: flex; flex-direction: column; gap: .1rem; padding: .8rem .9rem; background: var(--surface-2); border-radius: 16px; }
.pr-stats span { font-family: var(--font-display); font-weight: 700; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.pr-stats b { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 1.8rem; line-height: 1.1; }
.pr-stats small { font-size: .75rem; color: var(--text-muted); }
.pr-stats .is-main { color: var(--white); background: var(--red-grad); }
.pr-stats .is-main span, .pr-stats .is-main small { color: rgba(255, 255, 255, .8); }
.pr-sub { margin: 1.3rem 0 .6rem; font-family: var(--font-display); font-weight: 700; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); }
.pr-lugares { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; list-style: none; }
.pr-lugares li { display: flex; justify-content: space-between; padding: .6rem .8rem; font-size: .88rem; border: 1px solid var(--border); border-radius: 12px; }
.pr-quien { display: grid; gap: .4rem; list-style: none; }
.pr-quien li { display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; background: var(--surface-2); border-radius: 14px; }
.pr-quien li.is-off { opacity: .55; }
.pr-quien strong { display: block; font-size: .92rem; }
.pr-quien small { display: block; font-size: .78rem; color: var(--text-muted); }
.pr-quien__imp { margin-left: auto; font-weight: 600; text-align: right; white-space: nowrap; }

/* ==========================================================
   PROMOCIÓN — editor
   ========================================================== */
.pr-pair { display: flex; gap: .5rem; }
.pr-pair > * { flex: 1; min-width: 0; }
.pr-pair .dt__select { margin: 0; }
.pr-pair .dt__select select { width: 100%; height: 46px; border-radius: 14px; }


.pr-audience { display: flex; align-items: flex-start; gap: 1rem; padding: .9rem 1rem; background: var(--surface-2); border-radius: 16px; }
.pr-audience__n { display: flex; flex-direction: column; align-items: center; min-width: 84px; }
.pr-audience__n b { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 2.4rem; line-height: 1; color: var(--red); }
.pr-audience__n span { font-size: .75rem; color: var(--text-muted); }
.pr-audience { align-items: center; }
.pr-audience__txt { display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; }
.pr-audience__txt small { font-size: .8rem; color: var(--text-muted); }

.pr-when { padding: .7rem .9rem; font-size: .9rem; background: var(--surface-2); border-radius: 12px; }
.pr-when b { color: var(--red); }
.pr-test { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.pr-test .btn-pill svg { width: 15px; height: 15px; }
.ed-help code { padding: .05rem .35rem; font-size: .78rem; background: var(--surface-2); border-radius: 6px; }

/* Vista previa: email y notificación */
.pr-prev-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pr-prev { max-height: calc(100vh - var(--nav-h) - 20rem); min-height: 200px; overflow-y: auto; }
.pr-prev__off { margin-top: .5rem; font-size: .8rem; text-align: center; color: var(--text-muted); }
.pr-mail { overflow: hidden; color: #141414; background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .1); }
.pr-mail__meta { display: flex; flex-direction: column; gap: .1rem; padding: .7rem .9rem; font-size: .78rem; color: #555; border-bottom: 1px solid #eee; }
.pr-mail__meta span { color: #888; }
.pr-mail__subject { padding: .6rem .9rem; font-weight: 700; font-size: .95rem; border-bottom: 1px solid #eee; }
.pr-mail__body { padding: 1rem .9rem 1.1rem; font-size: .86rem; line-height: 1.55; }
.pr-mail__brand { margin-bottom: .8rem; font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 1.3rem; }
.pr-mail__brand em { font-size: .8rem; color: var(--red); }
.pr-mail__code { display: flex; flex-direction: column; align-items: center; margin: 1rem 0; padding: .7rem; border: 2px dashed #c61b18; border-radius: 10px; }
.pr-mail__code span { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: #888; }
.pr-mail__code b { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; letter-spacing: .06em; color: #c61b18; }
.pr-mail__legal { margin-top: 1rem; font-size: .7rem; color: #999; }

.pr-phone { display: flex; flex-direction: column; gap: .7rem; min-height: 360px; padding: 1rem .8rem; background: linear-gradient(160deg, #1e1e1e, #0a0a0a); border-radius: 28px; }
.pr-phone__time { font-family: var(--font-display); font-weight: 800; font-size: 2.4rem; text-align: center; color: #fff; }
.pr-push { display: flex; align-items: flex-start; gap: .6rem; padding: .7rem; font-size: .8rem; color: #141414; background: rgba(255, 255, 255, .92); border-radius: 16px; }
.pr-push__icon { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; font-family: var(--font-display); font-weight: 800; font-style: italic; color: #fff; background: var(--red-grad); border-radius: 9px; }
.pr-push b { display: block; font-size: .85rem; }
.pr-push small { margin-left: auto; color: #888; }
.pr-wallet { display: flex; flex-direction: column; gap: .2rem; margin-top: auto; padding: .9rem; color: #fff; background: var(--red-grad); border-radius: 16px; }
.pr-wallet span { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.pr-wallet b { font-size: .95rem; }
.pr-wallet code { margin-top: .3rem; padding: .3rem .5rem; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; letter-spacing: .06em; text-align: center; color: #c61b18; background: #fff; border-radius: 8px; }
.pr-wallet small { font-size: .72rem; opacity: .85; }

.pr-resumen { display: grid; gap: .35rem; margin: 0; padding: .8rem .9rem; font-size: .84rem; background: var(--surface-solid); border-radius: 14px; }
.pr-resumen > div { display: grid; grid-template-columns: 70px 1fr; gap: .5rem; }
.pr-resumen dt { color: var(--text-muted); }
.pr-resumen dd { margin: 0; }
.pr-confirm { font-size: .95rem; line-height: 1.55; }
.pr-confirm + .pr-confirm { margin-top: .6rem; font-size: .85rem; }

@media (max-width: 700px) {
  .pr-stats { grid-template-columns: 1fr 1fr; }
  .pr-lugares { grid-template-columns: 1fr; }
}
.dt-nocom { margin-left: .3rem; padding: .1rem .45rem; font-family: var(--font-display); font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; vertical-align: middle; }
.tk-side__btns .btn-pill { white-space: nowrap; }
.pr-quien__more { justify-content: center; font-size: .82rem; color: var(--text-muted); background: none !important; }

/* Promociones (versión sencilla) */
.pr-dto { margin-left: .3rem; padding: .1rem .5rem; font-family: var(--font-display); font-size: .78rem; font-weight: 800; font-style: italic; color: var(--white); background: var(--red-grad); border-radius: 6px; vertical-align: middle; }
.pr-mail__dto { margin: -.2rem 0 .7rem; font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 2.6rem; line-height: 1; color: #c61b18; }
.pr-when__race { display: block; margin-top: .2rem; font-size: .82rem; color: var(--text-muted); }
.pr-audience.mf { display: flex; }
.dt-op .pr-dto { display: inline-block; margin-top: 0; color: var(--white); }
.ed-field input[type="datetime-local"] {
  width: 100%; min-height: 46px; padding: .7rem .95rem; font: inherit; font-size: .95rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; color-scheme: light;
}
:root[data-theme="dark"] .ed-field input[type="datetime-local"] { color-scheme: dark; }

/* ---------- Ficha de carrera: corredores (cabecera + listado) ---------- */
.cr-head {
  display: inline-flex;
  align-items: center;
  gap: 1.1rem;
  padding: .55rem 1.1rem;
  font: inherit;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  border-radius: 999px;
}
.cr-head svg { width: 20px; height: 20px; flex: none; color: var(--text-muted); }
.cr-head span { display: flex; align-items: baseline; gap: .35rem; font-family: var(--font-display); font-weight: 700; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.cr-head b { font-weight: 800; font-style: italic; font-size: 1.35rem; letter-spacing: 0; color: var(--text); }
.cr-head .is-main b { color: var(--red); }
.btn-pill:disabled { opacity: .5; cursor: default; pointer-events: none; }
.modal--wide { width: min(1000px, calc(100vw - 2rem)); }
.cr-bar { padding: 0 0 .9rem; flex-wrap: wrap; }
.cr-table { min-width: 760px; }
.cr-table td { vertical-align: top; }
.cr-pad { display: block; }
.cr-pad + .cr-pad { margin-top: .5rem; }
.cr-num { text-align: right; white-space: nowrap; }

/* ---------- Ventas: solicitudes del paddock ---------- */
.req-alert {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: .8rem;
  width: 100%;
  margin-bottom: 1rem;
  padding: .9rem 1.2rem;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: linear-gradient(115deg, rgba(198, 27, 24, .12), rgba(198, 27, 24, .03));
  border: 1px solid rgba(198, 27, 24, .35);
  border-radius: 18px;
  cursor: pointer;
}
.req-alert[hidden] { display: none; }
.req-alert__dot { grid-row: span 2; width: 10px; height: 10px; background: var(--red); border-radius: 50%; box-shadow: 0 0 0 0 rgba(198, 27, 24, .6); animation: pulse 1.6s infinite; }
.req-alert b { font-weight: 700; }
.req-alert span:not(.req-alert__dot) { grid-column: 2; font-size: .85rem; color: var(--text-muted); }
.req-alert em { grid-row: 1 / span 2; grid-column: 3; font-style: normal; font-weight: 600; font-size: .9rem; color: var(--red); white-space: nowrap; }
.req-alert.is-on { border-color: var(--red); }
.dt-numdoc.is-request { display: inline-block; padding: .2rem .55rem; font-size: .8rem; letter-spacing: .06em; color: var(--white); background: var(--red); border-radius: 999px; }

/* Tiquet: solicitud del cliente */
.sol { border: 1px solid rgba(198, 27, 24, .35); background: linear-gradient(160deg, rgba(198, 27, 24, .07), transparent 60%), var(--surface); }
.sol .tk-card__title span { background: var(--red); color: var(--white); }
.sol .tk-card__title span svg { width: 15px; height: 15px; }
.sol__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.sol__orig { font-size: .85rem; color: var(--text-muted); }
.sol__bike { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.sol__bike img, .sol__ph { flex: none; width: 120px; height: 84px; object-fit: cover; border-radius: 14px; }
.sol__ph { display: grid; place-items: center; color: var(--text-muted); background: var(--surface-2); }
.sol__ph svg { width: 34px; height: 34px; }
.sol__bike div { display: grid; gap: .1rem; }
.sol__bike small { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.sol__bike b { font-size: 1.1rem; }
.sol__bike span { font-size: .88rem; color: var(--text-muted); }
.sol__noficha { margin-top: .2rem; font-style: normal; font-size: .82rem; color: #a86b1d; }
.sol__need { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.sol__need span { padding: .3rem .8rem; font-size: .85rem; font-weight: 600; color: var(--white); background: var(--red); border-radius: 999px; }
.sol__quote { margin: .9rem 0 0; padding: .7rem 1rem; font-size: .95rem; font-style: italic; line-height: 1.5; background: var(--surface-2); border-left: 3px solid var(--red); border-radius: 0 12px 12px 0; }
.sol__ficha { margin-top: 1rem; }
.sol__ficha summary { font-weight: 600; font-size: .9rem; cursor: pointer; }
.sol__ficha dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .7rem 1.2rem; margin-top: .8rem; }
.sol__ficha .is-full { grid-column: 1 / -1; }
.sol__ficha dt { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.sol__ficha dd { margin: .1rem 0 0; font-weight: 600; font-size: .92rem; }
.sol__fotos { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.sol__fotos img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; transition: transform .2s; }
.sol__fotos a:hover img { transform: scale(1.04); }

/* ==========================================================
   FICHA DE CLIENTE
   ========================================================== */
.cf { width: 100%; }
.cf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 1.4rem; margin-top: 1rem; }
.cf-head__photo { width: 112px; height: 112px; object-fit: cover; border-radius: 50%; border: 4px solid var(--surface-solid); box-shadow: 0 0 0 3px var(--red), var(--shadow); }
.cf-head__txt { flex: 1; min-width: 280px; }
.cf-head__txt .page-title { margin-top: .2rem; }
.cf-head__chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.cf-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .75rem; font-size: .8rem; font-weight: 600; color: #1f9d55; background: rgba(31, 157, 85, .12); border-radius: 999px; }
.cf-chip svg { width: 14px; height: 14px; }
.cf-chip--club { color: var(--white); background: var(--red-grad); }
.cf-chip--club svg { fill: currentColor; stroke: none; }
.cf-chip--off { color: var(--text-muted); background: var(--surface-2); }
.cf-head__contact { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .7rem; font-size: .9rem; color: var(--text-muted); }
.cf-head__contact a, .cf-head__contact span { display: inline-flex; align-items: center; gap: .35rem; }
.cf-head__contact a:hover { color: var(--red); }
.cf-head__contact svg { width: 16px; height: 16px; }
.cf-head__actions { display: flex; gap: .5rem; }

.cf-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-top: 1.6rem; }
.cf-kpis div { display: grid; gap: .2rem; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.cf-kpis span { font-family: var(--font-display); font-weight: 700; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); }
.cf-kpis b { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 2rem; line-height: 1; }
.cf-kpis .is-main { color: var(--white); background: var(--red-grad); border-color: transparent; }
.cf-kpis .is-main span { color: rgba(255, 255, 255, .8); }

.cf-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 26vw, 460px); gap: 1rem; align-items: start; margin-top: 1rem; }
.cf-main, .cf-side { display: grid; gap: 1rem; }
.cf-card { padding: 1.3rem 1.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); }
.cf-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.cf-card__head h2 { display: flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; text-transform: uppercase; }
.cf-card__head h2 svg { width: 22px; height: 22px; color: var(--red); }
.cf-card__note { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--text-muted); }
.cf-card__note svg { width: 15px; height: 15px; }
.cf-card__link { font-weight: 600; font-size: .88rem; color: var(--red); }

/* Bicis */
.cf-bike { padding: 1rem; background: var(--surface-2); border-radius: var(--radius-lg); }
.cf-bike + .cf-bike { margin-top: .8rem; }
.cf-bike__top { display: flex; gap: 1.2rem; align-items: center; }
.cf-bike__top img { flex: none; width: 220px; height: 140px; object-fit: cover; border-radius: 16px; }
.cf-bike__info { flex: 1; min-width: 0; }
.cf-bike__info small { font-family: var(--font-display); font-weight: 700; font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--red); }
.cf-bike__info h3 { font-family: var(--font-display); font-weight: 800; font-size: 1.8rem; line-height: 1; text-transform: uppercase; }
.cf-bike__info p { margin-top: .3rem; font-size: .9rem; color: var(--text-muted); }
.cf-prog { margin-top: .8rem; }
.cf-prog__bar { height: 6px; overflow: hidden; background: var(--border); border-radius: 999px; }
.cf-prog__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red-deep), var(--red)); border-radius: inherit; }
.cf-prog.is-ok .cf-prog__bar i { background: linear-gradient(90deg, #1f9d55, #3ccf74); }
.cf-prog span { display: block; margin-top: .35rem; font-size: .82rem; font-weight: 600; color: var(--red); }
.cf-prog.is-ok span { color: #1f9d55; }
.cf-ficha { margin-top: .9rem; }
.cf-ficha summary { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; font-size: .9rem; cursor: pointer; list-style: none; }
.cf-ficha summary::-webkit-details-marker { display: none; }
.cf-ficha summary svg { width: 16px; height: 16px; color: var(--red); transform: rotate(-90deg); transition: transform .2s; }
.cf-ficha[open] summary svg { transform: none; }
.cf-ficha__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; margin-top: .8rem; }
.cf-ficha__sec { padding: .9rem 1rem; background: var(--surface-solid); border-radius: 14px; }
.cf-ficha__sec h4 { margin-bottom: .6rem; font-family: var(--font-display); font-weight: 800; font-size: 1rem; text-transform: uppercase; }
.cf-ficha__sec dl { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem .8rem; }
.cf-ficha__sec .is-full { grid-column: 1 / -1; }
.cf-ficha__sec dt { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.cf-ficha__sec dd { margin: .1rem 0 0; font-weight: 600; font-size: .88rem; line-height: 1.3; }
.cf-miss { font-style: normal; color: var(--red); }

/* Compras */
.cf-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.cf-table th { padding: 0 .6rem .6rem; font-family: var(--font-display); font-weight: 700; font-size: .72rem; letter-spacing: .14em; text-align: left; text-transform: uppercase; color: var(--text-muted); }
.cf-table td { padding: .7rem .6rem; vertical-align: middle; border-top: 1px solid var(--border); }
.cf-table td small { display: block; font-size: .78rem; color: var(--text-muted); }
.cf-num { text-align: right !important; white-space: nowrap; }
.cf-mono { font-family: ui-monospace, "Roboto Mono", monospace; font-size: .85rem; white-space: nowrap; }

/* Lateral */
.cf-race { position: relative; display: grid; gap: .1rem; padding: .8rem 1rem; background: var(--surface-2); border-radius: 14px; }
.cf-race + .cf-race { margin-top: .5rem; }
.cf-race.is-next { background: linear-gradient(135deg, rgba(198, 27, 24, .12), rgba(198, 27, 24, .03)); box-shadow: inset 0 0 0 1px rgba(198, 27, 24, .35); }
.cf-race em { justify-self: start; margin-bottom: .2rem; padding: .1rem .5rem; font-style: normal; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--white); background: var(--red); border-radius: 999px; }
.cf-race span { font-size: .85rem; }
.cf-race small { font-size: .78rem; color: var(--text-muted); }
.cf-promo { position: relative; display: grid; gap: .15rem; padding: .8rem 2rem .8rem 1rem; background: var(--surface-2); border-radius: 14px; }
.cf-promo + .cf-promo { margin-top: .5rem; }
.cf-promo small { font-size: .78rem; color: var(--text-muted); }
.cf-promo__st { position: absolute; top: 1rem; right: 1rem; width: 9px; height: 9px; background: var(--text-muted); border-radius: 50%; }
.cf-promo__st.is-live { background: #1f9d55; box-shadow: 0 0 0 3px rgba(31, 157, 85, .2); }
.cf-promo__st.is-used { background: var(--red); }
.cf-prefs { display: grid; gap: .5rem; list-style: none; }
.cf-prefs li { display: flex; justify-content: space-between; font-size: .9rem; }
.cf-prefs b { color: var(--text-muted); }
.cf-prefs b.is-on { color: #1f9d55; }
.cf-side .cf-card__note { margin-top: .7rem; }
@media (max-width: 1100px) {
  .cf-grid { grid-template-columns: 1fr; }
  .cf-kpis { grid-template-columns: repeat(2, 1fr); }
  .cf-bike__top { flex-direction: column; align-items: stretch; }
  .cf-bike__top img { width: 100%; height: 200px; }
}

/* ==========================================================
   PANEL (dashboard)
   Colores de las series = los de las etiquetas de Ventas
   (validados para daltonismo en claro y oscuro):
   tienda verde azulado · servicios ámbar · reparaciones rojo.
   ========================================================== */
:root { --s-tienda: #1baf7a; --s-servicio: #eda100; --s-reparacion: #c61b18; --s-op: #c61b18; --pn-surface: #ffffff; }
:root[data-theme="dark"] { --s-tienda: #199e70; --s-servicio: #c98500; --s-reparacion: #c61b18; --pn-surface: var(--steel); }
.pn-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
#pn { display: grid; gap: 1rem; margin-top: 1.4rem; }

/* KPIs */
.pn-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .8rem; }
.pn-kpi { position: relative; display: grid; align-content: start; gap: .35rem; min-height: 132px; padding: 1rem 1.1rem; overflow: hidden; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: border-color .2s, transform .2s; }
a.pn-kpi:hover { border-color: var(--red); transform: translateY(-2px); }
.pn-kpi__label { display: flex; align-items: center; gap: .4rem; font-family: var(--font-display); font-weight: 700; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.pn-kpi__label svg { width: 16px; height: 16px; }
.pn-kpi__val { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 2.1rem; line-height: 1; }
.pn-kpi__foot { font-size: .8rem; color: var(--text-muted); }
.pn-kpi.is-main { color: var(--white); background: var(--red-grad); border-color: transparent; }
.pn-kpi.is-main .pn-kpi__label { color: rgba(255, 255, 255, .8); }
.pn-kpi.is-alert { border-color: rgba(198, 27, 24, .5); background: linear-gradient(135deg, rgba(198, 27, 24, .1), transparent 70%), var(--surface); }
.pn-kpi.is-alert .pn-kpi__val { color: var(--red); }
.pn-kpi.is-warn .pn-kpi__val { color: #a86b1d; }
.pn-delta { display: inline-flex; align-items: center; gap: .25rem; font-weight: 700; font-size: .85rem; }
.pn-delta svg { width: 14px; height: 14px; stroke-width: 2.6; }
.pn-delta small { margin-left: .25rem; font-weight: 400; font-size: .76rem; opacity: .8; }
.pn-kpi.is-main .pn-delta { color: var(--white); }
.pn-delta.is-up { color: #1f9d55; }
.pn-delta.is-down { color: var(--red); }
.pn-spark { position: absolute; right: 1rem; top: 1rem; width: 96px; height: 30px; overflow: visible; }
.pn-spark polyline { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pn-spark circle { fill: var(--white); }

/* Filas y tarjetas */
.pn-row { display: grid; gap: 1rem; }
.pn-row--2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.pn-row--1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pn-card { min-width: 0; padding: 1.2rem 1.3rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); }
.pn-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; }
.pn-card__head h2 { display: flex; align-items: center; gap: .45rem; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; line-height: 1.1; text-transform: uppercase; }
.pn-card__head h2 svg { width: 20px; height: 20px; color: var(--red); }
.pn-card__head p { margin-top: .2rem; font-size: .84rem; color: var(--text-muted); }
.pn-toggle { display: inline-flex; align-items: center; gap: .35rem; flex: none; height: 32px; padding: 0 .75rem; font: inherit; font-size: .8rem; font-weight: 600; color: var(--text-muted); background: var(--surface-2); border: 0; border-radius: 999px; cursor: pointer; }
.pn-toggle:hover { color: var(--text); }
.pn-toggle svg { width: 15px; height: 15px; }
.pn-link { flex: none; font-size: .85rem; font-weight: 600; color: var(--red); }
.pn-legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin: -.2rem 0 .6rem; list-style: none; font-size: .82rem; color: var(--text-muted); }
.pn-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.pn-key { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; }
.pn-key--tienda { background: var(--s-tienda); }
.pn-key--servicio { background: var(--s-servicio); }
.pn-key--reparacion, .pn-key--op { background: var(--s-reparacion); }
.pn-empty { padding: 1.2rem 0; font-size: .9rem; color: var(--text-muted); }

/* SVG: marcas finas, rejilla discreta */
.pn-svg { display: block; width: 100%; height: auto; overflow: visible; fill: none; stroke: none; }
/* Las gráficas no heredan el trazo de los iconos */
.pn-svg rect, .pn-svg path, .pn-svg text, .pn-svg circle, .pn-svg polyline, .pn-svg line { stroke: none; stroke-width: 0; }
.pn-svg .pn-grid { stroke: var(--border); stroke-width: 1; }
.pn-axis { font-family: var(--font-ui); font-size: 11px; fill: var(--text-muted); }
.pn-axis--name { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.pn-val { font-family: var(--font-ui); font-size: 12px; font-weight: 700; fill: var(--text); }
.pn-fill--tienda { fill: var(--s-tienda); }
.pn-fill--servicio { fill: var(--s-servicio); }
.pn-fill--reparacion { fill: var(--s-reparacion); }
.pn-hit { fill: transparent; cursor: default; }
.pn-hit:hover { fill: var(--surface-2); fill-opacity: .6; }
.pn-svg .pn-seg { stroke: var(--pn-surface); stroke-width: 2; transition: opacity .2s; }
.pn-donut:hover .pn-seg:not(:hover) { opacity: .55; }
.pn-svg .pn-line { fill: none; stroke: var(--s-reparacion); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pn-area { fill: var(--s-reparacion); fill-opacity: .1; }
.pn-svg .pn-dot { fill: var(--s-reparacion); stroke: var(--pn-surface); stroke-width: 2; }

/* Donut */
.pn-donut-wrap { display: grid; grid-template-columns: minmax(150px, 190px) 1fr; align-items: center; gap: 1rem; }
.pn-donut__val { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 26px; fill: var(--text); }
.pn-donut__lbl { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; fill: var(--text-muted); }
.pn-dlist { display: grid; gap: .7rem; list-style: none; }
.pn-dlist li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: .5rem; font-size: .88rem; }
.pn-dlist b { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }
.pn-dlist em { grid-column: 2 / -1; font-style: normal; font-size: .78rem; color: var(--text-muted); }

/* Tabla */
.pn-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.pn-table th { padding: .4rem .5rem; font-family: var(--font-display); font-weight: 700; font-size: .72rem; letter-spacing: .12em; text-align: left; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.pn-table td { padding: .5rem; border-bottom: 1px solid var(--border); }
.pn-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Hoy */
.pn-today { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.pn-race { background: linear-gradient(140deg, rgba(198, 27, 24, .1), transparent 60%), var(--surface); border-color: rgba(198, 27, 24, .3); }
.pn-race__top { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.pn-race__days { font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 3.6rem; line-height: .85; background: var(--red-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.pn-race__top span { display: grid; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; text-transform: uppercase; }
.pn-race__top small { font-family: var(--font-body); font-weight: 400; font-size: .8rem; text-transform: none; color: var(--text-muted); }
.pn-list { display: grid; list-style: none; }
.pn-list li + li { border-top: 1px solid var(--border); }
.pn-list a { display: flex; align-items: center; gap: .6rem; padding: .6rem .2rem; color: var(--text); }
.pn-list a:hover b { color: var(--red); }
.pn-list span { flex: 1; display: grid; min-width: 0; }
.pn-list b { font-weight: 600; font-size: .92rem; }
.pn-list small { overflow: hidden; font-size: .78rem; color: var(--text-muted); white-space: nowrap; text-overflow: ellipsis; }
.pn-list svg { width: 16px; height: 16px; flex: none; color: var(--text-muted); }
.pn-pill { flex: none; padding: .2rem .6rem; font-style: normal; font-size: .74rem; font-weight: 600; color: var(--text-muted); background: var(--surface-2); border-radius: 999px; white-space: nowrap; }
.pn-pill--warn { color: #a86b1d; background: rgba(214, 150, 60, .15); }
.pn-pill--alert { color: var(--white); background: var(--red); }
.pn-pill--ok { color: #1f9d55; background: rgba(31, 157, 85, .12); }
.pn-foot { margin-top: .6rem; font-size: .8rem; color: var(--text-muted); }

/* Oportunidades por fase */
.pn-funnel { display: grid; gap: .55rem; list-style: none; }
.pn-funnel li { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: .7rem; font-size: .86rem; }
.pn-funnel i { display: block; height: 18px; background: var(--s-op); border-radius: 0 4px 4px 0; }
.pn-funnel b { display: grid; justify-items: end; min-width: 72px; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; line-height: 1; }
.pn-funnel b small { font-family: var(--font-body); font-weight: 400; font-size: .74rem; color: var(--text-muted); }
.pn-won { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: 1rem; padding-top: .9rem; font-size: .85rem; color: var(--text-muted); border-top: 1px solid var(--border); }
.pn-won b { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; color: var(--text); }
.pn-won__rate b { color: #1f9d55; }

/* Promociones */
.pn-promos { display: grid; gap: .9rem; list-style: none; }
.pn-promos li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; align-items: center; gap: .9rem; }
.pn-promos__name { display: grid; min-width: 0; font-weight: 600; font-size: .9rem; }
.pn-promos__name small { overflow: hidden; font-weight: 400; font-size: .76rem; color: var(--text-muted); white-space: nowrap; text-overflow: ellipsis; }
.pn-promos__bar { display: block; height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.pn-promos__bar i { display: block; height: 100%; background: var(--s-op); border-radius: 0 4px 4px 0; }
.pn-promos b { display: grid; justify-items: end; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; line-height: 1; }
.pn-promos b small { font-family: var(--font-body); font-weight: 400; font-size: .74rem; color: var(--text-muted); }

/* Clientes */
.pn-meters { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.pn-meter span { font-size: .8rem; color: var(--text-muted); }
.pn-meter b { display: block; font-family: var(--font-display); font-weight: 800; font-style: italic; font-size: 1.7rem; line-height: 1.1; }
.pn-meter__bar { height: 6px; margin: .35rem 0; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.pn-meter__bar i { display: block; height: 100%; background: var(--s-reparacion); border-radius: inherit; }
.pn-meter small { font-size: .76rem; color: var(--text-muted); }

/* Tooltip */
.pn-tip[hidden] { display: none; }
.pn-tip { position: fixed; z-index: 100; display: grid; gap: .25rem; min-width: 180px; padding: .7rem .85rem; font-size: .82rem; color: var(--text); background: var(--surface-solid); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); pointer-events: none; }
.pn-tip b { margin-bottom: .15rem; font-weight: 700; }
.pn-tip__row { display: flex; align-items: center; gap: .45rem; color: var(--text-muted); }
.pn-tip__row em { margin-left: auto; padding-left: 1rem; font-style: normal; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.pn-tip__total { margin-top: .2rem; padding-top: .3rem; border-top: 1px solid var(--border); color: var(--text); font-weight: 600; }

@media (max-width: 1280px) { .pn-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .pn-row--2-1, .pn-row--1-1, .pn-today { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .pn-kpis { grid-template-columns: 1fr 1fr; } .pn-donut-wrap { grid-template-columns: 1fr; } }
