/* ═══════════════════════════════════════════════════════════════════
   Lumen Hub — sistema visual
   ═══════════════════════════════════════════════════════════════════

   Rediseño con el lenguaje visual de Stripe: fondo claro, una sola
   familia tipográfica, tarjetas blancas con sombras muy suaves, un
   morado de marca reservado para la acción principal, y color usado
   solo donde significa algo (un estado, un riesgo) y nunca de adorno.

   Tres decisiones que explican casi todo lo demás:

   1. El fondo NO es blanco puro (#f6f9fc). Sobre blanco puro, una
      tarjeta blanca no tiene contorno y toda la pantalla se aplana.
   2. El morado es escaso a propósito. Si tres cosas en pantalla son
      moradas, ninguna es la importante.
   3. Los datos mandan sobre la decoración: tablas densas, números
      alineados a la derecha y cifras tabulares. Es un panel de
      trabajo, no una página de marketing.
   ═══════════════════════════════════════════════════════════════════ */

:root {
    /* Superficies */
    --bg: #f6f9fc;
    --bg-elevated: #ffffff;
    --bg-sunken: #f7fafc;
    --border: #e3e8ee;
    --border-strong: #d4dbe4;

    /* Texto */
    --text: #0a2540;
    --text-muted: #697386;
    --muted: #697386;          /* alias histórico que algunas vistas usan */

    /* Marca */
    --primary: #635bff;
    --primary-hover: #544dff;
    --primary-soft: #f0efff;
    --primary-text: #4b45c6;

    /* Estados: cada uno con su par fondo/texto para las insignias. */
    --success: #0e6245;
    --success-soft: #d7f7e5;
    --warning: #983705;
    --warning-soft: #fdf3d8;
    --danger: #b3093c;
    --danger-soft: #ffe7ef;
    --info: #3d4eac;
    --info-soft: #e6ebff;

    /* Compatibilidad: nombres que las vistas ya usaban, repuntados a
       valores legibles sobre fondo claro. El dorado y el cian
       originales se eligieron para un fondo casi negro y sobre blanco
       resultaban ilegibles. */
    --gold: #9a6b00;
    --cyan: #0a6c9c;

    /* Gradiente del isotipo. Tokens propios y no --gold/--cyan: el
       logo necesita colores vivos aunque los semánticos se oscurezcan
       para poder leerse como texto. */
    --logo-from: #635bff;
    --logo-to: #00c2ff;

    /* Un acento por tipo de agente, para que el catálogo se lea de un
       vistazo. Nunca como fondo sólido: solo borde, punto e icono. */
    --agent-whatsapp: #0a8a5f;
    --agent-sales: #c2410c;
    --agent-voice: #0a6c9c;
    --agent-marketing: #6d28d9;

    /* Sombras suaves y en dos capas: dan elevación sin que se vea el
       borde duro de una caja. */
    --shadow-sm: 0 1px 2px rgba(10, 37, 64, 0.06);
    --shadow: 0 2px 5px -1px rgba(50, 50, 93, 0.1), 0 1px 3px -1px rgba(10, 37, 64, 0.07);
    --shadow-lg: 0 13px 27px -5px rgba(50, 50, 93, 0.14), 0 8px 16px -8px rgba(10, 37, 64, 0.1);

    --radius: 8px;
    --radius-sm: 6px;

    --sidebar-width: 232px;

    --motion-micro: 160ms;
    --motion-panel: 300ms;
    --motion-success: 500ms;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: inherit;
    color: var(--text);
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem;
    line-height: 1.25;
}

h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

p { margin: 0 0 0.75rem; }

a {
    color: var(--primary-text);
    text-decoration: none;
    transition: color var(--motion-micro) ease;
}

a:hover { color: var(--primary); text-decoration: underline; }

code, pre, .numeric, .stat-value { font-variant-numeric: tabular-nums; }

code {
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.85em;
}

.subtitle { color: var(--text-muted); margin: -0.15rem 0 1.5rem; }
.text-muted { color: var(--text-muted); }
.hint { color: var(--text-muted); font-size: 0.85rem; margin: 0.5rem 0; }
.numeric { text-align: right; }

/* ── Estructura: barra lateral + contenido ──────────────────────── */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.75rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.6rem 1.25rem;
    font-weight: 600;
    font-size: 0.98rem;
    letter-spacing: -0.02em;
    color: var(--text);
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }

.sidebar-section {
    padding: 1.1rem 0.6rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background var(--motion-micro) ease, color var(--motion-micro) ease;
}

.sidebar-nav a:hover { background: var(--bg-sunken); color: var(--text); text-decoration: none; }

.sidebar-nav a.is-active {
    background: var(--primary-soft);
    color: var(--primary-text);
    font-weight: 600;
}

.sidebar-foot {
    border-top: 1px solid var(--border);
    padding-top: 0.9rem;
    margin-top: 0.9rem;
}

.sidebar-user {
    padding: 0 0.6rem 0.6rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
}

.sidebar-foot button {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.sidebar-foot button:hover { background: var(--bg-sunken); color: var(--text); }

.content { padding: 2rem 2.5rem 4rem; max-width: 1180px; width: 100%; }

@media (max-width: 880px) {
    .app-shell { grid-template-columns: 1fr; }

    .sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 0.25rem; }
    .sidebar-section { display: none; }
    .content { padding: 1.5rem 1.25rem 3rem; }
}

/* La barra superior sigue existiendo para el panel de administración
   global, que es una sola sección y no justifica una lateral. */
.topbar {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0.9rem 2rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.topbar-nav { display: flex; gap: 1.25rem; font-size: 0.9rem; }
.topbar-nav a { color: var(--text-muted); font-weight: 500; }
.topbar-nav a:hover { color: var(--text); text-decoration: none; }

.topbar-logout { margin-left: auto; }

.topbar-logout button {
    background: none;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
}

.topbar-logout button:hover { background: var(--bg-sunken); color: var(--text); }

.logo-icon { display: inline-flex; }

.impersonation-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--warning-soft);
    color: var(--warning);
    padding: 0.7rem 2rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
}

.impersonation-banner form { margin: 0; }

.impersonation-banner button {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.7rem;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text);
}

/* ── Botones ────────────────────────────────────────────────────── */

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.55rem 0.95rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--motion-micro) ease, box-shadow var(--motion-micro) ease,
                transform var(--motion-micro) ease, border-color var(--motion-micro) ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-sunken);
    color: var(--text);
    text-decoration: none;
    border-color: #c3ccd8;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-text);
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0;
}

.btn-link:hover { text-decoration: underline; }

button:disabled,
.btn-primary:disabled,
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ── Formularios ────────────────────────────────────────────────── */

.stacked-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-width: 620px;
}

.stacked-form label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 0.85rem;
}

.stacked-form h2 {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.stacked-form h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.stacked-form button[type="submit"] { margin-top: 1.5rem; align-self: flex-start; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    width: 100%;
    font: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--motion-micro) ease, box-shadow var(--motion-micro) ease;
}

input::placeholder, textarea::placeholder { color: #a3acba; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    /* Anillo de foco propio en vez del outline del navegador: se ve
       igual en todos y no se recorta dentro de un contenedor. */
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.18);
}

textarea { resize: vertical; min-height: 80px; line-height: 1.55; }

.stacked-form small,
.stacked-form .hint { color: var(--text-muted); font-size: 0.8rem; margin: 0.1rem 0 0; }

.sequence-step {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    margin: 0.5rem 0;
    box-shadow: var(--shadow-sm);
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.inline-form .hint { margin: 0; }

/* ── Avisos ─────────────────────────────────────────────────────── */

.alert {
    padding: 0.7rem 0.95rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
}

.alert-error {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(179, 9, 60, 0.18);
}

.alert-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: rgba(152, 55, 5, 0.18);
}

.alert-info {
    background: var(--info-soft);
    color: var(--info);
    border-color: rgba(61, 78, 172, 0.16);
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(14, 98, 69, 0.18);
}

.lumen-success-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(14, 98, 69, 0.18);
    padding: 0.7rem 0.95rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

/* ── Insignias y etiquetas ──────────────────────────────────────── */

.badge, .tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--bg-sunken);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: transparent; }
.badge-info    { background: var(--info-soft);    color: var(--info);    border-color: transparent; }

.tag-alert { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.status { font-size: 0.82rem; color: var(--text-muted); }
.status-active { color: var(--success); font-weight: 600; }
.status-paused { color: var(--text-muted); }

.empty { color: var(--text-muted); font-style: italic; padding: 1.5rem 0; text-align: center; }

/* ── KPIs ───────────────────────────────────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat-label { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); }

/* ── Tablas ─────────────────────────────────────────────────────── */

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    font-size: 0.88rem;
}

.admin-table th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-sunken);
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr { transition: background var(--motion-micro) ease; }
.admin-table tbody tr:hover { background: var(--bg-sunken); }
.admin-table th.numeric, .admin-table td.numeric { text-align: right; }

/* ── Filtros ────────────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1.25rem;
}

.filter-bar form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-end; }
.filter-bar label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.filter-bar select, .filter-bar input { width: auto; min-width: 140px; }

.filter-chip {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 0.83rem;
    font-weight: 500;
}

.filter-chip:hover { background: var(--bg-sunken); color: var(--text); text-decoration: none; }

.filter-chip.is-active {
    background: var(--primary-soft);
    border-color: transparent;
    color: var(--primary-text);
    font-weight: 600;
}

/* ── Tarjetas de plan y catálogo ────────────────────────────────── */

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.plan-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: var(--shadow-sm);
    /* La franja superior toma el acento del tipo de agente cuando la
       vista lo declara; si no, el morado de marca. */
    border-top: 3px solid var(--card-accent, var(--primary));
    transition: box-shadow var(--motion-panel) ease, transform var(--motion-panel) ease;
}

.plan-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.plan-price {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0.25rem 0 0.75rem;
}

.plan-features {
    color: var(--text-muted);
    font-size: 0.87rem;
    flex: 1;
    margin-bottom: 1.1rem;
}

ul.plan-features { list-style: none; padding: 0; }
ul.plan-features li { padding: 0.2rem 0; }

/* ── Listado de agentes (dashboard) ─────────────────────────────── */

.agent-list { list-style: none; padding: 0; margin: 0; }

.agent-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.agent-item .status { margin-left: auto; }
.agent-active .status { color: var(--success); font-weight: 600; }

/* ── Autenticación ──────────────────────────────────────────────── */

.auth-card {
    max-width: 400px;
    margin: 5rem auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.25rem;
    box-shadow: var(--shadow-lg);
}

.auth-card h1 { margin-bottom: 0.35rem; }

/* Se apunta a `form` y no a `.stacked-form`: los formularios de entrada y
   registro son <form> pelados, así que una regla atada a esa clase no los
   alcanzaba y el botón salía a medio ancho. */
.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-width: none;
}

.auth-card form label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 0.85rem;
}

.auth-card form button[type="submit"] {
    width: 100%;
    align-self: stretch;
    margin-top: 1.5rem;
}

.auth-switch { margin-top: 1.5rem; text-align: center; font-size: 0.87rem; color: var(--text-muted); }

/* ── Inbox ──────────────────────────────────────────────────────── */

.inbox-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 880px) {
    .inbox-layout { grid-template-columns: 1fr; }
}

.inbox-list { list-style: none; padding: 0; margin: 0; }

.inbox-item {
    display: block;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--motion-micro) ease, box-shadow var(--motion-micro) ease;
}

.inbox-item:hover { border-color: var(--primary); box-shadow: var(--shadow); text-decoration: none; }

/* La conversación abierta. Sin esto no había forma de saber cuál de la
   lista estabas leyendo. */
.inbox-item.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: var(--shadow-sm);
}

.inbox-detail {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.inbox-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 0.9rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.inbox-reply {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.inbox-reply input { flex: 1; }

.conversation-block { margin-bottom: 1.5rem; }

/* ── Mensajes ───────────────────────────────────────────────────── */

.message-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.message {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.6rem 0.85rem;
    border-radius: 12px;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    max-width: 82%;
    font-size: 0.9rem;
}

.message-contact { align-self: flex-start; border-bottom-left-radius: 4px; }

.message-agent, .message-human {
    align-self: flex-end;
    background: var(--primary-soft);
    border-color: rgba(99, 91, 255, 0.18);
    border-bottom-right-radius: 4px;
}

.message-sender {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Kanban ─────────────────────────────────────────────────────── */

.kanban {
    display: grid;
    grid-template-columns: repeat(5, minmax(190px, 1fr));
    gap: 0.85rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.kanban-column {
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    min-height: 220px;
}

.kanban-column h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}

.kanban-count {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0 0.4rem;
    font-size: 0.7rem;
}

.kanban-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.5rem;
    font-size: 0.86rem;
    cursor: grab;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--motion-micro) ease, transform var(--motion-micro) ease;
}

.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }

/* El dropzone es un contenedor permanente, no un estado. Solo necesita
   alto mínimo para poder soltar una tarjeta en una columna vacía; el
   resaltado va en .drag-over, que el JS pone y quita al arrastrar. */
.kanban-dropzone { min-height: 60px; border-radius: var(--radius-sm); }

.kanban-dropzone.drag-over {
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
    background: var(--primary-soft);
}

.kanban-card.dragging { opacity: 0.45; box-shadow: none; }

/* ── Detalle de agente ──────────────────────────────────────────── */

.agent-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.agent-detail-head .subtitle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.agent-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.agent-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.checklist-score { color: var(--text-muted); font-size: 0.84rem; font-weight: 500; }

.checklist {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checklist-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm);
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border-strong);
}

.checklist-item p { margin: 0.2rem 0 0; color: var(--text-muted); font-size: 0.85rem; }
.checklist-item strong { font-size: 0.9rem; }

.checklist-mark {
    flex: 0 0 1.3rem;
    height: 1.3rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 700;
}

.checklist-item.is-ok { border-left-color: var(--success); }
.checklist-item.is-ok .checklist-mark { background: var(--success-soft); color: var(--success); }

.checklist-item.is-blocking { border-left-color: var(--danger); }
.checklist-item.is-blocking .checklist-mark { background: var(--danger-soft); color: var(--danger); }

.checklist-item.is-pending { border-left-color: var(--warning); }
.checklist-item.is-pending .checklist-mark { background: var(--warning-soft); color: var(--warning); }

/* Cajas de URL/valor para copiar */
.url-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
}

.url-box-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-basis: 100%;
}

.url-box code { color: var(--primary-text); word-break: break-all; flex: 1 1 auto; }

.copyable {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.6rem;
    /* Altura fija para que una caja con botón y otra sin él queden
       alineadas cuando comparten fila en el checkout. */
    min-height: 44px;
}

.copyable code { flex: 1; word-break: break-all; font-size: 0.85rem; }
.copyable .btn-secondary { padding: 0.3rem 0.65rem; font-size: 0.78rem; }

/* Vista previa de la landing */
.landing-preview {
    background: var(--bg-sunken);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 1.35rem;
    margin: 1rem 0;
}

.landing-preview h3 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.landing-preview-sub { color: var(--text-muted); margin-top: 0; }

.landing-preview-cta {
    display: inline-block;
    margin-top: 0.75rem;
    background: var(--primary-soft);
    color: var(--primary-text);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.95rem;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Secuencia de seguimiento */
.sequence-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sequence-list li {
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
}

.sequence-list li p { margin: 0.3rem 0 0; font-size: 0.88rem; }

.sequence-when {
    color: var(--primary-text);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Probador */
.sandbox {
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.sandbox .message { background: var(--bg-elevated); }
.sandbox .message-agent { background: var(--primary-soft); }

.tool-call {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--info);
    background: var(--info-soft);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    margin-top: 0.3rem;
    align-self: flex-start;
}

.sandbox-effects { margin-top: 1rem; }

.sandbox-effect-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.86rem;
}

.sandbox-effect-list li::before { content: '→ '; color: var(--text-muted); }

/* Configuración desplegable */
.config-details {
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.config-details summary { cursor: pointer; color: var(--primary-text); font-size: 0.88rem; font-weight: 500; }

.config-pre {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.6;
    max-height: 340px;
    overflow-y: auto;
    margin: 0.75rem 0 0;
}

.have-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.2rem;
}

/* ── Páginas públicas: landing y checkout ───────────────────────── */

.public-page { background: var(--bg); }

.landing { max-width: 700px; margin: 0 auto; padding: 4.5rem 1.5rem; }

.landing-hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.1;
    letter-spacing: -0.035em;
}

.landing-sub { color: var(--text-muted); font-size: 1.15rem; margin-top: 1rem; }
.landing-body { margin: 2.5rem 0; line-height: 1.75; color: #425466; }

.landing-form-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.landing-form-card .stacked-form { max-width: none; }
.landing-form-card .stacked-form button[type="submit"] { width: 100%; align-self: stretch; }

/* Fuera del flujo pero presente en el DOM: es la trampa para bots, y
   una persona no debe verla nunca. */
.landing-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.checkout { max-width: 520px; margin: 0 auto; padding: 3.5rem 1.5rem 4rem; }

.checkout-head { text-align: center; margin-bottom: 1.75rem; }

.checkout-merchant {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.4rem;
}

.checkout-head h1 { font-size: 1.2rem; font-weight: 600; color: var(--text-muted); }

.checkout-amount {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    margin: 0.35rem 0 0;
}

.checkout-amount span { font-size: 1.1rem; font-weight: 600; color: var(--text-muted); }

.checkout-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
}

.checkout-steps {
    margin: 0 0 1.5rem;
    padding-left: 1.15rem;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.7;
}

.checkout-steps strong { color: var(--text); }

.checkout-field { margin-bottom: 1rem; }

.checkout-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.checkout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

@media (max-width: 480px) {
    .checkout-grid { grid-template-columns: 1fr; }
}

.checkout-grid .checkout-field > code {
    display: flex;
    align-items: center;
    min-height: 44px;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
}

.checkout-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    font-size: 0.82rem;
    margin: 1.25rem 0 0;
}

.checkout-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 1.5rem;
}

.checkout-done { text-align: center; color: var(--success); }
.checkout-done h2 { color: var(--text); margin-top: 0.75rem; }
.checkout-done p { color: var(--text-muted); margin: 0; }

.checkout-footer { text-align: center; color: var(--text-muted); font-size: 0.78rem; margin-top: 2rem; }

/* ── Isotipo Lumen ──────────────────────────────────────────────── */

.logo-mark { display: block; overflow: visible; }
.logo-mark-glow { opacity: 0; }
.logo-mark--idle .logo-mark-aperture { stroke: var(--border-strong); }

@media (prefers-reduced-motion: no-preference) {
    .logo-mark--idle .logo-mark-glow { animation: lumen-breathe 4s ease-in-out infinite; }

    .logo-icon:hover .logo-mark-glow,
    .sidebar-brand:hover .logo-mark-glow { opacity: 0.55; }

    .logo-mark--splash .logo-mark-beam,
    .logo-mark--splash .logo-mark-glow {
        stroke-dasharray: 40;
        stroke-dashoffset: 40;
        animation: lumen-draw-beam 900ms cubic-bezier(0.22, 1, 0.36, 1) 120ms forwards;
    }

    .logo-mark--splash .logo-mark-aperture {
        stroke-dasharray: 100;
        stroke-dashoffset: 100;
        animation: lumen-draw-beam 1100ms ease-out forwards;
    }

    .logo-mark--splash .logo-mark-dot { opacity: 0; animation: lumen-fade-in 400ms ease-out 800ms forwards; }

    .logo-mark--loop .logo-mark-aperture {
        stroke-dasharray: 25 75;
        transform-origin: center;
        animation: lumen-spin 1.4s linear infinite;
    }
}

@keyframes lumen-breathe {
    0%, 100% { opacity: 0.12; }
    50% { opacity: 0.4; }
}

@keyframes lumen-draw-beam { to { stroke-dashoffset: 0; } }
@keyframes lumen-fade-in { to { opacity: 1; } }
@keyframes lumen-spin { to { transform: rotate(360deg); } }

/* ── Splash de entrada ──────────────────────────────────────────── */

.lumen-splash {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--bg);
}

.lumen-splash.is-visible { display: flex; }
.lumen-splash.is-leaving { opacity: 0; transition: opacity 400ms ease; }

.lumen-splash-word {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.42em;
    text-indent: 0.42em;
    color: var(--text-muted);
    opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
    .lumen-splash.is-animating .lumen-splash-word {
        animation: lumen-fade-in 500ms ease-out 700ms forwards;
    }
}

/* ── Punto de "en vivo" ─────────────────────────────────────────── */

.pulse-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--dot-color, var(--success));
    margin-right: 0.4rem;
    vertical-align: middle;
    flex: 0 0 auto;
}

@media (prefers-reduced-motion: no-preference) {
    .pulse-dot.is-live { animation: lumen-pulse 2.2s ease-in-out infinite; }
}

@keyframes lumen-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(14, 98, 69, 0.35); }
    50% { box-shadow: 0 0 0 4px rgba(14, 98, 69, 0); }
}

/* ── Palomita animada del banner de éxito ───────────────────────── */

.check-draw path { stroke-dasharray: 24; stroke-dashoffset: 24; }

@media (prefers-reduced-motion: no-preference) {
    .check-draw path { animation: lumen-draw 500ms ease-out 100ms forwards; }
}

@keyframes lumen-draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
    .check-draw path { stroke-dashoffset: 0; }
    .logo-mark-beam, .logo-mark-aperture { stroke-dashoffset: 0 !important; }
    .logo-mark-dot { opacity: 1 !important; }
}
