/* ═══════════════════════════════════════════════════════════════════════════
   AGETIX DS — Tokens compartidos del DASHBOARD (espejo de agetix-ds/tokens/noir.css)
   Servido en /static/ds-tokens.css. Cualquier página del dashboard (login,
   admin, cliente, OS) enlaza esta hoja para hablar el MISMO idioma visual que
   la web corporativa (tema Noir). Migración F4.2 / #38.2 (D073).
   Regla: las páginas del dashboard NO definen su paleta; consumen estas vars.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* Color (idéntico a noir.css) */
  --bg:      #050A14;  --bg-2: #070d1a;  --bg-3: #0a1322;  --bg-4: #0e1830;
  --line:    #1c2740;  --line-2: #2a3a5c;
  --gold:    #FFD700;  --gold-2: #ffe45c;
  --cyan:    #00E5FF;
  --text:    #F8F9FA;  --text-2: #B0B0B0;  --text-3: #5a6275;
  --green:   #00d4aa;  --red: #ff4f6e;     --amber: #ffaa00;

  --grad-cta:  linear-gradient(180deg, var(--gold-2), var(--gold));
  --grad-card: linear-gradient(160deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
  --orbe-cyan: radial-gradient(900px 620px at 88% -8%, rgba(0,229,255,.16), transparent 62%);
  --orbe-gold: radial-gradient(760px 540px at -12% 108%, rgba(255,215,0,.11), transparent 60%);

  --font-display: 'Montserrat', Inter, system-ui, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;
  --sombra-card: 0 30px 60px rgba(0,0,0,.45);
  --sombra-cta:  0 0 44px rgba(255,215,0,.32), 0 18px 40px rgba(0,0,0,.4);
  --glow-cyan:   0 0 24px rgba(0,229,255,.45);
}

/* ── Utilidades compartidas del dashboard ────────────────────────────────── */

/* CTA de marca (oro, Montserrat, mayúsculas) */
.ds-btn {
  display: inline-block; font-family: var(--font-display); font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em; font-size: 14px;
  padding: 12px 22px; border-radius: var(--r-sm); border: none; cursor: pointer;
  background: var(--grad-cta); color: var(--bg); box-shadow: var(--sombra-cta);
  transition: transform .2s ease, opacity .2s ease;
}
.ds-btn:hover { transform: translateY(-1px); }
.ds-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.ds-btn--ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line-2); box-shadow: none;
}
.ds-btn--cyan { background: var(--cyan); color: var(--bg); box-shadow: var(--glow-cyan); }

/* Tarjeta de firma */
.ds-card {
  background: var(--grad-card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sombra-card); padding: 24px;
}
.ds-card--acento { border-left: 3px solid var(--cyan); }

/* Input de marca */
.ds-input {
  width: 100%; background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 11px 14px; font-size: 14px;
  color: var(--text); font-family: var(--font-body); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.ds-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,229,255,.12); }
.ds-input::placeholder { color: var(--text-3); }

/* Número que "cuenta" (JS pone el valor final; la clase da el estilo) */
.ds-counter {
  font-family: var(--font-display); font-weight: 800; color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

/* Skeleton loader (shimmer sutil, respeta reduce-motion) */
.ds-skeleton {
  position: relative; overflow: hidden;
  background: var(--bg-3); border-radius: var(--r-sm); min-height: 14px;
}
.ds-skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  transform: translateX(-100%); animation: ds-shimmer 1.3s infinite;
}
@keyframes ds-shimmer { 100% { transform: translateX(100%); } }

/* Spinner inline para botones en estado "cargando" */
.ds-spin {
  display: inline-block; width: 15px; height: 15px; vertical-align: -2px;
  border: 2px solid rgba(5,10,20,.35); border-top-color: var(--bg);
  border-radius: 50%; animation: ds-rot .7s linear infinite;
}
@keyframes ds-rot { 100% { transform: rotate(360deg); } }

/* Alertas de marca */
.ds-alert { border-radius: var(--r-sm); padding: 11px 14px; font-size: 13px; line-height: 1.5; }
.ds-alert--error   { background: rgba(255,79,110,.10);  border: 1px solid rgba(255,79,110,.25);  color: var(--red); }
.ds-alert--success { background: rgba(0,212,170,.08);   border: 1px solid rgba(0,212,170,.20);   color: var(--green); }

@media (prefers-reduced-motion: reduce) {
  .ds-skeleton::after, .ds-spin { animation: none; }
}

/* ── Escala de espaciado 8pt (#39 pase premium, 2026-07-04) ──────────────────
   Regla: todo margen/padding de las páginas del dashboard cae en esta escala.
   Jerarquía Apple: h1 24px → section-title separada 40px arriba / 16px abajo →
   panel padding 24px → celdas de tabla 12x16. */
:root { --s-1: 8px; --s-2: 16px; --s-3: 24px; --s-4: 32px; --s-5: 40px; --s-6: 48px; }

/* ═══════════════════════════════════════════════════════════════════════════
   §3 · TOKENS DE INTERACCIÓN — AGETIX Design System Elite v2 (47.7a / D078)
   Fuente normativa: docs/DESIGN_SYSTEM_ELITE.md §3. Únicos tiempos/curvas
   permitidos en todo el dashboard — prohibido inventar otros en una página.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* Tiempos y curvas — los ÚNICOS permitidos */
  --t-instant: 120ms;                             /* hover, press, toggles */
  --t-quick:   200ms;                             /* aparición de menús, chips, tooltips */
  --t-move:    300ms;                             /* sheets, transiciones de vista, acordeones */
  --e-out:     cubic-bezier(0.22, 1, 0.36, 1);    /* entradas (desacelera al llegar) */
  --e-in-out:  cubic-bezier(0.65, 0, 0.35, 1);    /* movimientos de ida y vuelta */

  /* Capas z — nada se apila fuera de esta escala */
  --z-nav: 100; --z-sheet: 200; --z-modal: 300; --z-toast: 400;

  /* Superposición (sheets/modales) */
  --scrim:      rgba(5, 10, 20, 0.65);            /* fondo oscurecido detrás de overlays */
  --blur-glass: blur(14px);                       /* vidrio esmerilado estilo iOS */

  /* Táctil */
  --tap-min: 44px;                                /* alto/ancho mínimo de todo elemento tocable */
}

/* ═══════════════════════════════════════════════════════════════════════════
   §6 · COMPONENTES CANON — los 10 nuevos (47.7a / D078)
   Regla: si una vista necesita algo que no está aquí, se crea AQUÍ primero
   (con entrada en ds-registry.json) y luego se usa. Prohibido CSS local de
   página que redefina color, espaciado o comportamiento (ver DESIGN_SYSTEM_ELITE.md §6).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── ds-view-header — header canon único de vista (§4) ───────────────────── */
.ds-view-header {
  display: flex; align-items: center; gap: var(--s-2);
  height: 56px; padding: 0 var(--s-2); flex-shrink: 0;
  border-bottom: 1px solid var(--line); background: var(--bg);
  position: sticky; top: 0; z-index: var(--z-nav);
}
.ds-view-header__menu {
  width: var(--tap-min); height: var(--tap-min); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: var(--r-sm);
  color: var(--text); font-size: 20px; cursor: pointer; line-height: 1;
  transition: background var(--t-instant) var(--e-out);
}
.ds-view-header__menu:hover { background: var(--bg-3); }
.ds-view-header__title {
  flex: 1; min-width: 0; margin: 0;
  font-family: var(--font-display); font-weight: 700; font-size: 24px;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ds-view-header__action { flex-shrink: 0; }
@media (max-width: 768px) { .ds-view-header__title { font-size: 18px; } }

/* ── ds-row / ds-list — fila iOS (§5.2), colección de trabajo ─────────────── */
.ds-list {
  display: flex; flex-direction: column;
  background: var(--grad-card); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden;
}
.ds-row {
  display: flex; align-items: center; gap: var(--s-2);
  min-height: 56px; padding: 10px var(--s-2);
  border-bottom: 1px solid var(--line); cursor: pointer;
  animation: ds-rise var(--t-move) var(--e-out) both;
  transition: background var(--t-instant) var(--e-out), transform var(--t-instant) var(--e-out);
}
.ds-list .ds-row:last-child { border-bottom: none; }
.ds-row:hover  { background: var(--bg-3); }
.ds-row:active { transform: scale(0.99); }
.ds-row__icon {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--r-sm);
  background: var(--bg-3); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.ds-row__icon img { width: 100%; height: 100%; object-fit: cover; }
.ds-row__body { flex: 1; min-width: 0; }
.ds-row__title {
  font-family: var(--font-body); font-weight: 600; font-size: 14px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ds-row__subtitle {
  font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ds-row__chevron { flex-shrink: 0; color: var(--text-3); font-size: 18px; }
/* Stagger de entrada — máximo 8 filas animadas (§7), el resto ya puesto */
.ds-list .ds-row:nth-child(1) { animation-delay: 0ms;   }
.ds-list .ds-row:nth-child(2) { animation-delay: 30ms;  }
.ds-list .ds-row:nth-child(3) { animation-delay: 60ms;  }
.ds-list .ds-row:nth-child(4) { animation-delay: 90ms;  }
.ds-list .ds-row:nth-child(5) { animation-delay: 120ms; }
.ds-list .ds-row:nth-child(6) { animation-delay: 150ms; }
.ds-list .ds-row:nth-child(7) { animation-delay: 180ms; }
.ds-list .ds-row:nth-child(8) { animation-delay: 210ms; }
.ds-list .ds-row:nth-child(n+9) { animation: none; }
@keyframes ds-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── ds-sheet — superposición estándar (§5.3): móvil abajo / escritorio lateral 480px ── */
.ds-scrim {
  position: fixed; inset: 0; z-index: var(--z-sheet);
  background: var(--scrim); backdrop-filter: var(--blur-glass); -webkit-backdrop-filter: var(--blur-glass);
  opacity: 0; pointer-events: none; transition: opacity var(--t-quick) var(--e-out);
}
.ds-scrim.is-open { opacity: 1; pointer-events: auto; }
.ds-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 85vh; z-index: var(--z-sheet);
  display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--line); border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--sombra-card);
  transform: translateY(100%); transition: transform var(--t-move) var(--e-out);
}
.ds-sheet.is-open { transform: translateY(0); }
.ds-sheet__handle { width: 36px; height: 4px; margin: 10px auto; flex-shrink: 0; border-radius: var(--r-pill); background: var(--line-2); }
.ds-sheet__header {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  padding: 0 var(--s-2) var(--s-2);
}
.ds-sheet__title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--text); }
.ds-sheet__close {
  width: var(--tap-min); height: var(--tap-min); border: none; background: transparent;
  color: var(--text-2); font-size: 16px; border-radius: var(--r-sm); cursor: pointer;
}
.ds-sheet__close:hover { background: var(--bg-3); }
.ds-sheet__body { flex: 1; overflow-y: auto; padding: 0 var(--s-2) var(--s-2); }
.ds-sheet__actions {
  display: flex; gap: var(--s-2); flex-shrink: 0;
  padding: var(--s-2); border-top: 1px solid var(--line);
}
.ds-sheet__actions .ds-btn { flex: 1; }
@media (min-width: 769px) {
  .ds-sheet {
    left: auto; top: 0; right: 0; bottom: 0; width: 480px; height: 100%; max-height: none;
    border-radius: 0; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
    transform: translateX(100%);
  }
  .ds-sheet.is-open { transform: translateX(0); }
  .ds-sheet__handle { display: none; }
}

/* ── ds-chip — estado con color semántico (pill 24px) ─────────────────────── */
.ds-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.ds-chip::before { content: ''; width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.ds-chip--success { background: rgba(0,212,170,.12);  color: var(--green); }
.ds-chip--warning { background: rgba(255,170,0,.12);  color: var(--amber); }
.ds-chip--error   { background: rgba(255,79,110,.12); color: var(--red); }
.ds-chip--info    { background: rgba(0,229,255,.12);  color: var(--cyan); }
.ds-chip--neutral { background: rgba(176,176,176,.12); color: var(--text-2); }

/* ── ds-toast — confirmación efímera (§5.4): abajo centrado, 3s, uno a la vez ── */
.ds-toast-stack {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.ds-toast {
  pointer-events: auto; max-width: 90vw;
  background: var(--bg-4); border: 1px solid var(--line-2); color: var(--text);
  font-size: 13px; padding: 11px 18px; border-radius: var(--r-sm); box-shadow: var(--sombra-card);
  opacity: 0; transform: translateY(8px);
  transition: opacity var(--t-quick) var(--e-out), transform var(--t-quick) var(--e-out);
}
.ds-toast.is-open { opacity: 1; transform: translateY(0); }

/* ── ds-empty — estado vacío con acción (icono + frase + 1 CTA) ───────────── */
.ds-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--s-2); padding: var(--s-6) var(--s-3); color: var(--text-2);
}
.ds-empty__icon  { font-size: 32px; opacity: .6; }
.ds-empty__texto { max-width: 320px; font-size: 14px; line-height: 1.5; }
.ds-empty .ds-btn { margin-top: var(--s-1); }

/* ── ds-segmented — selector de 2-4 opciones estilo iOS ───────────────────── */
.ds-segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--bg-3); border-radius: var(--r-sm);
}
.ds-segmented__opcion {
  border: none; background: transparent; color: var(--text-2);
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  padding: 7px 14px; border-radius: calc(var(--r-sm) - 2px); cursor: pointer;
  transition: background var(--t-instant) var(--e-out), color var(--t-instant) var(--e-out);
}
.ds-segmented__opcion.is-active { background: var(--bg); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* ── ds-red-check — selector de cuentas de red (logo + nombre + check) ────── */
.ds-red-check {
  display: flex; align-items: center; gap: var(--s-2);
  min-height: 56px; padding: 10px var(--s-2);
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.ds-red-check:last-child { border-bottom: none; }
.ds-red-check__logo { width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--r-sm); object-fit: contain; }
.ds-red-check__nombre { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.ds-red-check__check {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-instant) var(--e-out), border-color var(--t-instant) var(--e-out);
}
.ds-red-check.is-selected .ds-red-check__check { background: var(--cyan); border-color: var(--cyan); }
.ds-red-check.is-selected .ds-red-check__check::after { content: '✓'; color: var(--bg); font-size: 13px; font-weight: 800; }

/* ── ds-tabla — tabla responsive: escritorio tabla / móvil colapsa a filas ── */
.ds-tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.ds-tabla th {
  padding: 10px var(--s-2); border-bottom: 1px solid var(--line-2);
  text-align: left; color: var(--text-2); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
}
.ds-tabla td { padding: 12px var(--s-2); border-bottom: 1px solid var(--line); color: var(--text); }
.ds-tabla tbody tr { transition: background var(--t-instant) var(--e-out); }
.ds-tabla tbody tr:hover { background: var(--bg-3); }
@media (max-width: 768px) {
  .ds-tabla thead { display: none; }
  .ds-tabla, .ds-tabla tbody, .ds-tabla tr, .ds-tabla td { display: block; width: 100%; }
  .ds-tabla tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .ds-tabla td { display: flex; justify-content: space-between; gap: var(--s-2); padding: 4px var(--s-2); border-bottom: none; }
  .ds-tabla td::before { content: attr(data-label); flex-shrink: 0; color: var(--text-2); font-size: 12px; font-weight: 600; }
}

/* ── ds-preview — vista previa de publicación (media + copy + red + horario) ── */
.ds-preview {
  max-width: 360px; overflow: hidden;
  background: var(--grad-card); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.ds-preview__media { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--bg-3); }
.ds-preview__cuerpo { padding: var(--s-2); }
.ds-preview__copy { margin: 0 0 var(--s-1); font-size: 13px; line-height: 1.5; color: var(--text); white-space: pre-wrap; }
.ds-preview__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--s-1); font-size: 12px; color: var(--text-2); }
.ds-preview__red { display: flex; align-items: center; gap: 6px; }
.ds-preview__red img { width: 16px; height: 16px; object-fit: contain; }

@media (prefers-reduced-motion: reduce) {
  .ds-row, .ds-scrim, .ds-sheet, .ds-toast, .ds-segmented__opcion, .ds-red-check__check, .ds-tabla tbody tr {
    animation: none !important; transition: none !important;
  }
}
