/* ============================================================
   Tómbola — tema premium
   Display: Playfair Display · UI/cuerpo: Inter
   Paleta ciruela + oro champán (gala/sorteo), no el default SaaS.
   ============================================================ */

:root {
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ink: #1F1B2E;          /* texto principal / barra */
  --ink-soft: #2C2740;
  --plum: #5B2A86;         /* marca / acción */
  --plum-700: #482069;     /* hover */
  --plum-050: #F3EEF8;     /* fondos suaves */
  --gold: #C6A15B;         /* acento premio (escaso) */
  --gold-soft: #E7D6AE;
  --gold-700: #A67F2E;    /* oro para acentos sobre blanco (3.69:1); el --gold base solo va sobre el rail oscuro */

  --paper: #FAF8F5;        /* fondo app — piedra cálida */
  --surface: #FFFFFF;      /* tarjetas/tablas */
  --muted: #6F6860;        /* texto secundario — taupe cálido */
  --line: #EBE6DF;         /* bordes — piedra */

  --success: #186647;   /* AA como texto sobre --success-050 (6.05:1) */
  --success-050: #E4F3EC;
  --warn: #8A6210;      /* AA como texto sobre --warn-050 (4.91:1) */
  --warn-050: #FBF2DC;
  --danger: #B4322E;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(31,27,46,.06), 0 8px 24px -12px rgba(31,27,46,.18);
  --shadow-lg: 0 24px 60px -20px rgba(31,27,46,.35);

  /* Roles separados para que el tema oscuro pueda moverlos por separado:
     --plum es RELLENO (botones, texto blanco encima); --plum-ink es TEXTO/acento sobre superficie. */
  --plum-ink: #5B2A86;
  --plum-ink-700: #482069;
  --rail: #1F1B2E;          /* sidebar / barra superior / barra inferior */
  --field: #FFFFFF;         /* fondo de inputs */
  --surface-2: #FCFBFD;     /* pie de modal, superficies secundarias */
  --neutral-050: #EFEDF3;   /* chips y píldoras neutras */
  --danger-050: #F7E3E2;
  --danger-fill: #B4322E;   /* rojo como relleno (texto blanco encima) */
  --inset-hi: rgba(255,255,255,.65);   /* brillo superior de tarjetas */
  --chart-free: #1E7F5C;
  --chart-reserved: #C6A15B;
  --chart-sold: #5B2A86;
  --chart-bad: #B4322E;

  --bs-primary: var(--plum);

  /* Curva fuerte (las nativas son débiles) — Emil Kowalski / animations.dev */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ---------- Tema oscuro del panel ----------
   Lo activa data-theme="dark" en <html>, que el script del <head> fija según la
   preferencia guardada (Sistema / Claro / Oscuro) — solo en páginas con sesión.
   El login y el landing público no llevan el atributo y se quedan como están. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #EEE9F3;
  --ink-soft: #D3CBDD;
  --muted: #A69DB1;
  --line: #342D42;
  --paper: #13101A;
  --surface: #1C1825;
  --surface-2: #221D2C;
  --field: #16121E;
  --rail: #0C0A12;
  --neutral-050: #2A2533;

  --plum: #7D4BB5;          /* relleno: blanco encima 5.9:1 */
  --plum-700: #6A3D9E;
  --plum-050: #2A2138;
  --plum-ink: #C9A8F0;      /* texto: 8.9:1 sobre --surface */
  --plum-ink-700: #DCC6F7;
  --gold-700: #C9A35C;      /* sobre fondo oscuro ya no hace falta el oro "oscurecido" */

  --success: #6FD3A6;
  --success-050: #173328;
  --warn: #E6BC66;
  --warn-050: #33290F;
  --danger: #F08A84;
  --danger-050: #3A1C1D;
  --danger-fill: #B4322E;

  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.75);
  --inset-hi: rgba(255,255,255,.04);
  --chart-free: #3FB387;
  --chart-reserved: #C9A35C;
  --chart-sold: #A47ADB;
  --chart-bad: #E0625C;

  /* Bootstrap 5.3 (data-bs-theme="dark") trae grises fríos: se alinean a la paleta. */
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--surface-2);
  --bs-emphasis-color: #FFFFFF;
}
:root[data-theme="dark"] .tb-sidebar { box-shadow: inset -1px 0 0 var(--line); }
:root[data-theme="dark"] .form-control, :root[data-theme="dark"] .form-select { background-color: var(--field); color: var(--ink); }
:root[data-theme="dark"] ::selection { background: var(--plum); color: #fff; }
/* Sobre fondo oscuro la sombra no separa: velo más denso y un filo de 1px en los diálogos. */
:root[data-theme="dark"] .tbc-backdrop, :root[data-theme="dark"] .tb-modal-backdrop { background: rgba(6, 4, 10, .72); }
:root[data-theme="dark"] .tbc-modal, :root[data-theme="dark"] .tb-modal { box-shadow: 0 0 0 1px var(--line), var(--shadow-lg); }
:root[data-theme="dark"] .tb-toast { box-shadow: 0 0 0 1px var(--line), var(--shadow-lg); }

/* Las vistas previas imitan el sitio PÚBLICO del tenant, que siempre es claro:
   se les devuelven los tokens claros aunque el panel esté en oscuro. */
.tb-biz-phone, .tb-brand-pv {
  --ink: #1F1B2E; --ink-soft: #2C2740; --muted: #6F6860; --line: #EBE6DF;
  --paper: #FAF8F5; --surface: #FFFFFF; --plum-050: #F3EEF8; --plum-ink: #5B2A86;
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
::selection { background: var(--plum-050); color: var(--ink); }

/* Feedback de presión: todo lo "presionable" reacciona al tacto/clic. */
button, .btn, .tb-side-link, a.tb-kpi, a.tb-mini, .tb-tabs button, .tb-card {
  transition: background-color .18s var(--ease-out), color .18s var(--ease-out),
              border-color .18s var(--ease-out), transform .16s var(--ease-out), box-shadow .18s var(--ease-out);
}
button:active:not(:disabled), .btn:active, .tb-side-link:active,
a.tb-kpi:active, .tb-tabs button:active { transform: scale(0.97); }

/* Foco visible y accesible (no se elimina el outline; se estiliza). */
:focus-visible { outline: 2px solid var(--plum-ink); outline-offset: 2px; border-radius: 4px; }

/* font-size relativo: respeta el tamaño de letra que el usuario fija en el navegador (WCAG 1.4.4). */
html { position: relative; min-height: 100%; font-size: 100%; }

body {
  margin: 0 0 64px;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  letter-spacing: .002em;
}

h1, h2, h3, .tb-display {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
}
/* Cuerpo de texto con ritmo de lectura más holgado (acabado premium). */
p { line-height: 1.6; }

/* Enlace de salto para teclado / lectores de pantalla */
.tb-skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--plum); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 0; font-weight: 600;
}
.tb-skip:focus { left: 0; color: #fff; }

a { color: var(--plum-ink); text-decoration: none; }
/* <code> de Bootstrap es rosa: se alinea a la marca en ambos temas. */
code { color: var(--plum-ink); }
a:hover { color: var(--plum-ink-700); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- App shell con sidebar ---------- */
.tb-app { display: flex; min-height: 100dvh; margin: 0; }

.tb-sidebar {
  width: 248px; flex: 0 0 248px; background: var(--rail); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh;
  transition: width .18s ease, transform .2s ease;
}
.tb-side-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.05rem 1.15rem; border-bottom: 1px solid rgba(255,255,255,.09);
}
.tb-wordmark { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; color: #fff; text-decoration: none; line-height: 1; }
.tb-wordmark:hover { color: #fff; text-decoration: none; }
.tb-wordmark-full::first-letter { color: var(--gold-soft); }
.tb-wordmark-mini { display: none; color: var(--gold-soft); }
.tb-collapse-btn { background: transparent; border: 0; color: rgba(255,255,255,.55); cursor: pointer; padding: .25rem; border-radius: 6px; transition: transform .18s ease, color .15s, background .15s; }
.tb-collapse-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

.tb-side-nav { display: flex; flex-direction: column; gap: .12rem; padding: .9rem .7rem; flex: 1 1 auto; overflow-y: auto; }
.tb-side-link {
  display: flex; align-items: center; gap: .8rem; padding: .6rem .75rem; border-radius: 8px;
  color: rgba(255,255,255,.76); text-decoration: none; font-weight: 500; font-size: .95rem;
  border: 0; background: transparent; width: 100%; cursor: pointer; white-space: nowrap; text-align: left;
  transition: background .15s, color .15s;
}
.tb-side-link svg { width: 20px; height: 20px; flex: 0 0 20px; }
.tb-side-link:hover { background: rgba(255,255,255,.09); color: #fff; text-decoration: none; }
.tb-side-link.active { background: rgba(198,161,91,.16); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.tb-side-foot { padding: .7rem; border-top: 1px solid rgba(255,255,255,.09); display: flex; flex-direction: column; gap: .3rem; }
.tb-side-foot form { margin: 0; }
.tb-side-user { display: flex; align-items: center; gap: .6rem; padding: .35rem .75rem; color: rgba(255,255,255,.72); font-size: .85rem; overflow: hidden; }
.tb-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--plum); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; flex: 0 0 30px; }
.tb-side-user-name { overflow: hidden; text-overflow: ellipsis; }

.tb-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }
.tb-topbar { display: none; align-items: center; gap: .8rem; background: var(--rail); border-bottom: 2px solid var(--gold); padding: .55rem 1rem; position: sticky; top: 0; z-index: 20; }
.tb-hamburger { background: transparent; border: 0; color: #fff; cursor: pointer; padding: .25rem; }
.tb-topbar-brand { font-family: var(--font-display); font-weight: 700; color: #fff; font-size: 1.25rem; text-decoration: none; }
.tb-content { flex: 1 1 auto; padding: 2rem 2.25rem 3rem; width: 100%; max-width: 1320px; }
.tb-scrim { display: none; position: fixed; inset: 0; background: rgba(31,27,46,.5); z-index: 29; }

/* Vistas de cuenta (login): centrar la tarjeta vertical y horizontalmente */
.tb-auth .tb-content { max-width: none; display: flex; flex-direction: column; justify-content: center; padding: 2rem 1.25rem; }

/* ---------- Login: fondo "aurora" con orbes ---------- */
.tb-auth {
  background: radial-gradient(135% 135% at 15% 8%, #3a2258 0%, #241a3b 46%, #17111f 100%);
  color: #fff;
}
.tb-auth .tb-main { position: relative; z-index: 1; }
.tb-auth .tb-topbar { display: none !important; }   /* fondo full-bleed también en móvil */

.tb-auth-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.tb-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; will-change: transform; }
.tb-orb-1 { width: 46vmax; height: 46vmax; left: -8vmax; top: -6vmax; background: #C6A15B; opacity: .34; animation: tb-orb-a 12s ease-in-out infinite alternate; }
.tb-orb-2 { width: 52vmax; height: 52vmax; right: -12vmax; bottom: -12vmax; background: #6d34a3; opacity: .55; animation: tb-orb-b 15s ease-in-out infinite alternate; }
.tb-orb-3 { width: 34vmax; height: 34vmax; left: 40%; top: 30%; background: #8a2f6b; opacity: .30; animation: tb-orb-c 13s ease-in-out infinite alternate; }
@keyframes tb-orb-a { from { transform: translate(0, 0) scale(1); } to { transform: translate(10vmax, 6vmax) scale(1.12); } }
@keyframes tb-orb-b { from { transform: translate(0, 0) scale(1); } to { transform: translate(-9vmax, -6vmax) scale(1.08); } }
/* Pantallas chicas: orbes quietos (blur de 90px animado sobre círculos enormes gasta batería). */
@media (max-width: 640px) { .tb-orb { animation: none; will-change: auto; } }
@keyframes tb-orb-c { from { transform: translate(0, 0) scale(1); } to { transform: translate(-7vmax, 8vmax) scale(1.15); } }

/* Tarjeta como superficie limpia flotando sobre el fondo oscuro */
.tb-auth .card {
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .6), 0 2px 0 rgba(255, 255, 255, .35) inset;
  backdrop-filter: blur(6px);
  position: relative; overflow: hidden;
}
.tb-auth .card::before {   /* filo dorado superior */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--plum));
}

/* Footer legible sobre el fondo oscuro */
.tb-auth .tb-foot { color: rgba(255, 255, 255, .62); border-top-color: rgba(255, 255, 255, .12); }
.tb-auth .tb-foot a { color: rgba(255, 255, 255, .88); }

/* Colapsado (solo iconos) en desktop */
.tb-app.tb-collapsed .tb-sidebar { width: 74px; flex-basis: 74px; }
.tb-app.tb-collapsed .tb-side-link span,
.tb-app.tb-collapsed .tb-wordmark-full,
.tb-app.tb-collapsed .tb-side-user-name { display: none; }
.tb-app.tb-collapsed .tb-wordmark-mini { display: inline; }
.tb-app.tb-collapsed .tb-side-link { justify-content: center; padding: .6rem; }
.tb-app.tb-collapsed .tb-side-brand { justify-content: center; }
.tb-app.tb-collapsed .tb-collapse-btn { transform: rotate(180deg); }
.tb-app.tb-collapsed .tb-side-user { justify-content: center; padding-left: 0; padding-right: 0; }

/* Móvil: el sidebar se convierte en BARRA DE NAVEGACIÓN INFERIOR (accesos según rol). */
@media (max-width: 860px) {
  .tb-topbar { display: flex; }
  .tb-hamburger { display: none; }          /* sin off-canvas: la nav va abajo */
  .tb-scrim { display: none !important; }

  .tb-sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto; flex-direction: row; z-index: 30; transform: none;
    box-shadow: 0 -6px 20px -10px rgba(31,27,46,.6);
  }
  /* Los contenedores no forman caja: sus enlaces se integran a la fila. */
  .tb-side-nav, .tb-side-foot, .tb-side-foot form { display: contents; }
  .tb-side-brand, .tb-side-user { display: none; }

  .tb-side-link,
  .tb-app.tb-collapsed .tb-side-link {
    flex: 1 1 0; width: auto; min-width: 52px; flex-direction: column; gap: 3px;
    justify-content: center; font-size: .7rem; line-height: 1.1; border-radius: 0;
    padding: .5rem .2rem calc(.5rem + env(safe-area-inset-bottom)); white-space: nowrap;
  }
  .tb-app.tb-collapsed .tb-side-link span { display: inline; }
  .tb-side-link svg { width: 22px; height: 22px; flex: 0 0 22px; }
  /* Etiquetas largas ("Comprobantes") se recortan dentro de su celda en vez de encimarse. */
  .tb-side-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .tb-side-link.active { box-shadow: inset 0 3px 0 var(--gold); }   /* activo: borde superior */
  /* Tenant: "Salir" pasa a la hoja "Más" para dejar la barra en 5 celdas. */
  .tb-has-more .tb-side-foot form { display: none; }
  .tb-theme-toggle { display: none !important; }
  .tb-app.tb-more-open .tb-side-more .tb-more-only { display: block; }
  .tb-side-logout { color: rgba(255,255,255,.76); }

  .tb-app.tb-collapsed .tb-sidebar { width: 100%; flex-basis: auto; }

  /* "Más": el toggle ocupa una celda de la barra; el grupo es una hoja emergente.
     Prefijo .tb-app para ganar en especificidad a las reglas de escritorio, que en el
     código van DESPUÉS de este media query. */
  .tb-app .tb-more-toggle { display: flex; }
  .tb-app .tb-side-more {
    display: none; position: fixed; right: 8px; left: 8px;
    bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 40;
    flex-direction: column; gap: .15rem; padding: .5rem;
    background: var(--rail); border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
  }
  .tb-app.tb-more-open .tb-side-more { display: flex; }
  /* En la hoja, los enlaces vuelven a ser filas horizontales legibles (no columnas mini). */
  .tb-app.tb-more-open .tb-side-more .tb-side-link {
    flex-direction: row; justify-content: flex-start; gap: .8rem;
    font-size: .95rem; padding: .7rem .8rem; border-radius: 8px; min-width: 0;
  }
  .tb-app.tb-more-open .tb-side-more .tb-side-link svg { width: 20px; height: 20px; flex: 0 0 20px; }
  .tb-content { padding: 1.25rem; padding-bottom: 84px; }   /* espacio para la barra inferior */
  .tb-foot { padding-bottom: 5rem; }

  /* Las tablas (DataTables) se APILAN por columna en móvil (como en el sitio público),
     usando el data-th que estampa site.js; sin scroll horizontal. */
  table.tb-dt { min-width: 0; }
  table.tb-dt thead { display: none; }
  table.tb-dt, table.tb-dt tbody, table.tb-dt tbody tr, table.tb-dt tbody td { display: block; width: 100%; }
  table.tb-dt tbody tr {
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: .35rem .25rem; margin-bottom: .75rem; background: var(--surface);
  }
  table.tb-dt tbody tr:hover td { background: transparent; }
  table.tb-dt tbody td {
    border: 0 !important; padding: .4rem 1rem;
    box-sizing: border-box;   /* DataTables fija content-box: con width:100% + padding se salía de la fila */
    display: flex; gap: .75rem; justify-content: space-between; align-items: baseline;
    text-align: right;
  }
  table.tb-dt tbody td::before {
    content: attr(data-th); flex: 0 0 40%; text-align: left;
    font-size: .74rem; font-weight: 700; letter-spacing: .04em; color: var(--muted);
  }
  /* Columna de acciones (sin título): botones a lo ancho, sin etiqueta. */
  table.tb-dt tbody td:not([data-th]) { justify-content: flex-start; flex-wrap: wrap; gap: .4rem; text-align: left; padding-top: .6rem; }
  table.tb-dt tbody td:not([data-th])::before { display: none; }
}

/* ---------- Botones ---------- */
.btn { font-weight: 600; border-radius: var(--radius-sm); }
.btn-primary {
  background: var(--plum); border-color: var(--plum);
}
.btn-primary:hover, .btn-primary:focus { background: var(--plum-700); border-color: var(--plum-700); }
.btn-outline-secondary { color: var(--ink); border-color: var(--line); }
.btn-outline-secondary:hover { background: var(--plum-050); color: var(--plum-ink-700); border-color: var(--plum-050); }
.btn:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; box-shadow: none; }

/* Inputs de Bootstrap (login/forms) coherentes con la marca */
.form-control, .form-select { border-color: var(--line); }
.form-control:focus, .form-select:focus { border-color: var(--plum); box-shadow: 0 0 0 3px var(--plum-050); }
.form-label { font-weight: 600; color: var(--ink-soft); }

/* ---------- Tema: botón del pie del sidebar (escritorio) y selector de Mi cuenta ---------- */
.tb-theme-toggle .tb-theme-ico-light { display: none; }
:root[data-theme="dark"] .tb-theme-toggle .tb-theme-ico-light { display: block; }
:root[data-theme="dark"] .tb-theme-toggle .tb-theme-ico-dark { display: none; }
.tb-theme-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--field); }
.tb-theme-seg button {
  border: 0; background: transparent; padding: .45rem 1rem; font: inherit; font-size: .88rem; font-weight: 600;
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; min-height: 40px;
}
.tb-theme-seg button + button { border-left: 1px solid var(--line); }
.tb-theme-seg button:hover { color: var(--ink); }
.tb-theme-seg button[aria-pressed="true"] { background: var(--plum); color: #fff; }
.tb-theme-seg svg { width: 16px; height: 16px; }

/* ---------- Agrupador "Más" de la barra inferior (móvil) ---------- */
/* En escritorio el grupo fluye inline y el toggle no existe. */
.tb-side-more { display: contents; }
.tb-more-toggle { display: none; }
.tb-more-only { display: none; margin: 0; }

/* ---------- Toolbar de sección ---------- */
.tb-toolbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; margin: .5rem 0 1.5rem; flex-wrap: wrap;
}
.tb-toolbar h1, .tb-toolbar h2 { margin: 0; position: relative; padding-bottom: .4rem; }
.tb-toolbar h1::after, .tb-toolbar h2::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 2.5rem; height: 3px;
  background: var(--gold-700); border-radius: 2px;
}
/* Acción principal del encabezado: botón directo o dentro de un grupo de acciones. */
.tb-toolbar > button, .tb-toolbar .btn, .tb-toolbar .tb-primary {
  background: var(--plum); color: #fff; border: 1px solid var(--plum);
  padding: .5rem 1.1rem; border-radius: var(--radius-sm); font: inherit; font-weight: 600; cursor: pointer;
}
.tb-toolbar > button:hover:not(:disabled), .tb-toolbar .tb-primary:hover:not(:disabled) { background: var(--plum-700); border-color: var(--plum-700); }
.tb-toolbar > button:disabled, .tb-toolbar .tb-primary:disabled { opacity: .6; cursor: not-allowed; }
/* La píldora de estatus junto al título va en la tipografía de UI, no en la display. */
.tb-toolbar h1 .tb-pill { font-family: var(--font-sans); letter-spacing: 0; vertical-align: middle; position: relative; top: -.2em; }

/* ---------- Tarjetas ---------- */
.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); background: var(--surface);
}
.card .card-title { font-family: var(--font-display); font-weight: 600; }

/* ---------- Tablas + DataTables ---------- */
table.tb-dt, table.table.tb-dt { background: var(--surface); border-collapse: separate; border-spacing: 0; }
table.tb-dt thead th {
  font-family: var(--font-sans); font-size: .74rem; font-weight: 700;
  letter-spacing: .04em; color: var(--muted); text-transform: none;
  border-bottom: 1px solid var(--line) !important; background: transparent;
}
table.tb-dt tbody td { border-color: var(--line) !important; vertical-align: middle; color: var(--ink); font-variant-numeric: tabular-nums; }
table.tb-dt tbody tr:hover td { background: var(--plum-050); }
.dataTables_wrapper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .35rem .55rem;
  background-color: var(--field); color: var(--ink);
}
.dataTables_wrapper .dataTables_info { color: var(--muted); font-size: .85rem; }
/* Las filas de Bootstrap que arma DataTables traen márgenes negativos: dentro de la tarjeta
   empujaban la tabla fuera del borde (y la página a scroll horizontal en móvil). */
.dataTables_wrapper > .row { margin-left: 0; margin-right: 0; }
.dataTables_wrapper > .row > * { padding-left: 0; padding-right: 0; }
/* Dentro de un panel la tabla no necesita su propia tarjeta (caja dentro de caja). */
.tb-panel .dataTables_wrapper { border: 0; box-shadow: none; padding: 0; background: transparent; }
/* Los controles de DataTables ("Mostrar _ registros", "Buscar:") son etiquetas en línea;
   la regla de formularios .tb-panel label las apilaba en columna. */
.tb-panel .dataTables_wrapper label {
  display: inline-flex; flex-direction: row; align-items: center; gap: .4rem;
  font-size: .88rem; font-weight: 500; color: var(--ink-soft);
}
.tb-panel .dataTables_wrapper .dataTables_length select { width: auto; }
/* La paginación se acomoda en varias líneas en vez de ensanchar la página en móvil. */
.dataTables_wrapper .dataTables_paginate .pagination { flex-wrap: wrap; justify-content: flex-end; row-gap: .3rem; }
@media (max-width: 767px) {
  .dataTables_wrapper .dataTables_paginate .pagination { justify-content: center; }
  /* dataTables.bootstrap5 centra "Mostrar" y deja "Buscar" a la izquierda: se alinean ambos. */
  /* Selectores con div. para ganarle a dataTables.bootstrap5 (div.dataTables_wrapper div.…). */
  div.dataTables_wrapper div.dataTables_length, div.dataTables_wrapper div.dataTables_filter { text-align: left; margin-bottom: .5rem; }
  div.dataTables_wrapper div.dataTables_filter label { display: flex; width: 100%; align-items: center; gap: .5rem; }
  div.dataTables_wrapper div.dataTables_filter input { flex: 1 1 auto; min-width: 0; width: auto; margin-left: 0 !important; }
  /* Datos largos (slugs, dominios) parten línea en la celda apilada en vez de ensanchar la página. */
  table.tb-dt tbody td { overflow-wrap: anywhere; }
}
.dataTables_wrapper .dataTables_paginate .page-item.active .page-link { background: var(--plum); border-color: var(--plum); color: #fff; }
.dataTables_wrapper .dataTables_paginate .page-link { color: var(--plum-ink); }

/* Botones compactos dentro de celdas */
.tb-mini {
  border: 1px solid var(--line); background: var(--surface); color: var(--plum-ink);
  padding: .25rem .6rem; border-radius: 999px; cursor: pointer; font-size: .78rem;
  font-weight: 600; margin: 0 .12rem; transition: background .15s, color .15s;
  touch-action: manipulation;
}
.tb-mini:hover { background: var(--plum-050); border-color: var(--plum-050); color: var(--plum-ink-700); }
.tb-mini:focus-visible, .tb-side-link:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.btn, .tb-mini, .tb-side-link, .tb-tabs button, .tb-toolbar > button { touch-action: manipulation; }
.tb-muted { color: var(--muted); }

/* Botones de acción dentro de paneles/tarjetas: secundario por defecto. */
.tb-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.tb-actions button, .tb-winner-controls button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: .5rem 1.05rem; border-radius: var(--radius-sm); font: inherit; font-weight: 600;
  cursor: pointer; touch-action: manipulation;
}
.tb-actions button:hover:not(:disabled), .tb-winner-controls button:hover:not(:disabled) {
  background: var(--plum-050); border-color: var(--plum-050); color: var(--plum-ink-700);
}
.tb-actions button:disabled, .tb-winner-controls button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Badges / chips ---------- */
.tb-badge {
  font-size: .72rem; font-weight: 600; background: var(--plum-050); color: var(--plum-ink-700);
  padding: .2rem .6rem; border-radius: 999px; vertical-align: middle;
}
.tb-chip { padding: .35rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 600; background: var(--neutral-050); color: var(--ink); }
.tb-chip.tb-free { background: var(--success-050); color: var(--success); }
.tb-chip.tb-reserved { background: var(--warn-050); color: var(--warn); }
.tb-chip.tb-sold { background: var(--plum-050); color: var(--plum-ink-700); }
.tb-counts { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

/* ---------- Pestañas ---------- */
.tb-tabs { display: flex; gap: .25rem; padding: 0; margin: 0 0 1.5rem; border-bottom: 1px solid var(--line);
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.tb-tabs::-webkit-scrollbar { height: 3px; }
.tb-tabs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.tb-tabs button { flex: 0 0 auto; white-space: nowrap; background: none; border: 0; border-bottom: 2px solid transparent; padding: .6rem 1.1rem; cursor: pointer; margin-bottom: -1px; font: inherit; font-weight: 600; color: var(--muted); touch-action: manipulation; }
.tb-tabs button:hover { color: var(--ink); }
.tb-tabs button.active { color: var(--plum-ink); border-bottom-color: var(--gold-700); }
.tb-tabs button:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: -3px; }

/* ---------- Paneles / formularios ---------- */
.tb-panel { display: flex; flex-direction: column; gap: 1rem; background: var(--surface); padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tb-panel label, .tb-modal-body label { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.tb-panel input, .tb-panel select, .tb-panel textarea,
.tb-modal-body input, .tb-modal-body select, .tb-modal-body textarea {
  padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-weight: 400; color: var(--ink); background: var(--field);
}
.tb-panel input:focus, .tb-modal-body input:focus, .tb-panel select:focus, .tb-modal-body select:focus,
.tb-panel textarea:focus, .tb-modal-body textarea:focus {
  outline: none; border-color: var(--plum); box-shadow: 0 0 0 3px var(--plum-050);
}
.tb-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.tb-check { flex-direction: row !important; align-items: center; gap: .5rem; }
.tb-errors { color: var(--danger); margin: .5rem 0; padding-left: 1.1rem; font-size: .88rem; }
.tb-preview { max-width: 180px; margin-top: .5rem; border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* ---------- Accesos del dueño (modales de tenant) ---------- */
.tb-sep { border: 0; border-top: 1px solid var(--line); margin: 1rem 0 .6rem; }
.tb-access { list-style: none; padding: 0; margin: .4rem 0; }
.tb-access li { margin: .3rem 0; }
.tb-access code { background: var(--plum-050); padding: .1rem .4rem; border-radius: var(--radius-sm); font-size: .9rem; word-break: break-all; }
.tb-ok { color: var(--success); font-size: .9rem; }
.tb-warn { color: var(--warn); font-size: .9rem; }

/* ---------- Cuadrícula de premios ---------- */
.tb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.15rem; }
.tb-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.tb-card img { width: 100%; height: 150px; object-fit: cover; }
.tb-card-body { padding: .9rem 1rem; }
.tb-card-body strong { font-family: var(--font-display); font-size: 1.05rem; }

/* ---------- Modales ---------- */
.tb-modal-backdrop { position: fixed; inset: 0; background: rgba(31,27,46,.55); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 1rem; z-index: 1050; backdrop-filter: blur(2px); animation: tb-backdrop .18s var(--ease-out) both; }
.tb-modal { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); overflow: hidden; animation: tb-modal-in .2s var(--ease-out) both; display: flex; flex-direction: column; max-height: 90vh; }
@keyframes tb-backdrop { from { opacity: 0; } to { opacity: 1; } }
@keyframes tb-modal-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.tb-modal-header { padding: 1.15rem 1.4rem; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.tb-modal-header h3 { margin: 0; font-size: 1.25rem; }
.tb-modal-body { padding: 1.4rem; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.tb-modal-footer { padding: 1rem 1.4rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .6rem; background: var(--surface-2); flex: 0 0 auto; }
.tb-modal-footer button { padding: .5rem 1.15rem; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--plum); font-weight: 600; }
.tb-modal-footer button[type="submit"] { background: var(--plum); color: #fff; }
.tb-modal-footer button[type="submit"]:hover { background: var(--plum-700); }
.tb-modal-footer button[type="button"] { background: var(--field); color: var(--ink); border-color: var(--line); }

/* Booleano activo/inactivo */
.tb-bool { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; }
.tb-bool svg { width: 14px; height: 14px; }
.tb-bool-yes { background: var(--success-050); color: var(--success); }
.tb-bool-no { background: var(--danger-050); color: var(--danger); }
.tb-expired { color: var(--danger); font-weight: 600; }

/* Toggle (switch) — reemplaza a los checkbox */
/* Se sube la especificidad para ganar a `.tb-modal-body label` / `.tb-panel label` (que ponen column). */
.tb-switch,
.tb-modal-body label.tb-switch,
.tb-panel label.tb-switch {
  display: inline-flex; flex-direction: row; align-items: center; gap: .6rem;
  cursor: pointer; font-weight: 600; color: var(--ink-soft); font-size: .9rem;
}
.tb-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.tb-switch-track { position: relative; width: 42px; height: 24px; background: var(--line); border-radius: 999px; transition: background .15s; flex: 0 0 42px; }
.tb-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(31,27,46,.25); }
.tb-switch input:checked + .tb-switch-track { background: var(--plum); }
.tb-switch input:checked + .tb-switch-track::after { transform: translateX(18px); }
.tb-switch input:focus-visible + .tb-switch-track { outline: 3px solid var(--gold-soft); outline-offset: 2px; }

.tb-filters { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tb-filters select, .tb-filters input { padding: .45rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--field); color: var(--ink); }

/* ---------- Footer ---------- */
.tb-foot { padding: 1.1rem 2.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

/* ---------- Tarjetas de premio: miniaturas ---------- */
.tb-card-thumb { position: relative; }
.tb-card-thumb img { width: 100%; height: 150px; object-fit: cover; display: block; }
.tb-card-thumb-empty {
  height: 150px; display: grid; place-items: center;
  background: var(--plum-050); color: var(--muted); font-size: .85rem;
}
.tb-img-count {
  position: absolute; right: .5rem; bottom: .5rem;
  background: rgba(31,27,46,.78); color: #fff; font-size: .72rem;
  padding: .15rem .5rem; border-radius: 999px;
}

/* ---------- Gestor de imágenes del premio (modal) ---------- */
.tb-images-field { margin: .35rem 0 .25rem; }
.tb-field-label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.tb-thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.tb-thumb { position: relative; width: 110px; height: 80px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.tb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tb-thumb-del {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0;
  border: none; border-radius: 50%; background: rgba(31,27,46,.8); color: #fff;
  font-size: 1rem; line-height: 22px; cursor: pointer;
}
.tb-thumb-add {
  width: 110px; height: 80px; display: grid; place-items: center;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--plum-ink); font-size: .82rem; cursor: pointer; background: var(--plum-050);
}
/* Oculto a la vista pero NO al teclado (display:none lo saca del orden de tabulación). */
.tb-thumb-add input, .tb-file-a11y {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.tb-thumb-add:focus-within, .tb-biz-upload:focus-within { outline: 2px solid var(--plum-ink); outline-offset: 2px; }
.tb-hint { color: var(--muted); font-size: .85rem; }

/* ---------- Comprobantes ---------- */
.tb-proof .tb-card-thumb img { height: 150px; background: var(--plum-050); }
.tb-proof-meta { font-size: .85rem; color: var(--ink-soft); margin: .4rem 0; }
.tb-proof-note { font-size: .85rem; color: var(--muted); font-style: italic; }
.tb-proof-amount { margin: .4rem 0; font-size: .95rem; color: var(--ink); background: var(--plum-050); border: 1px solid var(--plum-050); border-radius: 8px; padding: .45rem .6rem; }
.tb-proof-amount strong { color: var(--plum-ink); font-size: 1.05rem; }
.tb-proof-amount small { color: var(--muted); font-weight: 400; }
.tb-pill { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.tb-pill-warn { background: var(--warn-050); color: var(--warn); }
.tb-pill-ok { background: var(--success-050); color: var(--success); }
.tb-pill-bad { background: var(--danger-050); color: var(--danger); }
.tb-pill-info { background: var(--plum-050); color: var(--plum-ink-700); }
.tb-pill-muted { background: var(--neutral-050); color: var(--muted); }
.tb-badge-alert { background: var(--danger-fill); color: #fff; }
.tb-actions .tb-primary, .tb-winner-controls .tb-primary { background: var(--plum); color: #fff; border-color: var(--plum); }
.tb-actions .tb-primary:hover:not(:disabled), .tb-winner-controls .tb-primary:hover:not(:disabled) { background: var(--plum-700); border-color: var(--plum-700); color: #fff; }

/* Encabezado de tarjeta: nombre + estatus sin encimarse. */
.tb-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.tb-card-head strong { line-height: 1.25; }
.tb-card-head .tb-pill, .tb-card-head .tb-badge { flex: 0 0 auto; margin-top: .1rem; }
/* Comprobantes: el título de la rifa puede ser largo; pasa abajo en vez de estrujar el nombre. */
.tb-proof .tb-card-head { flex-wrap: wrap; }
.tb-proof .tb-card-head .tb-pill { flex: 0 1 auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Sorteo / ganadores ---------- */
.tb-winner .tb-card-body { padding: 1rem 1.1rem; }
.tb-winner-current { margin: .4rem 0 .6rem; font-size: .9rem; }
.tb-muted { color: var(--muted); }
.tb-winner-controls { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.tb-winner-controls input { flex: 1; min-width: 120px; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--field); color: var(--ink); }
.tb-winner-msg { margin: .6rem 0 0; font-size: .85rem; color: var(--success); }
/* Foto de la entrega al ganador: constancia que se publica en el sitio del negocio. */
.tb-winner-photo { display: flex; flex-direction: column; gap: .6rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed var(--line); }
.tb-winner-photo img { width: 100%; aspect-ratio: 4 / 3; height: auto; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.tb-winner-photo-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; font-size: .85rem; line-height: 1.4; }
.tb-winner-photo-t { font-weight: 600; color: var(--ink); }
.tb-winner-photo-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .45rem; }
.tb-winner-photo-actions .tb-mini { min-height: 36px; }
.tb-notice { background: var(--warn-050); border: 1px solid var(--gold-soft); color: var(--ink-soft);
  border-radius: var(--radius); padding: .9rem 1.1rem; font-size: .92rem; line-height: 1.5; }
.tb-notice strong { color: var(--warn); }

/* Bitácora del sorteo */
.tb-audit { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.tb-audit h3 { font-size: 1rem; margin: 0 0 .6rem; }
.tb-audit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.tb-audit-list li { display: flex; align-items: center; gap: .7rem; padding: .5rem .2rem; border-bottom: 1px solid var(--line); font-size: .88rem; flex-wrap: wrap; }
.tb-audit-txt { color: var(--ink); }
.tb-audit-date { margin-left: auto; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }

/* Movimientos de boletos: filtros + celda de cambio */
.tb-mvt-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.25rem; margin-bottom: 1rem; }
.tb-mvt-checks { display: inline-flex; flex-wrap: wrap; gap: .1rem .9rem; }
.tb-check-inline, .tb-panel label.tb-check-inline { display: inline-flex; flex-direction: row; align-items: center; gap: .4rem; font-size: .9rem; font-weight: 500; color: var(--ink); cursor: pointer; }
.tb-mvt-user { padding: .45rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--field); color: var(--ink); min-width: 200px; }
.tb-mvt-from { color: var(--muted); }
.tb-mvt-arrow { margin: 0 .35rem; color: var(--muted); }

/* ---------- Dashboard del tenant ---------- */
.tb-sub-banner {
  display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; align-items: center;
  background: var(--plum-050); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .7rem 1.1rem; margin-bottom: 1.25rem; font-size: .9rem; color: var(--ink-soft);
}
.tb-sub-pkg { font-family: var(--font-display); font-weight: 600; color: var(--plum-ink); font-size: 1rem; }

.tb-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.tb-kpi {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .3rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.15rem; color: var(--ink);
  box-shadow: inset 0 1px 0 var(--inset-hi), var(--shadow);
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out), border-color .18s var(--ease-out);
}
/* Filo superior (mismo patrón que la tarjeta del login): overflow:hidden lo recorta a los bordes. */
.tb-kpi::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--plum));
  opacity: 0; transform: scaleX(.6); transform-origin: left;
  transition: opacity .18s var(--ease-out), transform .22s var(--ease-out);
}
.tb-kpi:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 1px 0 var(--inset-hi), 0 2px 6px rgba(31,27,46,.08), 0 18px 40px -16px rgba(31,27,46,.30);
}
.tb-kpi:hover::before { opacity: 1; transform: scaleX(1); }
a.tb-kpi:hover { border-color: var(--plum); text-decoration: none; }
.tb-kpi-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tb-kpi-value { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1; color: var(--ink); }
.tb-kpi-value small { font-family: var(--font-sans); font-size: .9rem; font-weight: 400; color: var(--muted); }
.tb-kpi-foot { font-size: .82rem; color: var(--muted); }
.tb-kpi-alert { border-color: var(--gold-700); box-shadow: 0 0 0 1px var(--gold-700) inset, var(--shadow); }
.tb-kpi-alert:hover { box-shadow: 0 0 0 1px var(--gold-700) inset, 0 2px 6px rgba(31,27,46,.08), 0 18px 40px -16px rgba(31,27,46,.30); }
.tb-kpi-alert .tb-kpi-value { color: var(--warn); }

.tb-dash-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1.25rem; align-items: start; }
.tb-dash-grid .tb-panel h2 { font-size: 1.2rem; margin: 0 0 1rem; }
/* Profundidad y vida en los paneles del dashboard (sin tocar los paneles de formulario). */
.tb-dash .tb-panel {
  box-shadow: inset 0 1px 0 var(--inset-hi), var(--shadow);
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.tb-dash .tb-panel:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 var(--inset-hi), 0 2px 6px rgba(31,27,46,.08), 0 22px 48px -18px rgba(31,27,46,.32);
}
/* Filas de rifas: realce sutil al pasar el cursor. */
.tb-raffle-row { border-radius: var(--radius-sm); transition: background-color .15s var(--ease-out); }
.tb-raffle-row:hover { background: var(--plum-050); }
.tb-chart-wrap { position: relative; height: 260px; }
.tb-chart-canvas { width: 100%; height: 100%; }
.tb-chart-wide { height: 260px; }
.tb-chart-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; margin-top: 1.25rem; }

.tb-raffle-row { padding: .7rem .6rem; margin: 0 -.6rem; border-bottom: 1px solid var(--line); }
.tb-raffle-row:last-child { border-bottom: 0; }
.tb-raffle-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .45rem; }
.tb-raffle-head-right { display: inline-flex; align-items: center; gap: .55rem; }
.tb-raffle-head-right a.tb-pill { text-decoration: none; }
.tb-raffle-rev { font-weight: 600; color: var(--plum-ink); font-variant-numeric: tabular-nums; }
.tb-progress { height: 8px; background: var(--plum-050); border-radius: 999px; overflow: hidden; }
.tb-progress-bar { display: block; height: 100%; background: linear-gradient(90deg, var(--plum), var(--gold)); border-radius: 999px; transition: width .4s ease; }
.tb-raffle-meta { display: flex; justify-content: space-between; margin-top: .35rem; font-size: .82rem; color: var(--muted); }

/* Siempre 2 KPIs por fila en pantallas medianas y móviles. */
@media (max-width: 1000px) { .tb-kpis { grid-template-columns: repeat(2, 1fr); } .tb-dash-grid { grid-template-columns: 1fr; } .tb-chart-cols { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .tb-kpis { gap: .6rem; } .tb-kpi { padding: .85rem .8rem; } .tb-kpi-value { font-size: 1.6rem; } }

/* ---------- Movimiento sutil (paridad con el sitio público) ---------- */
@keyframes tb-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.tb-panel, .tb-card { animation: tb-fade-up .38s cubic-bezier(.2,.7,.2,1) both; }
.tb-cards .tb-card:nth-child(2) { animation-delay: .05s; }
.tb-cards .tb-card:nth-child(3) { animation-delay: .1s; }
.tb-cards .tb-card:nth-child(4) { animation-delay: .15s; }
.tb-cards .tb-card:nth-child(n+5) { animation-delay: .2s; }


@media (max-width: 640px) { .tb-grid-2 { grid-template-columns: 1fr; } }

/* ---------- Mi negocio (perfil del tenant) ---------- */
.tb-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.tb-biz-toolbar-actions { display: inline-flex; align-items: center; gap: .8rem; }
.tb-biz-saved { color: var(--success); font-weight: 600; font-size: .9rem; }
.tb-biz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.5rem; align-items: start; }
.tb-biz-form { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.tb-biz-form-foot { margin-top: .25rem; }

.tb-biz-asset { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.tb-biz-asset-label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.tb-biz-asset-prev { width: 100%; height: 84px; border: 1px dashed var(--line); border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--plum-050); color: var(--muted); overflow: hidden; }
.tb-biz-asset-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tb-biz-asset-sm { height: 84px; }
.tb-biz-asset-sm img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.tb-biz-upload { cursor: pointer; display: inline-block; }

.tb-biz-faq { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem .9rem; display: flex; flex-direction: column; gap: .6rem; margin-bottom: .6rem; }
.tb-biz-faq-head { display: flex; align-items: center; justify-content: space-between; }
.tb-biz-faq-move { display: inline-flex; gap: .25rem; }

/* Panel de previsualización */
.tb-biz-preview-wrap { position: sticky; top: 1rem; }
.tb-biz-preview-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; font-weight: 600; color: var(--muted); font-size: .85rem; }
.tb-biz-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.tb-biz-seg button { border: 0; background: var(--surface); padding: .3rem .8rem; font: inherit; font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.tb-biz-seg button.on { background: var(--plum); color: #fff; }

.tb-biz-phone { --bz-primary: #5B2A86; --bz-secondary: #C6A15B; width: 100%; max-width: 360px; margin: 0 auto; background: #fff; border: 8px solid #1F1B2E; border-radius: 32px; box-shadow: var(--shadow-lg); overflow: hidden; position: relative; }
.tb-biz-phone-notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 110px; height: 18px; background: #1F1B2E; border-radius: 0 0 12px 12px; z-index: 3; }
.tb-biz-screen { height: 560px; overflow-y: auto; position: relative; background: #FAF8F5; }
.tb-biz-screen::-webkit-scrollbar { width: 4px; }
.tb-biz-screen::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.tb-biz-preview-note { text-align: center; color: var(--muted); font-size: .78rem; margin-top: .7rem; }

@media (max-width: 1080px) {
  .tb-biz-layout { grid-template-columns: 1fr; }
  /* En pantallas angostas el formulario va primero; la vista previa queda debajo. */
  .tb-biz-preview-wrap { position: static; }
  .tb-biz-phone { max-width: 320px; }
}
@media (max-width: 640px) { .tb-grid-3 { grid-template-columns: 1fr; } }

/* ---------- Diseño de rifa: preview del hero ---------- */
.tb-brand-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; }
.tb-brand-form { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.tb-brand-preview-wrap { position: sticky; top: 1rem; }
@media (max-width: 1000px) {
  .tb-brand-layout { grid-template-columns: 1fr; }
  .tb-brand-preview-wrap { position: static; order: -1; }
}

/* ---------- Equipo (staff del tenant) ---------- */
.tb-team-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.tb-team-pwd { display: flex; gap: .5rem; align-items: center; }
.tb-team-pwd input { flex: 1; }
.tb-team-created { margin-top: 1.25rem; border: 1px solid var(--success); background: var(--success-050); border-radius: var(--radius); padding: 1rem 1.1rem; }
.tb-team-created-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.tb-team-created-head strong { color: var(--success); }
.tb-team-created-note { font-size: .88rem; margin: 0 0 .6rem; }
.tb-team-warn { color: var(--warn); }
.tb-team-creds { margin: 0 0 .7rem; display: flex; flex-direction: column; gap: .3rem; }
.tb-team-creds div { display: flex; gap: .8rem; font-size: .9rem; }
.tb-team-creds dt { flex: 0 0 130px; color: var(--muted); font-weight: 600; margin: 0; }
.tb-team-creds dd { margin: 0; color: var(--ink); word-break: break-all; font-variant-numeric: tabular-nums; }
.tb-team-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tb-team-list li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem .1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tb-team-member { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.tb-team-member .tb-avatar { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; background: var(--plum-050); color: var(--plum-ink-700); display: grid; place-items: center; font-weight: 700; }
.tb-team-member-info { display: flex; flex-direction: column; min-width: 0; }
.tb-team-member-email { font-size: .82rem; color: var(--muted); }
.tb-team-member-tags { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.tb-team-actions { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.tb-team-list li.is-disabled .tb-team-member { opacity: .55; }
.tb-team-reset { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: .6rem; padding: .8rem; background: var(--plum-050); border-radius: var(--radius-sm); }
.tb-team-reset .tb-team-pwd { flex: 1 1 220px; }
.tb-team-reset-send { margin: 0; }
@media (max-width: 960px) { .tb-team-layout { grid-template-columns: 1fr; } }

/* Mi cuenta */
.tb-me-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.tb-me-layout a.tb-mini { display: inline-block; text-decoration: none; }
.tb-me-side { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
@media (max-width: 960px) { .tb-me-layout { grid-template-columns: 1fr; } }

/* Pantallas táctiles: los botones compactos crecen a un área cómoda para el dedo. */
@media (pointer: coarse) {
  .tb-mini { min-height: 40px; padding: .45rem .95rem; font-size: .85rem; }
  a.tb-mini { display: inline-flex; align-items: center; }
  .tb-thumb-del { width: 32px; height: 32px; line-height: 32px; font-size: 1.15rem; }
  .tb-actions button, .tb-winner-controls button, .tb-modal-footer button { min-height: 44px; }
}

/* ---------- Carga ---------- */
.tb-loading { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .92rem; }
.tb-loading::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px;
  border: 2px solid var(--plum-050); border-top-color: var(--plum);
  animation: tb-spin .8s linear infinite;
}
@keyframes tb-spin { to { transform: rotate(360deg); } }
.tb-skel {
  min-height: 118px; box-shadow: none;
  background: linear-gradient(100deg, var(--surface) 30%, var(--plum-050) 50%, var(--surface) 70%) 0 0 / 300% 100%;
  animation: tb-shimmer 1.3s ease-in-out infinite;
}
.tb-skel:hover { transform: none; box-shadow: none; }
.tb-skel::before { display: none; }
@keyframes tb-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Movimiento reducido: se quitan desplazamientos, escalas y bucles decorativos, pero se
   conservan los cambios de color/opacidad (retroalimentación de hover/foco/estado). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tb-panel, .tb-card, .tb-modal, .tb-modal-backdrop { animation: none; }
  .tb-orb, .tb-skel { animation: none; }
  .tb-loading::before { animation-duration: 2.4s; }   /* sigue indicando "trabajando", más calmado */
  button:active:not(:disabled), .btn:active, .tb-side-link:active, a.tb-kpi:active, .tb-tabs button:active,
  .tb-kpi:hover, .tb-dash .tb-panel:hover { transform: none; }
  .tb-sidebar, .tb-progress-bar, .tb-acc-chev, .tb-switch-track::after, .tb-collapse-btn { transition-property: background-color, color, opacity; }
  .tb-kpi::before { transition: opacity .18s; transform: none; }
}

/* Texto solo para lectores de pantalla (encabezados de tabla sin etiqueta visible). */
.tb-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Alta/edición de un paquete de precio (pestaña Paquetes del detalle de rifa). */
.tb-bundle-form { padding: 1rem; margin-bottom: 1rem; }
.tb-bundle-fields { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.tb-bundle-fields label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; }
.tb-bundle-fields label > span { font-weight: 600; color: var(--ink-soft); }
.tb-bundle-fields input[type="number"] { width: 10rem; }
.tb-bundle-fields .tb-check { flex-direction: row; align-items: center; gap: .45rem; }

/* ---------- Acordeón de "Mi negocio" (divulgación progresiva) ---------- */
.tb-acc-sum {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
  font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--ink);
}
.tb-acc-sum:hover { color: var(--plum-ink); }
.tb-acc-chev { color: var(--muted); transition: transform .18s var(--ease-out); flex: 0 0 auto; }
.tb-acc.is-collapsed .tb-acc-chev { transform: rotate(-90deg); }
/* Plegada: solo el encabezado; el cuerpo se oculta. */
.tb-acc.is-collapsed > *:not(.tb-acc-sum) { display: none; }
.tb-acc.is-collapsed { gap: 0; }

/* ---------- Pestañas del detalle agrupadas por fase ---------- */
.tb-tabs-phased { align-items: stretch; gap: 0; }
.tb-tabs-phased .tb-tabgroup { display: inline-flex; flex-direction: column; flex: 0 0 auto; }
.tb-tabs-phased .tb-tabgroup + .tb-tabgroup { margin-left: .6rem; padding-left: .6rem; border-left: 1px solid var(--line); }
.tb-tabgroup-label { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 1.1rem .2rem; white-space: nowrap; }
.tb-tabgroup-btns { display: inline-flex; }

/* ---------- Barra de avance compacta en la lista de rifas ---------- */
.tb-list-progress { height: 6px; background: var(--plum-050); border-radius: 999px; overflow: hidden; width: 120px; max-width: 100%; margin-bottom: .2rem; }
.tb-list-progress-bar { display: block; height: 100%; background: linear-gradient(90deg, var(--plum), var(--gold-700)); border-radius: 999px; }

/* ===== Clientes ===== */
/* Campo y botones en una sola línea también en móvil (el botón no queda huérfano abajo). */
.tb-cust-search { display: flex; gap: .5rem; align-items: center; margin: 0 0 1.1rem; flex-wrap: nowrap; }
.tb-cust-search .tb-mini { flex: 0 0 auto; margin: 0; }
.tb-cust-search input { flex: 1 1 10rem; min-width: 0; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--field); color: var(--ink); }
.tb-cust-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.tb-cust { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) auto; gap: 1rem; align-items: center; padding: 1rem 1.1rem; }
.tb-cust-main { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.tb-cust-info { min-width: 0; display: flex; flex-direction: column; }
.tb-cust-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-cust-contact { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-cust-stats { display: flex; gap: 1.4rem; margin: 0; }
.tb-cust-stats div { display: flex; flex-direction: column; }
.tb-cust-stats dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.tb-cust-stats dd { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.tb-cust-actions { justify-self: end; }
.tb-cust-edit { grid-column: 1 / -1; border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .9rem; }
@media (max-width: 720px) {
    .tb-cust { grid-template-columns: 1fr; }
    .tb-cust-actions { justify-self: start; }
    .tb-cust-stats { gap: 1.1rem; flex-wrap: wrap; }
}


/* ---------- Mi negocio: paletas de color ---------- */
.tb-palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.tb-palette {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; min-height: 44px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--field);
  color: var(--ink); font: inherit; font-size: .85rem; font-weight: 600; text-align: left; cursor: pointer;
}
.tb-palette:hover { border-color: var(--plum-ink); }
.tb-palette.on { border-color: var(--plum); box-shadow: 0 0 0 2px var(--plum); }
.tb-palette-swatch { display: inline-flex; flex: 0 0 auto; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.tb-palette-swatch i { width: 16px; height: 26px; display: block; }
.tb-palette-swatch i:first-child { width: 22px; }
.tb-palette-name { line-height: 1.2; }
.tb-palette-custom { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .8rem .9rem; }
.tb-palette-custom.on { border-style: solid; border-color: var(--plum); }
.tb-palette-custom-title { margin: 0 0 .6rem; font-size: .85rem; font-weight: 700; color: var(--ink-soft); }
.tb-palette-custom-title small { font-weight: 600; color: var(--plum-ink); }
.tb-color-check { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; font-size: .86rem; }
.tb-color-check li { padding: .45rem .7rem; border-radius: var(--radius-sm); }
.tb-color-check .ok { background: var(--success-050); color: var(--success); }
.tb-color-check .info { background: var(--plum-050); color: var(--plum-ink-700); }
.tb-color-check .warn { background: var(--warn-050); color: var(--warn); }

/* ---------- Mi plan (cobro) ---------- */
.tb-billing { display: flex; flex-direction: column; gap: 1.25rem; max-width: 60rem; }
.tb-billing h2, .tb-billing h3, .tb-plan-hero-price strong, .tb-plan-price strong { font-variant-numeric: lining-nums tabular-nums; }

/* Tu plan: lo primero que se lee y la acción que más se usa (renovar). */
.tb-plan-hero {
  display: flex; gap: 1.5rem 2.5rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 1.6rem 1.75rem; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.tb-plan-hero.is-due { background: var(--warn-050); border-color: transparent; color: var(--warn); }
.tb-plan-hero.is-none { background: var(--plum-050); border-color: transparent; }
.tb-plan-hero.is-pending { background: var(--plum-050); border-color: transparent; }
.tb-plan-hero.is-pending .tb-cta { text-decoration: none; display: inline-flex; align-items: center; }
.tb-plan-hero-warn { margin: .35rem 0 0; padding: .55rem .75rem; border-radius: var(--radius-sm); background: var(--warn-050); color: var(--warn); font-size: .88rem; max-width: 62ch; }
.tb-plan-hero-main { flex: 1 1 22rem; min-width: 0; display: flex; flex-direction: column; gap: .45rem; }
.tb-plan-hero h2 { margin: 0; font-size: clamp(1.45rem, 1.1rem + 1.2vw, 1.9rem); line-height: 1.15; text-wrap: balance; color: var(--ink); }
.tb-plan-hero.is-due h2, .tb-plan-hero.is-due .tb-plan-hero-line { color: inherit; }
.tb-plan-hero-state { margin: 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; color: var(--muted); font-size: .88rem; }
.tb-plan-hero-line { margin: .15rem 0 0; font-size: 1rem; line-height: 1.5; max-width: 60ch; color: var(--ink-soft); }
.tb-plan-hero-line strong { color: var(--ink); font-weight: 600; }
.tb-plan-hero.is-due .tb-plan-hero-line strong { color: inherit; }
.tb-plan-hero-hint { margin: 0; font-size: .88rem; color: var(--muted); max-width: 60ch; }
.tb-plan-hero-aside { display: flex; flex-direction: column; align-items: flex-end; gap: .65rem; text-align: right; }
.tb-plan-hero-aside form { margin: 0; }
.tb-plan-hero-price { margin: 0; color: var(--muted); font-size: .9rem; }
.tb-plan-hero-price strong { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; color: var(--ink); line-height: 1; }
.tb-plan-hero.is-due .tb-plan-hero-price, .tb-plan-hero.is-due .tb-plan-hero-price strong { color: inherit; }
/* Acciones secundarias de la suscripción: enlaces, para no competir con la principal. */
.tb-plan-hero-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .25rem 1rem; }
.tb-plan-hero-links form { margin: 0; }
.tb-link-btn {
  font: 600 .88rem/1.2 var(--font-sans); background: none; border: 0; padding: .6rem .1rem; min-height: 44px; cursor: pointer;
  color: var(--plum-ink); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
  transition: text-decoration-color .15s var(--ease-out);
}
.tb-link-btn:hover { text-decoration-color: currentColor; }
.tb-link-btn:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; border-radius: 4px; }
.tb-link-danger { color: var(--danger); }
/* Va después de las reglas base (misma especificidad): el acomodo depende del ancho del bloque, no de la ventana (con el menú abierto se angosta antes). */
.tb-plan-hero { container-type: inline-size; }
@container (max-width: 40rem) {
  .tb-plan-hero-aside { align-items: stretch; text-align: left; width: 100%; }
  .tb-plan-hero-aside .tb-cta, .tb-plan-hero-aside .tb-cta-ghost { width: 100%; justify-content: center; }
  .tb-plan-hero-links { justify-content: flex-start; }
}

/* Botones de la página: principal (relleno) y secundario (contorno). */
.tb-cta, .tb-cta-ghost {
  font: 600 .95rem/1.2 var(--font-sans); min-height: 44px; padding: .7rem 1.35rem; border-radius: 999px; cursor: pointer;
  transition: background .18s var(--ease-out), border-color .18s var(--ease-out), color .18s var(--ease-out), transform .12s var(--ease-out);
}
.tb-cta { background: var(--plum); border: 1px solid var(--plum); color: #fff; box-shadow: 0 6px 18px -8px rgba(91, 42, 134, .6); }
:root[data-theme="dark"] .tb-cta { box-shadow: none; }
.tb-cta:hover { background: var(--plum-700); border-color: var(--plum-700); }
.tb-cta-ghost { background: transparent; border: 1px solid var(--line); color: var(--plum-ink); }
.tb-cta-ghost:hover:not(:disabled) { background: var(--plum-050); border-color: var(--plum-050); }
.tb-cta:active, .tb-cta-ghost:active:not(:disabled) { transform: scale(.97); }
.tb-cta:focus-visible, .tb-cta-ghost:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.tb-cta-ghost:disabled { opacity: .5; cursor: not-allowed; }

.tb-billing-note { margin: 0; padding: .75rem 1rem; border-radius: var(--radius-sm); background: var(--neutral-050); color: var(--ink-soft); font-size: .9rem; line-height: 1.5; }
.tb-billing-note strong { color: var(--ink); }
.tb-billing-flash { margin: 0; padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .92rem; font-weight: 500; }
.tb-billing-flash.is-ok { background: var(--success-050); color: var(--success); }
.tb-billing-flash.is-bad { background: var(--danger-050); color: var(--danger); }

/* Cambiar de plan: plegado cuando lo común es renovar; una comparación, no un catálogo. */
.tb-plans-panel { container-type: inline-size; gap: .9rem; }
.tb-plans-panel > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; min-height: 44px; gap: .35rem 1rem; flex-wrap: wrap;
  margin: -.25rem 0; padding: .25rem 2rem .25rem 0; position: relative; border-radius: var(--radius-sm);
}
.tb-plans-panel > summary::-webkit-details-marker { display: none; }
.tb-plans-panel > summary::after {
  content: ""; position: absolute; right: .35rem; top: 50%; width: .55rem; height: .55rem; margin-top: -.4rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
  transition: transform .2s var(--ease-out);
}
.tb-plans-panel[open] > summary::after { transform: rotate(225deg); margin-top: -.15rem; }
.tb-plans-panel > summary:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 4px; }
.tb-plans-summary-title { margin: 0; font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: var(--ink); }
.tb-plans-summary-hint { font-size: .85rem; color: var(--muted); }

.tb-plans { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.tb-plan {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 7.5rem; gap: .6rem 1.5rem; align-items: center;
  padding: 1rem 1rem; border-radius: var(--radius); border: 1px solid transparent;
}
.tb-plan + .tb-plan { border-top-color: var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.tb-plan.is-current { background: var(--plum-050); border-color: transparent; }
.tb-plan.is-current + .tb-plan, .tb-plan + .tb-plan.is-current { border-top-color: transparent; }
.tb-plan h3 { margin: 0; font-size: 1.1rem; color: var(--ink); }
.tb-plan-specs { margin: .35rem 0 0; display: flex; flex-wrap: wrap; gap: .2rem 1.25rem; color: var(--muted); font-size: .9rem; }
.tb-plan-specs strong { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.tb-plan-buy { text-align: right; }
.tb-plan-price { margin: 0; white-space: nowrap; color: var(--muted); font-size: .85rem; }
.tb-plan-price strong { font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; color: var(--ink); }
.tb-plan-due { margin: .2rem 0 0; font-size: .82rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.tb-plan-cta { display: flex; justify-content: flex-end; }
.tb-plan-cta .tb-cta-ghost { width: 100%; }
/* Selector de periodo (mensual / semestral / anual): uno para todos los paquetes. */
.tb-period-seg {
  margin: 0 0 .35rem; padding: 3px; align-self: flex-start; display: inline-flex; flex-wrap: wrap; gap: 2px; min-width: 0;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
}
.tb-panel .tb-period-seg label {
  flex-direction: row; align-items: center; gap: .4rem; min-height: 40px; padding: 0 1rem; border-radius: 999px;
  font-size: .88rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: background .18s var(--ease-out), color .18s var(--ease-out);
}
.tb-panel .tb-period-seg label:hover { color: var(--ink); }
.tb-period-seg svg { width: 14px; height: 14px; display: none; }
.tb-period-save { padding: .05rem .45rem; border-radius: 999px; background: var(--success-050); color: var(--success); font-size: .74rem; font-weight: 700; }
.tb-panel .tb-period-seg input:checked + label { background: var(--plum); color: #fff; }
.tb-period-seg input:checked + label svg { display: block; }
.tb-period-seg input:checked + label .tb-period-save { background: rgba(255, 255, 255, .2); color: #fff; }
.tb-period-seg input:focus-visible + label { outline: 3px solid var(--gold-soft); outline-offset: 2px; }

/* Una tarjeta por paquete; el precio cambia con el periodo elegido. */
.tb-tiers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .9rem; }
.tb-tier { display: flex; flex-direction: column; gap: .75rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tb-tier.is-current { background: var(--plum-050); border-color: transparent; }
.tb-tier-name { margin: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem .6rem; font-size: 1.15rem; color: var(--ink); }
.tb-tier-name .tb-pill { font-family: var(--font-sans); }
.tb-tier .tb-plan-specs { margin: 0; flex-direction: column; gap: .2rem; }
.tb-tier .tb-plan-warn, .tb-tier .tb-plan-fit { margin: 0; }
.tb-tier-opt { flex: 1; display: flex; flex-direction: column; gap: .9rem; }
.tb-tier .tb-plan-price strong { font-size: 1.75rem; }
.tb-tier-eq { margin: .2rem 0 0; font-size: .82rem; color: var(--muted); }
.tb-tier-eq strong { color: var(--success); font-weight: 600; white-space: nowrap; }
.tb-tier .tb-plan-due { white-space: normal; }
.tb-tier-na { margin: 0; font-size: .88rem; color: var(--muted); }
.tb-tier-cta { margin-top: auto; }
.tb-tier-cta .tb-cta, .tb-tier-cta .tb-cta-ghost { width: 100%; }
.tb-tier-cta .tb-plan-current { display: block; padding: .7rem 0; text-align: center; }
/* En celular: tres columnas iguales, el ahorro debajo del nombre, sin palomita. */
@container (max-width: 560px) {
  .tb-period-seg { align-self: stretch; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border-radius: var(--radius); }
  .tb-panel .tb-period-seg label {
    flex-direction: column; justify-content: center; gap: .15rem; min-height: 52px; padding: .35rem .25rem;
    border-radius: calc(var(--radius) - 3px); font-size: .84rem;
  }
  .tb-period-seg input:checked + label svg { display: none; }
}
.tb-free-trial { padding: 0; container-type: inline-size; }  /* sin contenedor, en celular el nombre quedaba a una palabra por renglón */
.tb-free-trial .tb-plan { background: var(--plum-050); border-color: transparent; }
.tb-free-trial .tb-plan-warn { margin: .5rem 1rem; }
.tb-plan-cta .tb-cta { width: 100%; }
.tb-plan-current { font-size: .82rem; font-weight: 600; color: var(--plum-ink); white-space: nowrap; }

@container (max-width: 560px) {
  .tb-plan { grid-template-columns: minmax(0, 1fr) auto; }
  .tb-plan-cta { grid-column: 1 / -1; }
  .tb-plan-cta .tb-plan-current { width: 100%; text-align: left; }
}

/* Diálogo "¿Cómo quieres pagar?": cada forma de pago explica cuánto y hasta cuándo, ahí mismo. */
dialog.tb-pay-dialog { padding: 0; border: 0; max-width: 520px; width: calc(100% - 2rem); }
dialog.tb-pay-dialog:not([open]) { display: none; }
dialog.tb-pay-dialog::backdrop { background: rgba(31, 27, 46, .55); }
:root[data-theme="dark"] dialog.tb-pay-dialog::backdrop { background: rgba(6, 4, 10, .74); }
.tb-pay-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.tb-pay-head h2 { margin: 0; font-size: 1.2rem; font-weight: 700; font-family: var(--font-display); color: var(--ink); }
.tb-pay-close {
  flex: 0 0 auto; width: 44px; height: 44px; margin: -.55rem -.75rem 0 0; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
.tb-pay-close svg { width: 20px; height: 20px; }
.tb-pay-close:hover { background: var(--neutral-050); color: var(--ink); }
.tb-pay-close:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 0; }
.tb-pay-dialog .tbc-btn { min-height: 44px; }
.tb-pay-dialog .tbc-head h2 span { font-family: var(--font-sans); font-size: .95rem; font-weight: 500; color: var(--muted); }
.tb-pay-dialog .tbc-foot { margin: 0; }
.tb-pay-ask { margin: 0 0 .75rem; color: var(--muted); font-size: .9rem; }
.tb-pay-options { display: flex; flex-direction: column; gap: .6rem; }
.tb-pay-options form { margin: 0; }
.tb-pay-option {
  width: 100%; display: flex; gap: .9rem; align-items: flex-start; text-align: left; cursor: pointer;
  padding: .95rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; transition: border-color .18s var(--ease-out), background .18s var(--ease-out), transform .12s var(--ease-out);
}
.tb-pay-option:hover:not(:disabled) { border-color: var(--plum); background: var(--plum-050); }
.tb-pay-option:active:not(:disabled) { transform: scale(.99); }
.tb-pay-option:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.tb-pay-option:disabled { opacity: .6; cursor: progress; }
.tb-pay-option.is-busy { border-color: var(--plum); }
.tb-pay-option svg { width: 26px; height: 26px; flex: 0 0 26px; color: var(--plum-ink); margin-top: .1rem; }
.tb-pay-option-text { display: flex; flex-direction: column; gap: .2rem; }
.tb-pay-option-text strong { font-weight: 600; }
.tb-pay-option-text span { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.tb-pay-foot { margin: .8rem 0 0; font-size: .85rem; color: var(--muted); }
.tb-pay-warn { padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--warn-050); color: var(--warn); }
.tb-plan-warn { margin: .35rem 0 0; font-size: .82rem; color: var(--warn); }
.tb-plan-warn a { color: inherit; font-weight: 600; text-underline-offset: 3px; white-space: nowrap; }
.tb-history-sub { margin: 0; font-family: var(--font-sans); font-size: .8rem; font-weight: 700; color: var(--muted); }
.tb-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Historial: una sola línea de tiempo, del más reciente al más antiguo. */
.tb-billing-history h2 { margin: 0; font-size: 1.2rem; }
.tb-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.tb-tl-item {
  display: grid; grid-template-columns: 6.5rem 1.25rem minmax(0, 1fr); gap: 0 .5rem; position: relative;
  padding-bottom: 1.1rem;
}
.tb-tl-item:last-child { padding-bottom: 0; }
/* Riel y punto: el punto lleva el tono del evento (pago, pendiente, rechazo...). */
.tb-tl-item::before {
  content: ""; grid-column: 2; grid-row: 1; justify-self: center; width: 10px; height: 10px; margin-top: .4rem;
  border-radius: 50%; background: var(--dot, var(--muted)); box-shadow: 0 0 0 4px var(--surface); z-index: 1;
}
.tb-tl-item::after {
  content: ""; position: absolute; left: calc(6.5rem + .5rem + .625rem - 1px); top: 1rem; bottom: -.1rem;
  width: 2px; background: var(--line);
}
.tb-tl-item:last-child::after { display: none; }
.tb-tl-item.tone-ok { --dot: var(--success); }
.tb-tl-item.tone-warn { --dot: var(--gold-700); }
.tb-tl-item.tone-bad { --dot: var(--danger); }
.tb-tl-item.tone-info { --dot: var(--plum-ink); }
.tb-tl-date { grid-column: 1; grid-row: 1; font-size: .82rem; color: var(--muted); padding-top: .15rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tb-tl-date span { display: block; font-size: .75rem; }
.tb-tl-body { grid-column: 3; min-width: 0; }
.tb-tl-title { margin: 0; display: flex; justify-content: space-between; gap: .25rem 1rem; flex-wrap: wrap; color: var(--ink); font-weight: 600; }
.tb-tl-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-tl-detail { margin: .15rem 0 0; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.tb-tl-meta { margin: .3rem 0 0; display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: .82rem; color: var(--ink-soft); }
.tb-tl-meta a { color: var(--plum-ink); font-weight: 600; text-underline-offset: 3px; }
/* Planes del historial: un renglón por plan; al abrirlo aparece su línea de tiempo. */
.tb-timeline-loose { margin-bottom: .5rem; }
.tb-periods { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tb-periods > li + li { border-top: 1px solid var(--line); }
.tb-period > summary {
  list-style: none; cursor: pointer; position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 1rem; align-items: center;
  padding: .85rem 2.25rem .85rem 0; border-radius: var(--radius-sm);
}
.tb-period > summary::-webkit-details-marker { display: none; }
.tb-period > summary::after {
  content: ""; position: absolute; right: .5rem; top: 50%; width: .5rem; height: .5rem; margin-top: -.35rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
  transition: transform .2s var(--ease-out);
}
.tb-period[open] > summary::after { transform: rotate(225deg); margin-top: -.1rem; }
.tb-period > summary:hover .tb-period-name { color: var(--plum-ink); }
.tb-period > summary:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.tb-period-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; min-width: 0; }
.tb-period-name { font-weight: 600; color: var(--ink); transition: color .15s var(--ease-out); }
.tb-period-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: .1rem .9rem; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tb-period-total { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-period-total span { font-weight: 400; color: var(--muted); font-size: .85rem; }
.tb-period[open] { padding-bottom: 1rem; }
.tb-period[open] > summary { margin-bottom: .75rem; }
.tb-period-empty { margin: 0; }

@media (max-width: 720px) {
  .tb-plan-hero { padding: 1.25rem; }
  /* Menos relleno doble (panel + renglón) para que nombres y límites no se partan. */
  .tb-plans-panel .tb-plan { padding-inline: 0; }
  .tb-plans-panel .tb-plan.is-current { padding-inline: .75rem; margin-inline: -.75rem; }
  .tb-plan-specs { gap: .1rem .9rem; font-size: .85rem; }
  /* En celular la fecha sube encima del evento y el riel queda a la izquierda. */
  .tb-tl-item { grid-template-columns: 1.25rem minmax(0, 1fr); }
  .tb-tl-item::before { grid-column: 1; grid-row: 1; }
  .tb-tl-date { grid-column: 2; grid-row: 1; }
  .tb-tl-body { grid-column: 2; grid-row: 2; }
  .tb-tl-item::after { left: calc(.625rem - 1px); }
}

/* Checkout embebido y ficha OXXO */
.tb-billing-status { display: flex; gap: 1rem; align-items: flex-start; padding: 1.25rem 1.5rem; border-radius: var(--radius); }
.tb-billing-status h2 { margin: 0 0 .25rem; font-size: 1.3rem; line-height: 1.25; text-wrap: balance; color: inherit; }
.tb-billing-status p { margin: 0; max-width: 62ch; line-height: 1.5; color: inherit; }
.tb-billing-status.is-due { background: var(--warn-050); color: var(--warn); }
.tb-billing-status.is-info { background: var(--plum-050); color: var(--ink); }
.tb-billing-status.is-info .tb-billing-ico { color: var(--plum-ink); }
.tb-billing-ico { width: 28px; height: 28px; flex: 0 0 28px; margin-top: .1rem; }
.tb-checkout-summary { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: flex-start; justify-content: space-between; }
.tb-checkout-summary p { margin: 0; max-width: 60ch; line-height: 1.5; }
.tb-checkout-summary strong { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }
.tb-checkout-summary .tb-hint { display: block; margin-top: .25rem; }
/* El formulario de Stripe es claro: se le da su propia superficie blanca también en modo oscuro. */
.tb-checkout-mount { background: #fff; border-radius: var(--radius); padding: 1rem; min-height: 22rem; border: 1px solid var(--line); }
.tb-checkout-mount .tb-loading { color: #6F6860; }
.tb-billing-cta {
  display: inline-block; text-decoration: none; font: 600 .9rem/1.2 var(--font-sans); padding: .65rem 1.2rem; border-radius: 999px;
  background: var(--plum); color: #fff; border: 1px solid var(--plum);
}
.tb-billing-cta:hover { background: var(--plum-700); color: #fff; }
@media (max-width: 720px) {
  .tb-billing-status { padding: 1rem; }
  .tb-checkout-mount { padding: .25rem; }
}

/* Modal de historial del Manager */
.tb-modal.tb-modal-wide { max-width: 720px; }
.tb-mgr-current { padding: .9rem 1rem; margin-bottom: 1rem; border-radius: var(--radius); background: var(--neutral-050); }
.tb-mgr-current p { margin: 0; }
.tb-mgr-current-title { display: flex; align-items: center; gap: .6rem; font-weight: 600; color: var(--ink); }
.tb-mgr-current-meta { margin-top: .3rem !important; display: flex; flex-wrap: wrap; gap: .15rem 1rem; font-size: .85rem; color: var(--muted); }
.tb-mgr-current-none { color: var(--warn); font-weight: 600; }
.tb-mgr-warn { color: var(--warn); font-weight: 600; }
.tb-modal-wide .tb-history-sub { margin: .25rem 0 .35rem; }

/* Ficha OXXO lista (Checkout embebido): salida clara sin quitar la ficha de la pantalla. */
.tb-voucher-ready {
  display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--success-050); color: var(--success);
  position: sticky; top: .75rem; z-index: 5;
}
.tb-voucher-ready[hidden] { display: none; }
@media (max-width: 767px) { .tb-voucher-ready { top: 4.25rem; } }   /* debajo de la barra superior fija */
.tb-voucher-ready p { margin: 0; max-width: 60ch; line-height: 1.45; }
.tb-voucher-ready .tb-cta { text-decoration: none; display: inline-flex; align-items: center; }

.tb-plan-fit { margin: .35rem 0 0; font-size: .82rem; font-weight: 600; color: var(--success); }
.tb-period-credit { display: block; font-weight: 500; font-size: .82rem; color: var(--muted); }
.tb-inline-link {
  font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.tb-inline-link:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; border-radius: 3px; }
@media (max-width: 720px) {
  /* Historial en celular: el total baja a su propia línea para no apretar fechas y estado. */
  .tb-period > summary { grid-template-columns: minmax(0, 1fr); }
  .tb-period-total { grid-column: 1; grid-row: auto; text-align: left; }
}

/* ---------- Registro: "Crea tu negocio" como boleto de rifa ---------- */
.tb-signup { width: 100%; display: flex; justify-content: center; padding: clamp(.5rem, 3vw, 2rem) 0; }
.tb-ticket {
  --ticket-r: 20px;      /* radio de las esquinas */
  --notch: 13px;         /* media luna de la perforación */
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 300px);
  width: min(920px, 100%); position: relative;
  /* La sombra sigue la silueta recortada (muescas incluidas): drop-shadow, no box-shadow. */
  filter: drop-shadow(0 28px 44px rgba(8, 4, 16, .45)) drop-shadow(0 2px 3px rgba(8, 4, 16, .25));
}
.tb-ticket-body, .tb-ticket-stub { position: relative; }
.tb-ticket-body {
  background: #fff; color: var(--ink);
  border-radius: var(--ticket-r) 0 0 var(--ticket-r);
  padding: clamp(1.5rem, 3.5vw, 2.5rem) clamp(1.25rem, 3.5vw, 2.5rem);
  /* Muescas arriba y abajo del lado de la perforación */
  /* Muescas: dos capas completas que se intersectan (sin costura donde se juntarían mitades) */
  -webkit-mask: radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000),
                radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000);
  -webkit-mask-composite: source-in;
          mask: radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000),
                radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000);
          mask-composite: intersect;
}
.tb-ticket-body::before {   /* filo dorado del mundo de acceso */
  content: ""; position: absolute; left: var(--ticket-r); right: calc(var(--notch) + 6px); top: 0; height: 3px;
  border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--gold), var(--plum));
}
.tb-ticket-stub {
  background: linear-gradient(165deg, #3a2258 0%, #2a1a42 55%, #1F1B2E 100%); color: #fff;
  border-radius: 0 var(--ticket-r) var(--ticket-r) 0;
  padding: clamp(1.5rem, 3vw, 2.25rem) clamp(1.25rem, 2.5vw, 1.75rem);
  display: flex; flex-direction: column; gap: .9rem;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000),
                radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000);
  -webkit-mask-composite: source-in;
          mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000),
                radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000);
          mask-composite: intersect;
  transition: transform .45s var(--ease-out);
  transform-origin: 0 50%;
}
.tb-ticket-stub::before {   /* perforación */
  content: ""; position: absolute; left: 0; top: calc(var(--notch) + 8px); bottom: calc(var(--notch) + 8px);
  border-left: 2px dashed rgba(231, 214, 174, .45);
}

.tb-ticket-body h1 { margin: .25rem 0 .35rem; font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.35rem); line-height: 1.1; color: var(--ink); }
.tb-ticket-lead { margin: 0 0 1.25rem; color: var(--muted); line-height: 1.55; max-width: 44ch; }
.tb-ticket-errors ul { margin: 0 0 1rem; padding: .7rem 1rem .7rem 2rem; border-radius: var(--radius-sm); background: var(--danger-050); color: var(--danger); font-size: .9rem; }
.tb-ticket-errors.validation-summary-valid { display: none; }

.tb-ticket-group { border: 0; padding: 0; margin: 0 0 1.1rem; display: grid; gap: .85rem; min-width: 0; }
.tb-ticket-group legend { padding: 0; margin: 0 0 .15rem; font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; color: var(--ink); }

.tb-field { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin: 0; min-width: 0; }
.tb-field input, .tb-address, .tb-password {
  font: 400 1rem/1.3 var(--font-sans); color: var(--ink); background: #fff;
  border: 1px solid #D9D2E3; border-radius: 10px; min-height: 46px;
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.tb-field input { padding: .65rem .8rem; width: 100%; }
.tb-field input::placeholder { color: #6F6860; }
.tb-field input:focus, .tb-address:focus-within, .tb-password:focus-within {
  outline: none; border-color: var(--plum); box-shadow: 0 0 0 3px rgba(91, 42, 134, .18);
}
.tb-field input.input-validation-error, .tb-field input[aria-invalid="true"] { border-color: var(--danger); }
.tb-field-error { color: var(--danger); font-weight: 500; font-size: .82rem; }
.tb-field-error:empty { display: none; }
.tb-field-note { font-weight: 500; font-size: .82rem; color: var(--muted); min-height: 1.2em; }
.tb-field-note.is-ok { color: var(--success); }
.tb-field-note.is-bad { color: var(--danger); }

/* Dirección: el sufijo del dominio va pegado al campo, como se verá en el navegador */
.tb-address { display: flex; align-items: stretch; overflow: hidden; }
.tb-address input { border: 0; box-shadow: none !important; min-width: 0; flex: 1 1 auto; padding-right: .25rem; }
.tb-address input:focus { outline: none; }
.tb-address-suffix { display: flex; align-items: center; padding: 0 .8rem 0 .15rem; color: var(--muted); font-weight: 500; white-space: nowrap; }

.tb-password { display: flex; align-items: stretch; overflow: hidden; }
.tb-password input { border: 0; box-shadow: none !important; min-width: 0; flex: 1 1 auto; }
.tb-password input:focus { outline: none; }
.tb-password-toggle {
  border: 0; background: none; padding: 0 .9rem; min-width: 44px; cursor: pointer;
  font: 600 .82rem/1 var(--font-sans); color: var(--plum-ink);
}
.tb-password-toggle:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: -3px; border-radius: 8px; }
.tb-pass-rules { list-style: none; margin: .1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem .4rem; }
.tb-pass-rules li {
  font-weight: 500; font-size: .76rem; color: var(--muted); padding: .2rem .55rem; border-radius: 999px;
  background: #F3F0F6; transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.tb-pass-rules li.is-met { background: var(--success-050); color: var(--success); }
.tb-pass-rules li { display: inline-flex; align-items: center; gap: .3rem; }
.tb-pass-rules li.is-met::before {
  content: ""; width: 12px; height: 12px; flex: 0 0 12px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.tb-terms { display: flex; gap: .6rem; align-items: flex-start; font-size: .88rem; color: var(--ink-soft); margin: .25rem 0 .2rem; cursor: pointer; }
.tb-terms input { width: 20px; height: 20px; margin-top: .05rem; accent-color: var(--plum); flex: 0 0 auto; }
.tb-terms a, .tb-ticket-alt a { color: var(--plum-ink); font-weight: 600; text-underline-offset: 3px; }
.tb-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.tb-ticket-submit {
  width: 100%; margin-top: 1rem; min-height: 50px; border: 0; border-radius: 999px; cursor: pointer;
  font: 600 1.05rem/1.2 var(--font-sans); color: #fff;
  background: linear-gradient(135deg, var(--plum) 0%, #7a3ba8 100%);
  box-shadow: 0 14px 30px -12px rgba(91, 42, 134, .65);
  transition: transform .16s var(--ease-out), box-shadow .18s var(--ease-out);
}
.tb-ticket-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 18px 36px -12px rgba(91, 42, 134, .7); }
.tb-ticket-submit:active:not(:disabled) { transform: scale(.985); }
.tb-ticket-submit:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 3px; }
.tb-ticket-submit:disabled { opacity: .75; cursor: progress; }
.tb-ticket-alt { margin: .9rem 0 0; text-align: center; font-size: .9rem; color: var(--muted); }

/* Talón: la tinta se asienta cuando cambia (nombre y dirección) */
.tb-stub-brand { display: flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: #fff; }
.tb-stub-brand img { border-radius: 8px; }
.tb-stub-name {
  margin: .6rem 0 0; font-family: var(--font-display); font-weight: 700; color: #fff;
  font-size: clamp(1.9rem, 1.4rem + 1.4vw, 2.5rem); line-height: 1.06; overflow-wrap: anywhere; text-wrap: balance;
  font-variant-numeric: lining-nums;
}
.tb-stub-name.is-empty { color: rgba(255, 255, 255, .5); }
.tb-stub-url { margin: 0; display: flex; gap: .45rem; align-items: flex-start; color: var(--gold-soft); font-size: .92rem; font-weight: 500; overflow-wrap: anywhere; }
.tb-stub-url svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: .1rem; }
.tb-stub-state { margin: -.35rem 0 0 1.6rem; font-size: .8rem; font-weight: 600; min-height: 1.1em; color: rgba(255, 255, 255, .6); }
.tb-stub-state.is-ok { color: #8FE3BD; }
.tb-stub-state.is-bad { color: #F4A6A1; }
.is-printing { animation: tb-ink .32s var(--ease-out); }
@keyframes tb-ink { from { opacity: .25; transform: translateY(3px); filter: blur(1px); } to { opacity: 1; transform: none; filter: none; } }

.tb-stub-next { list-style: none; margin: 0; padding: 1rem 0; border-top: 1px dashed rgba(231, 214, 174, .3); border-bottom: 1px dashed rgba(231, 214, 174, .3); display: grid; gap: .8rem; font-size: .95rem; color: rgba(255, 255, 255, .9); }

/* Miniatura de la página del negocio, impresa sobre el talón (plana, sin tarjeta): lo que está por obtener */
.tb-stub-preview {
  margin: auto 0; padding: 0; border: 1px solid rgba(231, 214, 174, .3); border-radius: 10px;
  background: rgba(255, 255, 255, .04); color: #fff; overflow: hidden;
}
.tb-pv-bar { display: flex; align-items: center; gap: 4px; padding: 7px 10px; border-bottom: 1px dashed rgba(231, 214, 174, .25); }
.tb-pv-bar i { width: 6px; height: 6px; border-radius: 50%; background: rgba(231, 214, 174, .45); }
.tb-pv-bar span {
  margin-left: 6px; flex: 1; min-width: 0; font-size: .72rem; color: var(--gold-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-pv-head {
  padding: 9px 12px 0; font-family: var(--font-display); font-weight: 700; font-size: 1rem; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-pv-body { padding: 8px 12px 12px; display: grid; gap: 8px; }
.tb-pv-prize {
  height: 56px; border: 1px solid rgba(231, 214, 174, .3); border-radius: 6px;
  display: grid; place-items: center; color: var(--gold-soft);
}
.tb-pv-prize svg { width: 26px; height: 26px; }
.tb-pv-title { font-size: .78rem; font-weight: 700; color: rgba(255, 255, 255, .9); }
.tb-pv-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.tb-pv-grid b {
  font: 600 .7rem/1 var(--font-sans); text-align: center; padding: 5px 0; border-radius: 4px;
  border: 1px solid rgba(143, 227, 189, .45); color: #8FE3BD; font-variant-numeric: tabular-nums;
}
.tb-pv-grid b.is-sold { background: var(--gold-soft); border-color: var(--gold-soft); color: #1F1B2E; }
.tb-pv-grid b.is-held { border-color: rgba(230, 188, 102, .7); color: #E6BC66; }
.tb-pv-cta { justify-self: start; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--gold-soft); color: var(--gold-soft); font-size: .72rem; font-weight: 700; }
.tb-stub-preview figcaption { padding: 6px 12px 8px; font-size: .7rem; color: rgba(255, 255, 255, .62); border-top: 1px dashed rgba(231, 214, 174, .25); }
.tb-stub-next li { display: flex; gap: .6rem; align-items: center; line-height: 1.3; }
.tb-stub-next li span {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid rgba(231, 214, 174, .6); color: var(--gold-soft); font-size: .78rem; font-weight: 700;
}
.tb-stub-next li.is-current span { background: var(--gold); border-color: var(--gold); color: #1F1B2E; }
.tb-stub-fine { margin: .25rem 0 0; font-size: .74rem; color: rgba(255, 255, 255, .62); line-height: 1.45; }
/* Línea de serie en oro, como el folio impreso de un boleto */
.tb-stub-serial {
  margin: .9rem 0 0; padding-top: .7rem; border-top: 2px solid var(--gold);
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}
.tb-stub-fine a { color: var(--gold-soft); font-weight: 600; text-underline-offset: 3px; }

/* Al enviar, el talón se desprende por la perforación */
.tb-ticket.is-tearing .tb-ticket-stub { transform: translate(10px, 4px) rotate(2.5deg); }

/* "Revisa tu correo": el talón suelto, ya desprendido */
.tb-stub-card {
  width: min(480px, 100%); position: relative; color: #fff;
  background: linear-gradient(165deg, #3a2258 0%, #2a1a42 55%, #1F1B2E 100%);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: clamp(1.5rem, 4vw, 2.25rem) clamp(1.5rem, 4vw, 2.25rem) clamp(1.5rem, 4vw, 2rem) calc(clamp(1.5rem, 4vw, 2.25rem) + 8px);
  display: flex; flex-direction: column; gap: .9rem;
  filter: drop-shadow(0 28px 44px rgba(8, 4, 16, .45));
  /* Borde izquierdo rasgado: la fila de muescas que dejó la perforación */
  -webkit-mask: radial-gradient(circle 5px at 0 50%, #0000 96%, #000) 0 0 / 100% 16px;
          mask: radial-gradient(circle 5px at 0 50%, #0000 96%, #000) 0 0 / 100% 16px;
  animation: tb-stub-in .6s var(--ease-out) both;
}
/* Llega como el talón recién desprendido: ladeado, y se asienta derecho para leerse bien */
@keyframes tb-stub-in { from { opacity: 0; transform: translate(-36px, 6px) rotate(3deg); } to { opacity: 1; transform: none; } }
.tb-stub-card h1 { margin: .4rem 0 0; font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.2rem); line-height: 1.1; color: #fff; }
.tb-stub-lead { margin: 0; color: rgba(255, 255, 255, .84); line-height: 1.55; }
.tb-stub-lead strong { color: #fff; overflow-wrap: anywhere; }
.tb-stub-business { padding-top: .9rem; border-top: 1px dashed rgba(231, 214, 174, .3); }
.tb-stub-business .tb-stub-name { margin: 0 0 .35rem; font-size: 1.35rem; }
.tb-stub-card .tb-stub-next { margin: 0; padding: .9rem 0; gap: .6rem; font-size: .92rem; border-bottom: 0; }
.tb-stub-card .tb-stub-next li span { width: 26px; height: 26px; flex-basis: 26px; }
.tb-stub-flash { margin: 0; padding: .6rem .8rem; border-radius: var(--radius-sm); background: rgba(143, 227, 189, .14); color: #8FE3BD; font-size: .88rem; }
.tb-stub-resend { margin: 0; display: grid; gap: .6rem; font-size: .88rem; color: rgba(255, 255, 255, .8); }
.tb-stub-resend p { margin: 0; line-height: 1.5; }
.tb-stub-resend .tb-field { color: rgba(255, 255, 255, .88); }
.tb-stub-card .tb-field input:focus { border-color: var(--gold-soft); box-shadow: 0 0 0 3px rgba(231, 214, 174, .5); }
.tb-stub-card .tb-stub-fine a { display: inline-flex; align-items: center; min-height: 44px; font-size: .85rem; }
.tb-stub-link {
  border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--gold-soft); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.tb-stub-link:focus-visible, .tb-stub-button:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 3px; border-radius: 4px; }
.tb-stub-button {
  min-height: 46px; border: 0; border-radius: 999px; cursor: pointer; font: 600 .95rem/1.2 var(--font-sans);
  background: var(--gold); color: #1F1B2E;
}
.tb-stub-button:hover { background: var(--gold-soft); }

/* Login: enlace al registro y reenvío de confirmación */
.tb-auth-alt { margin: 1rem 0 0; text-align: center; font-size: .9rem; color: var(--muted); }
.tb-auth-alt a, .tb-auth-alt button { color: var(--plum-ink); font-weight: 600; text-underline-offset: 3px; }
.tb-auth-alt button { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

@media (max-width: 760px) {
  /* En celular el talón va arriba como banda y la perforación cruza horizontal */
  .tb-ticket { grid-template-columns: minmax(0, 1fr); }
  .tb-ticket-stub {
    order: -1; border-radius: var(--ticket-r) var(--ticket-r) 0 0; gap: .5rem; padding-bottom: 1.4rem;
    -webkit-mask: radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000),
                  radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000);
    -webkit-mask-composite: source-in;
            mask: radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000),
                  radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000);
            mask-composite: intersect;
    transform-origin: 50% 100%;
  }
  .tb-ticket-stub::before { left: calc(var(--notch) + 8px); right: calc(var(--notch) + 8px); top: auto; bottom: 0; border-left: 0; border-top: 2px dashed rgba(231, 214, 174, .45); }
  .tb-ticket-body {
    border-radius: 0 0 var(--ticket-r) var(--ticket-r);
    -webkit-mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000),
                  radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000);
    -webkit-mask-composite: source-in;
            mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000),
                  radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000);
            mask-composite: intersect;
  }
  .tb-ticket-body::before { display: none; }
  .tb-stub-name { margin-top: .2rem; font-size: 1.45rem; }
  .tb-ticket .tb-stub-next, .tb-ticket .tb-stub-fine, .tb-stub-preview { display: none; }   /* en la banda basta con nombre y dirección */
  .tb-ticket.is-tearing .tb-ticket-stub { transform: translateY(-6px) rotate(-1.5deg); }
  .tb-stub-card { transform: none; animation-name: tb-stub-in-m; }
}
@keyframes tb-stub-in-m { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .tb-ticket-stub, .tb-stub-card { transition: none; animation: none; }
  .tb-ticket.is-tearing .tb-ticket-stub { transform: none; }
  .is-printing { animation: none; }
}

/* ============================================================
   Paneles (negocio y Manager): piezas compartidas
   ============================================================ */
.tb-dash-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem;
  flex-wrap: wrap; margin: .5rem 0 1.25rem;
}
.tb-dash-head h1 { margin: 0; position: relative; padding-bottom: .4rem; }
.tb-dash-head h1::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 2.5rem; height: 3px;
  background: var(--gold-700); border-radius: 2px;
}
/* Los paneles de los tableros no son enlaces: no se levantan al pasar el cursor. */
.tb-dash-t .tb-panel:hover, .tb-dash-m .tb-panel:hover { transform: none; box-shadow: inset 0 1px 0 var(--inset-hi), var(--shadow); }

/* Selector segmentado (rifa, periodo) */
.tb-seg {
  display: inline-flex; gap: 2px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: var(--neutral-050); border-radius: 999px;
}
.tb-seg::-webkit-scrollbar { display: none; }
.tb-seg button {
  flex: 0 0 auto; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 600 .88rem/1.2 var(--font-sans); padding: .55rem 1rem; min-height: 40px; border-radius: 999px;
  white-space: nowrap; max-width: 16rem; overflow: hidden; text-overflow: ellipsis;
}
.tb-seg button:hover { color: var(--ink); }
.tb-seg button.is-on { background: var(--surface); color: var(--plum-ink); box-shadow: 0 1px 2px rgba(31,27,46,.12), 0 4px 10px -6px rgba(31,27,46,.3); }
.tb-seg button:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 1px; }
.tb-seg-sm button { font-size: .82rem; padding: .45rem .8rem; min-height: 36px; }

.tb-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.tb-panel-head h2 { margin: 0; font-size: 1.2rem; }
.tb-panel-head > a { font-weight: 600; font-size: .9rem; }

/* ============================================================
   Panel del negocio: talonario
   ============================================================ */
/* Lo pendiente: una franja de filas accionables, lo que caduca primero arriba */
.tb-todo { display: grid; gap: .6rem; margin-bottom: 1.25rem; }
.tb-todo.tb-skel { min-height: 64px; border-radius: var(--radius); }
.tb-todo-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .9rem;
  padding: .8rem 1rem .8rem 1.1rem; border-radius: var(--radius); text-decoration: none; color: var(--ink);
  border: 1px solid transparent; transition: background-color .18s var(--ease-out), transform .16s var(--ease-out);
}
.tb-todo-item:hover { text-decoration: none; color: var(--ink); }
.tb-todo-item:active { transform: scale(.99); }
.tb-todo-item:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.tb-todo-item.is-bad { background: var(--danger-050); }
.tb-todo-item.is-warn { background: var(--warn-050); }
.tb-todo-item > strong {
  font: 600 1.9rem/1 var(--font-display); font-variant-numeric: tabular-nums; min-width: 1.6ch; text-align: center;
}
.tb-todo-item.is-bad > strong { color: var(--danger); }
.tb-todo-item.is-warn > strong { color: var(--warn); }
.tb-todo-text { font-weight: 600; line-height: 1.3; min-width: 0; }
.tb-todo-text small { display: block; font-weight: 500; font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.tb-todo-go {
  font-weight: 600; font-size: .88rem; padding: .5rem .95rem; border-radius: 999px; white-space: nowrap;
  background: var(--surface); color: var(--plum-ink); border: 1px solid var(--line);
}
.tb-todo-item:hover .tb-todo-go { border-color: var(--plum-ink); }
.tb-todo-calm {
  display: flex; align-items: center; gap: .6rem; margin: 0; padding: .75rem 1rem;
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: .92rem;
}
.tb-todo-calm svg { width: 20px; height: 20px; flex: 0 0 20px; color: var(--success); }

/* El boleto: talón con el sorteo | perforación | cuerpo con la venta */
.tb-dticket {
  --notch: 12px;
  display: grid; grid-template-columns: minmax(220px, 26%) minmax(0, 1fr);
  margin-bottom: 1.25rem; position: relative;
  filter: drop-shadow(0 1px 1px rgba(31,27,46,.08)) drop-shadow(0 14px 22px rgba(31,27,46,.14));
}
.tb-dticket.tb-skel { display: block; min-height: 220px; border-radius: var(--radius-lg); filter: none; }
.tb-dticket-stub, .tb-dticket-body { position: relative; min-width: 0; }
.tb-dticket-stub {
  background: linear-gradient(165deg, #3a2258 0%, #2a1a42 55%, #1F1B2E 100%); color: #fff;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  padding: 1.5rem 1.4rem 1.25rem; display: flex; flex-direction: column; gap: .5rem;
  -webkit-mask: radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000), radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000);
  -webkit-mask-composite: source-in;
          mask: radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000), radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000);
          mask-composite: intersect;
}
.tb-dticket-body {
  background: var(--surface); color: var(--ink);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 1.35rem 1.6rem 1.3rem; display: flex; flex-direction: column; gap: .85rem;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000), radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000);
  -webkit-mask-composite: source-in;
          mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000), radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000);
          mask-composite: intersect;
}
.tb-dticket-body::before {   /* perforación */
  content: ""; position: absolute; left: 0; top: calc(var(--notch) + 8px); bottom: calc(var(--notch) + 8px);
  border-left: 2px dashed var(--line);
}
.tb-dticket-body::after {    /* filo oro→ciruela del mundo del panel */
  content: ""; position: absolute; left: calc(var(--notch) + 6px); right: var(--radius-lg); top: 0; height: 3px;
  border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--gold), var(--plum));
}
.tb-dticket-stub p { margin: 0; }
.tb-dticket-days { display: flex; flex-direction: column; gap: .15rem; }
.tb-dticket-days strong {
  font: 600 clamp(3rem, 2.4rem + 2vw, 4.1rem)/.95 var(--font-display); font-variant-numeric: tabular-nums; color: #fff;
}
.tb-dticket-days span { font-size: .95rem; color: var(--gold-soft); font-weight: 500; }
.tb-dticket-date { font-size: .88rem; color: rgba(255,255,255,.78); line-height: 1.4; }
.tb-dticket-date::first-letter { text-transform: uppercase; }
.tb-dticket-folio {
  margin-top: auto !important; padding-top: .65rem; border-top: 2px solid var(--gold);
  display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}

.tb-dticket-top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.tb-dticket-top h2 { margin: 0; font-size: clamp(1.35rem, 1.1rem + .9vw, 1.75rem); overflow-wrap: anywhere; }
.tb-dticket-top a { font-weight: 600; font-size: .9rem; white-space: nowrap; }

/* Barra apilada de la rifa: vendidos | apartados | libres (el fondo) */
.tb-stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--success-050); }
.tb-stack span { display: block; height: 100%; }
.tb-stack .is-sold { background: var(--chart-sold); }
.tb-stack .is-held { background: var(--chart-reserved); }
.tb-stack-legend { list-style: none; margin: -.25rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; font-size: .85rem; color: var(--muted); }
.tb-stack-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.tb-stack-legend b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.tb-stack-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tb-stack-legend i.is-sold { background: var(--chart-sold); }
.tb-stack-legend i.is-held { background: var(--chart-reserved); }
.tb-stack-legend i.is-free { background: var(--success-050); box-shadow: inset 0 0 0 1px var(--chart-free); }

.tb-dticket-figs { display: flex; flex-wrap: wrap; gap: .75rem 2.5rem; margin: .1rem 0 0; padding-top: .85rem; border-top: 1px solid var(--line); }
.tb-dticket-figs div { min-width: 0; }
.tb-dticket-figs dt { font-size: .82rem; font-weight: 500; color: var(--muted); margin-bottom: .2rem; }
.tb-dticket-figs dd { margin: 0; font: 600 1.85rem/1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.tb-dticket-figs dd a { color: var(--danger); }

.tb-dticket.is-blank .tb-dticket-body h2 { margin: 0; font-size: 1.4rem; }
.tb-dticket.is-blank .tb-dticket-body p { margin: 0; }
.tb-dticket.is-blank .tb-cta { display: inline-flex; align-items: center; text-decoration: none; }

/* Reimpresión al cambiar de rifa */
.tb-dticket.is-printing .tb-dticket-stub { animation: tb-reprint-stub .42s var(--ease-out); }
.tb-dticket.is-printing .tb-dticket-body { animation: tb-reprint-body .42s var(--ease-out); }
@keyframes tb-reprint-stub { from { transform: translateX(-14px); opacity: .35; } to { transform: none; opacity: 1; } }
@keyframes tb-reprint-body { from { opacity: .45; filter: blur(2px); } to { opacity: 1; filter: none; } }

/* Ritmo de venta + plan */
.tb-dash-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1.25rem; align-items: start; }
.tb-dash-row.is-solo { grid-template-columns: minmax(0, 1fr); }
.tb-rhythm { gap: .75rem; }
.tb-rhythm .tb-chart-wrap { height: 280px; margin: 0 -.4rem; }
.tb-rhythm-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1.25rem; margin: 0; color: var(--muted); font-size: .92rem; }
.tb-rhythm-sum b { font: 600 1.35rem/1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; margin-right: .2rem; }
.tb-rhythm-sum small { flex-basis: 100%; font-size: .82rem; }

.tb-planuse { gap: .9rem; }
.tb-planuse-when { margin: -.35rem 0 0; font-size: .9rem; color: var(--muted); }
.tb-planuse-when.is-due { color: var(--warn); font-weight: 600; }
.tb-meter p { display: flex; justify-content: space-between; gap: .5rem; margin: 0 0 .4rem; font-size: .88rem; color: var(--muted); }
.tb-meter b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.tb-meter small { display: block; margin-top: .4rem; color: var(--danger); font-size: .82rem; line-height: 1.4; }
.tb-meter-bar { height: 8px; border-radius: 999px; background: var(--neutral-050); overflow: hidden; }
.tb-meter-bar span { display: block; height: 100%; border-radius: 999px; background: var(--plum); }
.tb-meter-bar.is-over span { background: var(--danger-fill); }

@media (max-width: 1000px) { .tb-dash-row { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .tb-dash-head .tb-seg { width: 100%; }
  /* En celular el talón va arriba como banda y la perforación cruza horizontal */
  .tb-dticket { grid-template-columns: minmax(0, 1fr); }
  .tb-dticket-stub {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 1.1rem 1.2rem 1rem;
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: .35rem 1rem;
    -webkit-mask: radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000), radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000);
    -webkit-mask-composite: source-in;
            mask: radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000), radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000);
            mask-composite: intersect;
  }
  .tb-dticket-days { grid-row: span 2; }
  .tb-dticket-days strong { font-size: 3rem; }
  .tb-dticket-folio { grid-column: 1 / -1; margin-top: .4rem !important; }
  .tb-dticket-body {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: 1.2rem 1.1rem 1.1rem;
    -webkit-mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000), radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000);
    -webkit-mask-composite: source-in;
            mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000), radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000);
            mask-composite: intersect;
  }
  .tb-dticket-body::before { left: calc(var(--notch) + 8px); right: calc(var(--notch) + 8px); top: 0; bottom: auto; border-left: 0; border-top: 2px dashed var(--line); }
  .tb-dticket-body::after { display: none; }
  .tb-dticket-figs { gap: .75rem 1.5rem; }
  .tb-dticket-figs dd { font-size: 1.5rem; }
  .tb-todo-item { grid-template-columns: auto minmax(0, 1fr); }
  .tb-todo-go { grid-column: 1 / -1; justify-self: start; }
  .tb-rhythm .tb-chart-wrap { height: 240px; }
}

/* ============================================================
   Tenants (Manager): filtro por situación de cobro
   ============================================================ */
.tb-filterbar { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 1rem; }
.tb-filter {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  font: 600 .86rem/1.2 var(--font-sans); padding: .5rem .95rem; min-height: 38px; border-radius: 999px;
  background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line);
}
.tb-filter:hover { border-color: var(--plum-ink); color: var(--ink); }
.tb-filter.is-on { background: var(--plum); border-color: var(--plum); color: #fff; }
.tb-filter:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.tb-filter-dot { width: 8px; height: 8px; border-radius: 50%; }
.tb-filter-dot.is-ok { background: var(--success); }
.tb-filter-dot.is-warn { background: var(--warn); }
.tb-filter-dot.is-bad { background: var(--danger); }
.tb-filter-dot.is-muted { background: var(--muted); }
.tb-filter.is-on .tb-filter-dot { box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.tb-due-soon { color: var(--warn); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .tb-dticket.is-printing .tb-dticket-stub, .tb-dticket.is-printing .tb-dticket-body { animation: none; }
}

/* ============================================================
   Panel del Manager: agenda de cobro
   ============================================================ */
.tb-dash-m .is-reloading { opacity: .6; transition: opacity .2s var(--ease-out); pointer-events: none; }

/* Franjas de cifras: cobranza (2/3) y crecimiento (1/3), filetes en vez de tarjetas */
.tb-mstrips { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; margin-bottom: 1.25rem; }
.tb-strip {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--inset-hi), var(--shadow); padding: 1.1rem 1.35rem 1.2rem; min-width: 0;
}
.tb-strip.tb-skel { min-height: 132px; }
.tb-strip h2 { margin: 0 0 .85rem; font-size: 1.1rem; }
.tb-figs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: 0; }
.tb-figs > div { padding: 0 1.1rem; min-width: 0; border-left: 1px solid var(--line); }
.tb-figs > div:first-child { padding-left: 0; border-left: 0; }
.tb-figs dt { font-size: .82rem; font-weight: 500; color: var(--muted); margin-bottom: .3rem; }
.tb-figs dd {
  margin: 0; font: 600 clamp(1.45rem, 1.1rem + 1vw, 1.95rem)/1.05 var(--font-display); color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-figs dd a { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.tb-figs p { margin: .35rem 0 0; font-size: .8rem; color: var(--muted); line-height: 1.35; }
.tb-figs > .is-bad dd { color: var(--danger); }

.tb-mgrid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }
.tb-mside { display: grid; gap: 1.25rem; min-width: 0; }
.tb-chart-sm { height: 210px; margin: 0 -.35rem; }
.tb-method-sum { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: -.4rem 0 0; font-size: .85rem; color: var(--muted); }
.tb-method-sum span { display: inline-flex; align-items: center; gap: .4rem; }
.tb-method-sum b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.tb-method-sum i { width: 10px; height: 10px; border-radius: 3px; }
.tb-method-sum i.is-card { background: var(--chart-sold); }
.tb-method-sum i.is-oxxo { background: var(--chart-reserved); }

/* Leyenda y marcas de la agenda */
.tb-agenda-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .8rem; color: var(--muted); }
.tb-agenda-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.tb-agenda-legend i { width: 9px; height: 9px; border-radius: 50%; }
.tb-agenda-legend i.is-paid { border-radius: 2px; background: var(--ink); }
.tb-agenda-legend i.is-due, .tb-cal-marks .is-due { background: var(--plum); }
.tb-agenda-legend i.is-overdue, .tb-cal-marks .is-overdue { background: var(--danger-fill); }
.tb-agenda-legend i.is-failed { background: transparent; box-shadow: inset 0 0 0 2px var(--danger); }

.tb-cal-dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; }
.tb-cal-dow span { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 .5rem; }
.tb-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.tb-cal.is-months .tb-cal-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.tb-cal-cell {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; text-align: left;
  min-height: 84px; padding: .5rem .55rem .45rem; cursor: pointer; overflow: hidden;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  font: inherit; transition: border-color .15s var(--ease-out), background-color .15s var(--ease-out);
  animation: tb-cal-in .32s var(--ease-out) both;
}
.tb-cal.is-week .tb-cal-cell { min-height: 118px; }
.tb-cal.is-months .tb-cal-cell { min-height: 92px; }
@keyframes tb-cal-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tb-cal-cell:hover { border-color: var(--plum-ink); }
.tb-cal-cell:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 1px; }
.tb-cal-cell.is-past { background: var(--surface-2); }
.tb-cal-cell.is-quiet .tb-cal-date { color: var(--muted); font-weight: 500; }
.tb-cal-cell.is-today { border-color: var(--gold-700); }
.tb-cal-cell.is-today .tb-cal-date { text-decoration: underline; text-decoration-color: var(--gold-700); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.tb-cal-cell.is-on { border-color: var(--plum); box-shadow: 0 0 0 1px var(--plum) inset; background: var(--plum-050); }
.tb-cal-date { font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tb-cal-money { font: 600 1.02rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-cal-marks { margin-top: auto; display: flex; flex-wrap: wrap; gap: 3px; }
.tb-cal-marks span {
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: .7rem; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums;
}
.tb-cal-marks .is-failed { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 2px var(--danger); }

/* Detalle del día elegido */
.tb-daylist { border-top: 1px solid var(--line); padding-top: 1rem; }
.tb-daylist h3 { margin: 0 0 .6rem; font-size: 1.05rem; }
.tb-daylist ul { list-style: none; margin: 0; padding: 0; }
.tb-dayrow {
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; align-items: center; gap: .75rem;
  padding: .6rem 0; border-top: 1px solid var(--line);
}
.tb-dayrow:first-child { border-top: 0; }
.tb-dayrow-kind { justify-self: start; font-size: .75rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: var(--neutral-050); color: var(--muted); }
.tb-dayrow.is-paid .tb-dayrow-kind { background: var(--success-050); color: var(--success); }
.tb-dayrow.is-due .tb-dayrow-kind { background: var(--plum-050); color: var(--plum-ink-700); }
.tb-dayrow.is-overdue .tb-dayrow-kind, .tb-dayrow.is-failed .tb-dayrow-kind { background: var(--danger-050); color: var(--danger); }
.tb-dayrow-who { min-width: 0; }
.tb-dayrow-who a { font-weight: 600; }
.tb-dayrow-who small { display: block; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-dayrow-amount { font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
  .tb-mstrips, .tb-mgrid { grid-template-columns: minmax(0, 1fr); }
  .tb-mside { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (max-width: 720px) {
  .tb-dash-m .tb-dash-head .tb-seg { width: 100%; }
  .tb-figs { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 0; }
  .tb-figs > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .tb-cal-cell { min-height: 58px; padding: .35rem .3rem; }
  .tb-cal.is-week .tb-cal-cell, .tb-cal.is-months .tb-cal-cell { min-height: 72px; }
  .tb-cal-money { font-size: .78rem; font-family: var(--font-sans); }
  .tb-cal-dow span { padding: 0 .3rem; font-size: .66rem; }
  .tb-cal-marks span { min-width: 16px; height: 16px; font-size: .62rem; padding: 0 3px; }
  .tb-dayrow { grid-template-columns: minmax(0, 1fr) auto; }
  .tb-dayrow-kind { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .tb-cal-cell { animation: none; } }

/* Cifras de los paneles en Playfair con números de caja alta: se leen parejas y se comparan en columna. */
.tb-todo-item > strong, .tb-dticket-days strong, .tb-dticket-figs dd, .tb-rhythm-sum b,
.tb-figs dd, .tb-cal-money { font-variant-numeric: lining-nums tabular-nums; }

/* Agenda en celular: el monto no cabe en la celda; queda la marca de cobrado y el monto va en el detalle del día. */
.tb-cal-marks .is-paid { display: none; min-width: 12px; width: 12px; height: 12px; padding: 0; border-radius: 3px; background: var(--ink); }
@media (max-width: 720px) {
  .tb-cal-money { display: none; }
  .tb-cal-marks .is-paid { display: inline-block; }
}

/* Revisión final: clave de color del ritmo, perforación visible en oscuro, selector que se acomoda en celular */
.tb-rhythm-sum span { display: inline-flex; align-items: baseline; gap: .1rem; }
.tb-rhythm-sum i { width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; align-self: center; }
.tb-rhythm-sum i.is-sold { background: var(--chart-sold); }
.tb-rhythm-sum i.is-held { background: var(--chart-reserved); }
:root[data-theme="dark"] .tb-dticket-body::before { border-color: rgba(231, 214, 174, .38); }
:root[data-theme="dark"] .tb-dticket { filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .55)); }
@media (max-width: 720px) {
  .tb-dash-head .tb-seg { flex-wrap: wrap; border-radius: 18px; overflow: visible; }
}

/* Revisión final (Manager): rango de cifras, hoy con filo de oro aun elegido, pasado vs futuro, lista en celular */
.tb-figs > .is-lead dd { font-size: clamp(1.8rem, 1.3rem + 1.4vw, 2.5rem); }
.tb-figs > .is-zero dd { color: var(--muted); font-weight: 500; }
.tb-cal-cell.is-past { background: var(--paper); }
.tb-cal-cell.is-past .tb-cal-date { color: var(--muted); }
.tb-cal-cell.is-today { border-color: var(--gold-700); box-shadow: 0 0 0 1px var(--gold-700) inset; }
.tb-cal-cell.is-on.is-today { border-color: var(--gold-700); box-shadow: 0 0 0 1px var(--gold-700) inset, 0 0 0 3px var(--plum-050) inset; background: var(--plum-050); }
.tb-cal-list { display: none; list-style: none; margin: 0; padding: 0; }
.tb-cal-list li + li { border-top: 1px solid var(--line); }
.tb-cal-list button {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .15rem .75rem;
  padding: .7rem .6rem; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; border-radius: 8px;
}
.tb-cal-list button.is-on { background: var(--plum-050); }
.tb-cal-list button:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: -2px; }
.tb-cal-list-day { font-weight: 600; font-size: .92rem; }
.tb-cal-list button.is-today .tb-cal-list-day { text-decoration: underline; text-decoration-color: var(--gold-700); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.tb-cal-list-money { grid-row: span 2; font: 600 1.15rem/1 var(--font-display); font-variant-numeric: lining-nums tabular-nums; }
.tb-cal-list .tb-cal-marks { margin-top: 0; }
.tb-cal-list .tb-cal-marks:empty { display: none; }
@media (max-width: 720px) {
  .tb-cal-dow, .tb-cal-grid { display: none; }
  .tb-cal-list { display: block; }
}
.tb-cal-cell.is-past.is-on { background: var(--plum-050); }

/* Tenants: nombre y slug apilados, un dominio por línea; se parte solo en separadores, no a media palabra. */
.tb-cell-stack { display: inline-flex; flex-direction: column; align-items: flex-start; gap: .1rem; min-width: 0; }
.tb-cell-stack > * { overflow-wrap: break-word; word-break: normal; }
.tb-pill-method { background: var(--neutral-050); color: var(--ink-soft); }
@media (max-width: 767px) {
  table.tb-dt tbody td { overflow-wrap: break-word; }
  table.tb-dt tbody td .tb-cell-stack { align-items: flex-end; text-align: right; }
}
@media (min-width: 768px) { .tb-cell-stack > span { white-space: nowrap; } }

/* Reembolsos en la agenda del Manager: aro ámbar (dinero que regresó) */
.tb-agenda-legend i.is-refunded { background: transparent; box-shadow: inset 0 0 0 2px var(--warn); }
.tb-cal-marks .is-refunded { background: transparent; color: var(--warn); box-shadow: inset 0 0 0 2px var(--warn); }
.tb-dayrow.is-refunded .tb-dayrow-kind { background: var(--warn-050); color: var(--warn); }

/* Boletos de un apartado (comprobantes): caja con su propio scroll para apartados de cientos de números. */
.tb-numlist {
  margin: .45rem 0; padding: .45rem .6rem; max-height: 6.4rem; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .85rem; line-height: 1.6; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums; word-spacing: .1em; overflow-wrap: anywhere;
}

/* ============================================================
   Vista previa del sitio público ("Rótulo de feria") dentro del panel
   Réplica a escala de public.css: pared en el primario del tenant, cal para
   trabajar, letra de rótulo (Bungee) con sombra en el secundario, filetes.
   Las tintas (--pv-*) las calcula tbPubColors con la misma regla del sitio.
   El sitio público siempre es claro, también dentro del panel en tema oscuro.
   ============================================================ */
.tb-sp {
  --pv-primary: #5B2A86; --pv-secondary: #C6A15B; --pv-on-primary: #fff; --pv-on-secondary: #1C1400; --pv-primary-ink: #5B2A86;
  --pv-cal: #F4EFE6; --pv-cal-2: #EBE3D5; --pv-surface: #FFFDF8; --pv-ink: #1A1523; --pv-muted: #62594F; --pv-line: #D8CDBB;
  --pv-soft: color-mix(in srgb, var(--pv-on-primary) 80%, transparent);
  --pv-wline: color-mix(in srgb, var(--pv-on-primary) 45%, transparent);
  --pv-sign: "Bungee", "Arial Black", sans-serif;
  background: var(--pv-cal); color: var(--pv-ink); font-family: "Archivo", system-ui, sans-serif; font-size: 12px; line-height: 1.45;
  color-scheme: light;
}
.tb-sp * { box-sizing: border-box; }
/* los títulos toman la tinta de su fondo (pared o cal), no la del panel */
.tb-sp :is(h3, h4) { color: inherit; }
.tb-sp-sign { font-family: var(--pv-sign); font-weight: 400; text-transform: uppercase; line-height: .98; letter-spacing: .01em; margin: 0; }
.tb-sp-shadow { text-shadow: .055em .055em 0 var(--pv-secondary); }
.tb-sp-wall { background: var(--pv-primary); color: var(--pv-on-primary); position: relative; }
.tb-sp-wall::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 3px, transparent 3px 11px), repeating-linear-gradient(90deg, rgba(0,0,0,.035) 0 2px, transparent 2px 17px); }
.tb-sp-wall > * { position: relative; }
.tb-sp-ann { background: var(--pv-secondary); color: var(--pv-on-secondary); font-family: var(--pv-sign); font-size: 9px; text-transform: uppercase; text-align: center; padding: 6px 10px; line-height: 1.25; }

.tb-sp-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.tb-sp-logo { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: 0 0 32px; box-shadow: 0 0 0 2px var(--pv-wline); display: grid; place-items: center; font-family: var(--pv-sign); background: rgba(255,255,255,.12); }
.tb-sp-logo img { width: 100%; height: 100%; object-fit: cover; }
.tb-sp-name { font-family: var(--pv-sign); text-transform: uppercase; font-size: 12px; line-height: 1; margin-right: auto; min-width: 0; overflow-wrap: anywhere; }
.tb-sp-wa { width: 30px; height: 30px; border-radius: 50%; background: #25D366; color: #fff; display: grid; place-items: center; flex: 0 0 30px; }
.tb-sp-menu { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--pv-wline); display: grid; place-items: center; flex: 0 0 30px; }

.tb-sp-cartel { padding: 6px 12px 18px; display: flex; flex-direction: column; gap: 9px; }
.tb-sp-poster { position: relative; margin: 8px 3px 6px; }
.tb-sp-frame { background: var(--pv-surface); padding: 5px; border-radius: 2px; transform: rotate(-1.4deg); box-shadow: 0 16px 24px -14px rgba(0,0,0,.6); position: relative; }
.tb-sp-frame::before, .tb-sp-frame::after { content: ""; position: absolute; top: -8px; width: 54px; height: 16px; background: rgba(255,243,209,.74); box-shadow: 0 1px 2px rgba(0,0,0,.14); }
.tb-sp-frame::before { left: 12%; transform: rotate(-6deg); } .tb-sp-frame::after { right: 10%; transform: rotate(5deg); }
.tb-sp-frame img, .tb-sp-photo { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.tb-sp-photo { display: grid; place-items: center; background: var(--pv-cal-2); color: var(--pv-primary-ink); font-family: var(--pv-sign); font-size: 15px; text-transform: uppercase; text-align: center; padding: 10px; line-height: 1; }
.tb-sp-tag { position: absolute; right: -4px; bottom: -12px; max-width: 88%; background: var(--pv-secondary); color: var(--pv-on-secondary); font-family: var(--pv-sign); font-size: 9px; text-transform: uppercase; padding: 5px 8px; transform: rotate(2deg); box-shadow: 0 6px 10px -6px rgba(0,0,0,.5); line-height: 1.1; }
.tb-sp-title { font-size: 26px; margin-top: 8px; overflow-wrap: anywhere; }
.tb-sp-prize { margin: 0; color: var(--pv-soft); font-size: 11.5px; }
.tb-sp-prize b { color: var(--pv-on-primary); }
.tb-sp-price { display: flex; align-items: flex-end; gap: 6px; margin: 0; }
.tb-sp-price b { font-family: var(--pv-sign); font-weight: 400; font-size: 46px; line-height: .8; text-shadow: .045em .045em 0 var(--pv-secondary); }
.tb-sp-price span { font-family: var(--pv-sign); font-size: 10px; line-height: 1; text-transform: uppercase; padding-bottom: 3px; }
.tb-sp-packs { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.tb-sp-packs li { border: 1.5px dashed var(--pv-wline); border-radius: 3px; padding: 3px 6px; line-height: 1.15; }
.tb-sp-packs b { display: block; font-family: var(--pv-sign); font-weight: 400; font-size: 11px; }
.tb-sp-packs small { font-size: 9.5px; color: var(--pv-soft); }
.tb-sp-promo { margin: 0; font-family: var(--pv-sign); font-size: 12px; text-transform: uppercase; }
.tb-sp-clock { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; border-top: 1.5px solid var(--pv-wline); padding-top: 6px; }
.tb-sp-clock > span:first-child { width: 100%; font-size: 8.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pv-soft); }
.tb-sp-clock b { font-family: var(--pv-sign); font-weight: 400; font-size: 15px; }
.tb-sp-clock small { font-size: 9px; color: var(--pv-soft); margin-left: 2px; }
.tb-sp-letrero { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 4px; background: var(--pv-surface); color: var(--pv-primary-ink);
  font-family: var(--pv-sign); font-size: 13px; text-transform: uppercase; outline: 1.5px solid currentColor; outline-offset: -5px; box-shadow: 0 8px 14px -10px rgba(0,0,0,.6); }
.tb-sp-link { text-align: center; font-weight: 700; font-size: 11px; text-decoration: underline; text-underline-offset: 2px; }

.tb-sp-sec { padding: 18px 12px; }
.tb-sp-sec h4 { font-size: 18px; margin: 0 0 10px; }
.tb-sp-lead { color: var(--pv-muted); margin: 0 0 10px; }
.tb-sp-list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--pv-ink); }
.tb-sp-list li { display: flex; gap: 7px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--pv-line); font-weight: 600; }
.tb-sp-list li i { width: 7px; height: 7px; border-radius: 50%; background: var(--pv-primary-ink); flex: 0 0 7px; }
.tb-sp-list li.is-link { color: var(--pv-primary-ink); text-decoration: underline; text-underline-offset: 2px; }
.tb-sp-dl { margin: 0 0 12px; border-top: 1.5px solid var(--pv-ink); }
.tb-sp-dl div { padding: 6px 0; border-bottom: 1px dashed var(--pv-line); }
.tb-sp-dl dt { font-size: 8.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pv-muted); }
.tb-sp-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.tb-sp-deposit { white-space: pre-line; background: var(--pv-surface); border: 1.5px dashed var(--pv-line); border-radius: 4px; padding: 7px 8px; font-weight: 600; margin: 0 0 12px; }
.tb-sp-faq { border-top: 1.5px solid var(--pv-ink); }
.tb-sp-faq div { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--pv-line); font-weight: 700; }
.tb-sp-faq div::after { content: "+"; font-family: var(--pv-sign); color: var(--pv-primary-ink); }
.tb-sp-pagehead { padding: 10px 12px 18px; }
.tb-sp-pagehead h3 { font-size: 26px; }
.tb-sp-pagehead p { margin: 7px 0 0; color: var(--pv-soft); }
.tb-sp-pagehead .tb-sp-letrero { margin-top: 12px; padding: 0 10px; font-size: 11px; }
.tb-sp-social { display: flex; gap: 6px; margin-top: 10px; }
.tb-sp-social span { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-weight: 800; font-size: 10px; }
.tb-sp-foot { padding: 16px 12px 18px; }
.tb-sp-foot .tb-sp-sign { font-size: 20px; overflow-wrap: anywhere; }
.tb-sp-foot p { margin: 4px 0 0; color: var(--pv-soft); font-size: 10.5px; }
.tb-sp-foot nav { display: flex; flex-wrap: wrap; gap: 4px 10px; border-top: 1.5px dashed var(--pv-wline); margin-top: 10px; padding-top: 8px; font-weight: 700; font-size: 10.5px; text-decoration: underline; }
.tb-sp-demo { margin: 0; padding: 5px 12px; background: var(--pv-cal-2); color: var(--pv-muted); font-size: 10px; text-align: center; }

/* Mi negocio: el teléfono muestra el sitio nuevo */
.tb-biz-screen.tb-sp { background: var(--pv-cal); }
/* Diseño de rifa: el cartel en su pared */
.tb-brand-pv { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); }
.tb-brand-pv .tb-sp-cartel { padding: 10px 16px 20px; }
.tb-brand-pv .tb-sp-title { font-size: 30px; }

/* ---------- Aviso para aceptar los Términos vigentes (panel del negocio) ---------- */
.tb-terms { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .9rem 1.2rem; margin: 0 0 1.25rem;
  padding: 1rem 1.15rem; border-radius: var(--radius); background: var(--warn-050); border: 1px solid var(--gold-soft); color: var(--ink); }
.tb-terms-txt { display: flex; flex-direction: column; gap: .25rem; max-width: 60ch; font-size: .92rem; line-height: 1.5; }
.tb-terms-txt strong { font-size: 1rem; }
.tb-terms-txt a { color: var(--plum-ink); font-weight: 600; }
.tb-terms-ok { background: var(--success-050); border-color: transparent; color: var(--success); font-weight: 600; }

/* ---------- Bases del sorteo (pestaña Datos de la rifa) ---------- */
.tb-rules-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.tb-rules textarea { font-size: .9rem; line-height: 1.5; }

/* ---------- Aviso de cookies de Tombolify (landing y registro; ver _PlatformTracking) ---------- */
.tb-consent {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 1300; max-width: min(420px, calc(100vw - 2rem)); padding: 1rem 1.1rem;
  background: #FFFFFF; color: #1F1B2E; border: 1px solid #EBE6DF; border-radius: 16px;
  box-shadow: 0 24px 60px -20px rgba(31, 27, 46, .45); font: 400 .9rem/1.5 Inter, system-ui, sans-serif;
}
.tb-consent[hidden] { display: none; }
.tb-consent p { margin: 0; }
.tb-consent a { color: #5B2A86; font-weight: 600; }
.tb-consent-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .8rem; }
.tb-consent-actions button {
  min-height: 40px; padding: 0 1rem; border-radius: 999px; font: 600 .88rem Inter, system-ui, sans-serif; cursor: pointer;
  border: 1px solid #EBE6DF; background: #FFFFFF; color: #5B2A86;
}
.tb-consent-actions .tb-consent-yes { background: #5B2A86; border-color: #5B2A86; color: #FFFFFF; }
.tb-consent-actions button:focus-visible { outline: 3px solid #E7D6AE; outline-offset: 2px; }

/* Login: "¿Olvidaste tu contraseña?" junto a la etiqueta del campo. */
.tb-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.tb-forgot { font-size: .85rem; font-weight: 600; color: var(--plum-ink); text-underline-offset: 3px; white-space: nowrap; }

/* ---------- Dominio propio (tb-domain.js) ---------- */
.tb-dom, .tb-dom > div { display: grid; gap: .9rem; }
.tb-dom-page .tb-panel { max-width: 860px; }
.tb-dom-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.tb-dom-host { font-size: 1.15rem; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
a.tb-dom-host { color: var(--plum-ink); text-decoration: none; }
a.tb-dom-host:hover { text-decoration: underline; }
.tb-dom-msg { margin: 0; color: var(--ink-soft); font-size: .92rem; line-height: 1.55; }
.tb-dom-ok { color: var(--success); }
.tb-dom-bad { color: var(--danger); }
.tb-dom-upsell { background: var(--plum-050); border-radius: var(--radius-sm); padding: .8rem 1rem; }
.tb-dom-upsell p { margin: 0 0 .5rem; color: var(--plum-ink-700); }
.tb-dom-connect { display: grid; gap: .6rem; max-width: 460px; }
.tb-dom-records { display: grid; gap: .6rem; }
.tb-dom-rec {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) minmax(0, 1.6fr); gap: .4rem 1rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .85rem; background: var(--surface-2);
}
.tb-dom-cell { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; min-width: 0; }
.tb-dom-k { flex-basis: 100%; font-size: .72rem; font-weight: 600; color: var(--muted); }
.tb-dom-cell code {
  font-size: .86rem; color: var(--ink); background: var(--field); border: 1px solid var(--line);
  border-radius: 4px; padding: .1rem .35rem; overflow-wrap: anywhere; user-select: all;
}
.tb-dom-why { grid-column: 1 / -1; margin: 0; font-size: .8rem; color: var(--muted); }
.tb-dom-hosts, .tb-dom-tips { margin: 0; padding-left: 1.1rem; display: grid; gap: .35rem; }
.tb-dom-hosts { list-style: none; padding-left: 0; }
.tb-dom-err { color: var(--danger); font-size: .86rem; }
.tb-dom-tips { color: var(--muted); font-size: .86rem; }
@media (max-width: 640px) {
  .tb-dom-rec { grid-template-columns: 1fr; }
}
