:root {
    --brand-primary: #5b2aa8;
    --brand-primary-deep: #2c1259;
    --brand-accent: #ec4899;
    --brand-accent-deep: #9f1254;

    /* Tokens semánticos del botón primario — cámbialos al replicar este
     * sistema para otro cliente y TODOS los botones primarios de la app
     * (profile, leads, convertir lead, compose de notas, etc.) se ajustan
     * en un solo lugar. */
    --btn-primary-bg:          linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    --btn-primary-bg-hover:    linear-gradient(135deg, var(--brand-primary-deep) 0%, var(--brand-accent-deep) 100%);
    --btn-primary-color:       #ffffff;
    --btn-primary-shadow:      0 6px 16px rgba(91, 42, 168, 0.28);
    --btn-primary-shadow-hover: 0 10px 22px rgba(91, 42, 168, 0.34);
    --btn-primary-focus-ring:  0 0 0 3px rgba(236, 72, 153, 0.22);

    --bg-base: #100926;
    --bg-soft: #1a0e3d;

    --card-bg: rgba(255, 255, 255, 0.07);
    --card-border: rgba(255, 255, 255, 0.18);
    --input-bg: rgba(255, 255, 255, 0.08);
    --input-border: rgba(255, 255, 255, 0.20);

    --text-main: #f5f3ff;
    --text-soft: rgba(245, 243, 255, 0.75);
    --text-muted: rgba(245, 243, 255, 0.55);

    --shadow-soft: 0 24px 60px rgba(0, 0, 0, 0.45);
    --radius-xl: 28px;
    --radius-lg: 16px;
    --radius-md: 10px;

    --status-al-dia: #10b981;
    --status-por-vencer: #f59e0b;
    --status-vencida: #ef4444;
    --status-para-retirar: #7f1d1d;
    --status-pausada: #6b7280;
    --status-retirada: #1f2937;

    --main-bg: #ffffff;
    --main-text: #1f1b2e;
    --main-text-soft: #4b5563;
    --main-text-muted: #9ca3af;
    --main-border: #e5e7eb;
    --main-surface: #f9fafb;
    --main-shadow: 0 4px 16px rgba(23, 12, 48, 0.06);

    --sidebar-width: 240px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
/* overflow-x: clip recorta el contenido horizontal sin crear un contenedor
   scrollable — así el sidebar izquierdo (position: sticky) sigue funcionando
   contra el viewport. `hidden` aquí rompería el sticky. */
html { overflow-x: clip; }
body { overflow-x: clip; }
body {
    font-family: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
    background:
        radial-gradient(circle at 15% 10%, rgba(236, 72, 153, 0.28), transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(91, 42, 168, 0.45), transparent 50%),
        radial-gradient(circle at 50% 90%, rgba(159, 18, 84, 0.25), transparent 55%),
        var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Portal (login) ────────────────────────────────────────────────────── */
.portal-shell {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 36px 32px 32px;
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(255,255,255,0.11), rgba(255,255,255,0.04));
    border: 1px solid var(--card-border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
}

.login-logo {
    display: block;
    width: 100%;
    max-width: 360px;
    height: auto;
    object-fit: contain;
    margin: 0 auto 14px;
}
.login-subtitle {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-main);
    margin: 0 0 4px;
    text-align: center;
}
.login-logo {
    display: block;
    width: 100%;
    max-width: 180px;
    height: auto;
    margin: 0 auto 8px;
    object-fit: contain;
}
.login-header h1 {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 26px;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.login-header p { margin: 0 0 24px; color: var(--text-soft); font-size: 14px; text-align: center; }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.input-wrap { display: flex; flex-direction: column; gap: 6px; }
.input-wrap span { font-size: 13px; color: var(--text-soft); }

/* Check "Recordarme" del login */
.login-remember {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 4px 0 16px;
    cursor: pointer;
}
.login-remember input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #7c3aed;
}
.login-remember-text {
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.login-remember-text small {
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.35;
}
.input-wrap input,
.input-wrap select,
.input-wrap textarea {
    padding: 12px 14px;
    border-radius: var(--radius-lg);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    backdrop-filter: blur(8px);
}
.input-wrap input:focus,
.input-wrap select:focus,
.input-wrap textarea:focus {
    outline: none;
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.18);
}

.btn-primary {
    margin-top: 8px;
    padding: 13px 16px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    box-shadow: var(--btn-primary-shadow);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-primary:hover {
    background: var(--btn-primary-bg-hover);
    transform: translateY(-1px);
    box-shadow: var(--btn-primary-shadow-hover);
}
.btn-primary:focus-visible { outline: none; box-shadow: var(--btn-primary-shadow), var(--btn-primary-focus-ring); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; transform: none; }

.btn-link {
    background: transparent;
    border: none;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 8px;
}
.btn-link:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.06); }

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    font-size: 13px;
}
.alert-error {
    background: #fef2f2;
    border: 1.5px solid #ef4444;
    color: #991b1b;
    font-weight: 600;
}
/* Cuando el alert vive dentro de un modal oscuro (login), mantenemos la variante original con buen contraste sobre fondo glass oscuro. */
.portal-shell .alert-error,
.login-card .alert-error {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.55);
    color: #fecaca;
    font-weight: 500;
}
.alert-info {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.32);
    color: #6ee7b7;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    font-size: 13px;
}
.portal-forgot {
    display: block;
    margin-top: 6px;
    text-align: center;
    color: var(--text-soft);
    font-size: 12px;
    padding: 6px;
}
.portal-forgot:hover { color: var(--brand-accent); }

.recaptcha-notice {
    margin: 14px 0 0;
    text-align: center;
    font-size: 10.5px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
.recaptcha-notice a {
    color: var(--text-soft);
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.25);
}
.recaptcha-notice a:hover { color: var(--brand-accent); }

/* Esconder badge flotante de reCAPTCHA v3 (ya damos aviso textual) */
.grecaptcha-badge { visibility: hidden !important; }

/* ── App shell (sidebar + main) ────────────────────────────────────────── */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    padding: 24px 16px 80px; /* bottom 80px para que el user-chip no quede tapado por .app-footer */
    background: rgba(20, 10, 45, 0.55);
    border-right: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    position: sticky; top: 0; align-self: start; height: 100vh;
    display: flex; flex-direction: column;
    overflow-y: auto;
}

.brand {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px;
    padding: 8px 8px 20px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    color: inherit;
    flex-shrink: 0;
    overflow: hidden;
    text-decoration: none;
}
.brand-logo {
    display: block;
    width: 100%;
    max-width: 110px;
    height: auto;
    object-fit: contain;
}

.app-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; min-height: 0; }
.nav-link {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-soft);
    font-size: 14px;
    transition: background 0.12s ease, color 0.12s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: var(--text-main); }
.nav-link.is-active {
    background: rgba(236, 72, 153, 0.18);
    color: #fff;
    border: 1px solid rgba(236, 72, 153, 0.32);
}
.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--brand-accent);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ── Botón "Reportar error" del sidebar ─────────────────────────────────
   Va debajo del user chip. Discreto, no compite con la nav. */
.sidebar-report-bug {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 10px;
    color: rgba(255,255,255,0.7);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-align: left;
    flex-shrink: 0;
}
.sidebar-report-bug:hover {
    background: rgba(236, 72, 153, 0.12);
    border-color: rgba(236, 72, 153, 0.45);
    border-style: solid;
    color: #fff;
}
.sidebar-report-bug-icon {
    font-size: 16px;
    line-height: 1;
}
.sidebar-report-bug-label { flex: 1; }

/* ── Sidebar user chip + popover (abajo del sidebar) ─────────────────── */
.sidebar-user {
    position: relative;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
    flex-shrink: 0;
}
.sidebar-user-chip {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}
.sidebar-user-chip:hover { background: rgba(255,255,255,0.08); border-color: rgba(236, 72, 153, 0.45); }
.sidebar-user-chip[aria-expanded="true"] { background: rgba(236, 72, 153, 0.12); border-color: rgba(236, 72, 153, 0.55); }
.sidebar-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,0.22);
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar-user-info {
    display: flex; flex-direction: column; min-width: 0; flex: 1;
    line-height: 1.1;
}
.sidebar-user-name {
    font-size: 13px; font-weight: 600;
    color: var(--text-main);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-role {
    font-size: 11px; font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-chevron {
    font-size: 12px; color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.sidebar-user-chip[aria-expanded="true"] .sidebar-user-chevron { transform: rotate(180deg); color: var(--brand-accent); }

.sidebar-user-menu {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0; right: 0;
    padding: 6px;
    background: rgba(24, 12, 52, 0.98);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 20;
    backdrop-filter: blur(20px);
}
.sidebar-user.is-open .sidebar-user-menu { display: flex; animation: sidebar-popup 0.14s ease-out; }
@keyframes sidebar-popup {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.sidebar-user-menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border-radius: calc(var(--radius-md) - 2px);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.12s;
}
.sidebar-user-menu-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-user-menu-item-danger:hover { background: rgba(239, 68, 68, 0.22); color: #fecaca; }
.sidebar-user-menu-icon { font-size: 15px; line-height: 1; }
.sidebar-user-menu-version {
    margin-left: auto;
    font-size: 10.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.app-main {
    padding: 24px 32px 48px;
    background: var(--main-bg);
    color: var(--main-text);
    min-height: 100vh;
}

.app-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    /* Sticky al viewport: siempre se ve el título + chip del usuario */
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 14px 0 12px;
    background: linear-gradient(180deg, var(--main-bg) 0%, var(--main-bg) 85%, rgba(247, 243, 255, 0) 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.preview-banner {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 14px;
    margin-bottom: 18px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: var(--radius-md);
    color: #78350f;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}
.preview-banner-icon {
    font-size: 18px; line-height: 1; flex-shrink: 0;
}
.app-header h1 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 24px;
    margin: 0;
    color: var(--main-text);
}

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    background: rgba(20, 10, 45, 0.92);
    border: 1px solid var(--card-border);
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.user-chip-identity {
    display: flex; align-items: center; gap: 8px;
    color: inherit;
    padding: 2px 4px 2px 2px;
    border-radius: 999px;
    transition: background 0.15s;
}
.user-chip-identity:hover { background: rgba(255,255,255,0.08); }
.user-chip-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,0.25);
}
.user-chip-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-chip-initials { line-height: 1; letter-spacing: 0; }
.user-chip-name { white-space: nowrap; }
.user-chip .btn-link {
    color: rgba(255,255,255,0.72);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.06em;
}
.user-chip .btn-link:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
}

@media (max-width: 560px) {
    .user-chip-name { display: none; }
}

.role-badge {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}
.role-admin       { background: #dc2626; color: #ffffff; }
.role-super_admin { background: #dc2626; color: #ffffff; }
.role-asistente { background: rgba(16, 185, 129, 0.28); color: #bbf7d0; }

/* Role badge sobre fondo claro (tabla de actividad) — alto contraste */
.data-table .role-badge.role-admin       { background: #dc2626; color: #ffffff; }
.data-table .role-badge.role-super_admin { background: #dc2626; color: #ffffff; }
.data-table .role-badge.role-asistente   { background: #10b981; color: #ffffff; }

.app-content { display: flex; flex-direction: column; gap: 16px; }

.card {
    padding: 24px 28px;
    border-radius: var(--radius-xl);
    background: #ffffff;
    border: 1px solid var(--main-border);
    box-shadow: var(--main-shadow);
    color: var(--main-text);
}
.card h2 {
    margin: 0 0 10px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--main-text);
}
.card p { margin: 0 0 8px; color: var(--main-text-soft); line-height: 1.55; }
.muted { color: var(--main-text-muted) !important; font-size: 13px; }

/* ── KPI cards (dashboard) ─────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    background: #ffffff;
    border: 1px solid var(--main-border);
    box-shadow: var(--main-shadow);
    transition: transform 0.12s ease, border-color 0.12s ease;
    text-decoration: none;
    color: var(--main-text);
}
a.kpi-card:hover { transform: translateY(-2px); }
a.kpi-card.is-active {
    box-shadow: 0 0 0 2px var(--brand-accent), var(--main-shadow);
    transform: translateY(-2px);
}
.kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;  /* reducido de 0.08em para que quepan labels de 2-3 palabras */
    color: var(--main-text-muted);
    white-space: nowrap;     /* nunca partir en 2 líneas */
    overflow: hidden;
    text-overflow: ellipsis; /* fallback: si aún así no cabe, pone "..." */
}
.kpi-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}
.kpi-retirada       { border-left: 4px solid #1f2937; }
.kpi-retirada .kpi-value { color: #1f2937; }
.kpi-pendiente-pago { border-left: 4px solid #7f1d1d; }
.kpi-pendiente-pago .kpi-value { color: #7f1d1d; }
.kpi-vencida        { border-left: 4px solid #ef4444; }
.kpi-vencida .kpi-value { color: #b91c1c; }
.kpi-por-vencer     { border-left: 4px solid #f59e0b; }
.kpi-por-vencer .kpi-value { color: #b45309; }
.kpi-activa         { border-left: 4px solid #10b981; }
.kpi-activa .kpi-value { color: #047857; }
.kpi-neutral        { border-left: 4px solid var(--main-border); }
.kpi-neutral .kpi-value { color: var(--main-text-soft); }

/* KPIs de fuente (Manuales / Hotmart) — azul y rojo según paleta oficial */
.kpi-source-manual       { border-left: 4px solid #2563eb; }
.kpi-source-manual .kpi-value  { color: #1d4ed8; }
.kpi-source-hotmart      { border-left: 4px solid #be185d; }
.kpi-source-hotmart .kpi-value { color: #9f1239; }

/* Puntito de fuente al lado del ciclo en la tabla de miembros */
.source-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.source-dot.source-manual  { background: #2563eb; }  /* azul */
.source-dot.source-hotmart { background: #be185d; }  /* rojo/magenta Hotmart */

/* Input de contraseña con "ojito" transparente dentro del input.
   El botón NO tiene caja visible (sin background, sin border, sin padding),
   solo el SVG flotando sobre el padding-right del input. Solo UNO de los
   dos SVGs (icon-show / icon-hide) se ve a la vez, según la clase
   `.is-revealed` que le pone el onclick en auth.php::password_toggle_button.
   Usado en portal.php, reset-password.php y profile.php. */
.password-field {
    position: relative;
    display: block;
}
.password-field input {
    width: 100%;
    padding-right: 38px !important;
}
.password-field .password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: block;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    color: #9ca3af;
    line-height: 0;
    transition: color 120ms;
}
.password-field .password-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
    pointer-events: none;
}
/* Solo uno de los dos iconos visible a la vez. Default = .icon-show. */
.password-field .password-toggle .icon-show { display: block; }
.password-field .password-toggle .icon-hide { display: none; }
.password-field .password-toggle.is-revealed .icon-show { display: none; }
.password-field .password-toggle.is-revealed .icon-hide { display: block; }
.password-field .password-toggle:hover,
.password-field:focus-within .password-toggle {
    color: var(--brand-accent, #5b2aa8);
}
.password-field .password-toggle:focus { outline: none; }
.password-field .password-toggle:focus-visible {
    outline: 2px solid var(--brand-accent, #5b2aa8);
    outline-offset: 2px;
    border-radius: 3px;
}

/* Grupo de filtros Manual/Hotmart/Todos — usado en /retirados.php */
.source-filter-group {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    margin-left: 8px;
}
.source-filter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--main-border);
    text-decoration: none;
    font-size: 13px;
    color: var(--main-text);
    background: #fff;
    transition: all 120ms;
}
/* Nota: estos selectores van con prefijo .app-main para ganarle a la regla
   genérica `.app-main .btn-link { color: var(--brand-accent) }` que tiene
   la misma especificidad y viene después en el CSS. Sin este prefijo, el
   color blanco del botón activo no se aplica. */
.app-main .source-filter {
    color: var(--main-text);
    text-decoration: none;
}
.app-main .source-filter:hover {
    border-color: #94a3b8;
    background: #f8fafc;
    color: var(--main-text);
}
.app-main .source-filter.is-active {
    background: linear-gradient(135deg, var(--brand-accent), var(--brand-primary));
    color: #fff;
    font-weight: 700;
    border-color: transparent;
}
.app-main .source-filter.is-active:hover {
    background: #f8fafc;
    color: var(--main-text);
    border-color: #94a3b8;
    font-weight: inherit;
}
.source-filter.is-active .source-dot { box-shadow: 0 0 0 2px rgba(255,255,255,0.3); }
.source-filter.is-active:hover .source-dot { box-shadow: none; }

/* Section header con fila flex para título + filtros alineados */
.section-header-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.section-header-row h2 { margin: 0; }

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 8px 0 12px;
}
.section-header h2 {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--main-text);
}

/* ── Row action buttons ───────────────────────────────────────────────── */
/* NO usar display: flex en el <td> directo — rompe table-cell y descuadra
   el border-bottom de la columna respecto a las otras. Usamos spacing
   inline con margin-left entre hijos. */
.row-actions > * {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    vertical-align: middle;
    /* v1.12.1: altura uniforme entre todos los hijos del row-actions
       (.btn-pay, .btn-wa, .btn-link "Editar", "Ver en tareas →") para
       que .vertical-align: middle los centre en la línea sin que .btn-link
       quede desplazado hacia arriba por su font-size mayor. */
    min-height: 28px;
    box-sizing: border-box;
}
.row-actions > *:first-child { margin-left: 0; }
.btn-pay {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    background: #10b981;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.02em;
}
.btn-pay:hover { background: #059669; }
.btn-wa {
    padding: 6px 12px;
    border-radius: 8px;
    background: #25d366;
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.btn-wa:hover { background: #1ebe5a; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(16, 9, 38, 0.55);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}
.modal-backdrop.is-open { display: flex; }
.modal-card {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 40px);   /* no puede pasar del viewport */
    overflow-y: auto;                  /* scroll interno si el contenido crece (ej. preview de captura) */
    background: #ffffff;
    border-radius: var(--radius-xl);
    padding: 28px 28px 24px;
    box-shadow: 0 28px 72px rgba(0, 0, 0, 0.35);
    animation: modalIn 0.18s ease-out;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-card h2 {
    margin: 0 0 4px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--main-text);
}
.modal-card .form-grid { margin-top: 16px; }
.modal-card .form-actions { margin-top: 20px; padding-top: 16px; }
.modal-card .alert { margin-top: 12px; margin-bottom: 0; }

/* ── Toolbar + filters ─────────────────────────────────────────────────── */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-form input[type="search"],
.filter-form select {
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--main-border);
    background: #ffffff;
    color: var(--main-text);
    font-size: 13px;
    font-family: inherit;
    min-width: 140px;
}
.filter-form input[type="search"] {
    min-width: 220px;
}
.filter-form input[type="search"]:focus,
.filter-form select:focus {
    outline: none;
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12);
}

/* Override: cuando .btn-primary vive dentro de .filter-form (ej. "Exportar CSV"),
   lo bajamos al mismo tamaño/alto que los selects y quitamos el margin-top
   heredado, así toda la línea queda perfectamente alineada. */
.filter-form .btn-primary {
    margin-top: 0;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: var(--radius-md);
    line-height: 1.2;
}

.btn-secondary {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--main-border);
    background: var(--main-surface);
    color: var(--main-text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.btn-secondary:hover { background: #ffffff; border-color: var(--brand-accent); color: var(--brand-accent); }

.btn-sm { padding: 8px 14px; font-size: 13px; }

.btn-danger {
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.4);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.08); color: #b91c1c; border-color: #ef4444; }

/* Botón "Limpiar filtros" — siempre visible, atenuado cuando no hay filtros. */
.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--main-text-soft);
    border-color: var(--main-border);
    background: #fff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--main-border);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}
.btn-clear-filters:hover {
    color: #b91c1c;
    border-color: #ef4444;
    background: #fef2f2;
}
.btn-clear-filters.is-inactive {
    opacity: 0.45;
    pointer-events: none; /* deshabilitado visualmente cuando no hay filtros */
}

/* Chips de resumen de filtro bajo la toolbar */
.filter-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin: 0 0 14px;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--main-text);
}
.filter-summary-count {
    font-weight: 600;
    color: var(--main-text);
    margin-right: 4px;
}
.filter-summary-count strong {
    color: #5b2aa8;
    font-size: 15px;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e9d5ff;
    color: #5b2aa8;
    font-size: 12px;
    font-weight: 500;
}
.filter-note {
    flex: 1 1 100%;
    font-size: 12px;
    color: var(--main-text-muted);
    margin-top: 4px;
}

.retirement-banner {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--main-text);
    margin: 12px 0 16px;
    padding: 14px 16px;
}
.retirement-banner strong { color: #b91c1c; }
.retirement-banner p { margin: 6px 0; color: var(--main-text-soft); }
.retirement-banner small { display: block; color: var(--main-text-muted); font-size: 12px; }

/* ── Footer ──────────────────────────────────────────────────────────── */
/* En desktop el footer empieza donde termina la sidebar (ancho --sidebar-width)
   para que el contenido quede visualmente centrado respecto al área de trabajo,
   no respecto al viewport completo. En mobile (≤720px) la sidebar pasa a ser
   una barra horizontal arriba, así que el footer va edge-to-edge. */
.app-footer {
    position: fixed;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: rgba(16, 9, 38, 0.95);
    color: rgba(255, 255, 255, 0.72);
    padding: 10px 20px;
    font-size: 12px;
    text-align: center;
    border-top: 1px solid var(--card-border);
    z-index: 30;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.app-footer-sep { opacity: 0.35; }
.app-footer-version {
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    transition: color 0.15s;
}
.app-footer-version:hover { color: var(--brand-accent); }
/* v1.9.0: aumentado de 60px a 120px (~2 líneas extra) para que el footer
   fijo no tape las últimas filas de tablas largas bajo cualquier nivel de
   zoom del navegador. Afecta a /members.php, /leads.php, /cursos.php,
   /activity.php, /retirados.php — cualquier página con tabla larga. */
.app-main { padding-bottom: 120px !important; }

/* ── Lightbox (adjuntos) ─────────────────────────────────────────────── */
.lightbox-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.78);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 60;
    backdrop-filter: blur(6px);
}
.lightbox-backdrop.is-open { display: flex; }
/* Wrapper que contiene la imagen. La X se posiciona relativa a este wrapper,
   no al backdrop fullscreen — así queda en la esquina superior derecha de la
   foto en sí, no flotando en el medio de la pantalla cuando la imagen es chica. */
.lightbox-frame {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 90vh;
}
.lightbox-img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.72);
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: background 0.15s, transform 0.1s;
}
.lightbox-close:hover { background: rgba(0, 0, 0, 0.92); transform: scale(1.08); }

/* ── History timeline (member detail) ─────────────────────────────────── */
.history-card {
    background: #ffffff;
    border: 1px solid var(--main-border);
    border-radius: var(--radius-xl);
    margin-top: 16px;
    box-shadow: var(--main-shadow);
    overflow: hidden;
}
.history-card > summary.history-summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--main-text);
}
.history-card > summary.history-summary::-webkit-details-marker { display: none; }
.history-count {
    flex: 1;
    font-size: 12px;
    color: var(--main-text-muted);
    font-weight: 600;
}
.history-chevron {
    font-size: 12px;
    color: var(--main-text-muted);
    transition: transform 0.18s ease;
}
.history-card[open] > summary.history-summary .history-chevron { transform: rotate(180deg); }

.history-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--main-border);
}
.history-event {
    position: relative;
    border-bottom: 1px solid var(--main-border);
}
.history-event:last-child { border-bottom: none; }
.history-event details { width: 100%; }
.history-event summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 22px;
    display: grid;
    grid-template-columns: 24px 1fr auto auto;
    gap: 10px;
    align-items: center;
    font-size: 14px;
}
.history-event summary::-webkit-details-marker { display: none; }
.history-event:not(.has-detail) summary { cursor: default; }
.history-icon { font-size: 18px; line-height: 1; }
.history-title { color: var(--main-text); }
.history-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.history-date {
    font-size: 12px;
    color: var(--main-text-muted);
    white-space: nowrap;
}
.history-body {
    padding: 12px 22px 16px 56px;
    background: var(--main-surface);
    color: var(--main-text-soft);
    font-size: 13px;
    border-top: 1px dashed var(--main-border);
}
.history-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px 18px;
    margin: 0 0 10px;
}
.history-fields dt {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--main-text-muted);
    margin-bottom: 3px;
}
.history-fields dd { margin: 0; color: var(--main-text); font-size: 13px; }
.history-view-attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 7px 14px;
}

.retire-attachment-row { grid-column: 1 / -1; }
.retire-preview,
.payment-preview {
    margin-top: 8px;
    border: 1px dashed var(--main-border);
    border-radius: var(--radius-md);
    padding: 8px;
    text-align: center;
    max-height: 260px;
    overflow: hidden;
}
.retire-preview img,
.payment-preview img {
    max-width: 100%;
    max-height: 240px;
    border-radius: var(--radius-md);
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* v1.15.0: componente multi-attachment (input file con drop, paste, preview) */
.mai-wrap {
    margin-top: 8px;
    width: 100%;
}
.mai-label {
    font-size: 12.5px;
    color: #475569;
    margin-bottom: 6px;
}
.mai-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 18px 16px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    color: #475569;
    font-size: 13px;
    transition: border-color 0.15s ease, background 0.15s ease;
    user-select: none;
}
.mai-dropzone:hover { border-color: var(--brand-primary, #5b2aa8); background: #faf5ff; }
.mai-dropzone:focus-visible { outline: 2px solid var(--brand-primary, #5b2aa8); outline-offset: 2px; }
.mai-dropzone.is-dragover { border-color: var(--brand-primary, #5b2aa8); background: #f3e8ff; }
.mai-dropzone-text strong { color: #2a1a3a; }

.mai-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mai-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.mai-thumb {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 6px;
    background: #f1f5f9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}
.mai-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mai-thumb-pdf { background: #fee2e2; color: #b91c1c; }

.mai-meta { flex: 1; min-width: 0; }
.mai-fname {
    font-size: 13px;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mai-fsize { font-size: 11.5px; color: #94a3b8; margin-top: 2px; }

.mai-remove {
    background: transparent;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}
.mai-remove:hover { background: #fee2e2; }

.mai-help { display: block; margin-top: 6px; font-size: 11.5px; line-height: 1.4; }
.mai-error {
    margin-top: 6px;
    color: #b91c1c;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12.5px;
}

/* Previews de adjuntos en historiales/listados (galería de varios) */
.attachment-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.attachment-gallery a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    font-size: 11.5px;
    color: #3730a3;
    text-decoration: none;
}
.attachment-gallery a:hover { background: #e0e7ff; }
.attachment-gallery a img {
    width: 18px;
    height: 18px;
    object-fit: cover;
    border-radius: 3px;
}

.app-main .btn-link {
    color: var(--main-text-soft);
}
.app-main .btn-link:hover { color: var(--brand-accent); background: transparent; }

/* ── Data table ────────────────────────────────────────────────────────── */
.card-flush { padding: 0; overflow: hidden; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--main-text-soft);
    background: var(--main-surface);
    border-bottom: 1px solid var(--main-border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.data-table thead th.th-sort { padding: 0; }
.data-table thead th.th-sort a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    color: inherit;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}
.data-table thead th.th-sort a:hover { background: #ffffff; color: var(--main-text); }
.data-table thead th.th-sort.is-active a { color: var(--brand-accent); }
.th-arrow {
    font-size: 9px;
    line-height: 1;
    letter-spacing: 0;
}
.th-arrow-idle { opacity: 0.35; }
.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--main-border);
    color: var(--main-text);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(236, 72, 153, 0.02); }
.data-table tbody tr.row-flash {
    background: rgba(16, 185, 129, 0.12) !important;
    transition: background 1.2s ease-out;
}

.row-sub {
    font-size: 12px;
    color: var(--main-text-muted);
    margin-top: 2px;
}
.row-actions { text-align: right; white-space: nowrap; }

/* ── Status chips ──────────────────────────────────────────────────────── */
.status-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.status-activa         { background: rgba(16, 185, 129, 0.14); color: #047857; }
.status-al-dia         { background: rgba(16, 185, 129, 0.14); color: #047857; }
.status-por-vencer     { background: rgba(245, 158, 11, 0.16); color: #b45309; }
.status-vencida        { background: rgba(239, 68, 68, 0.14); color: #b91c1c; }
.status-pendiente-pago { background: rgba(127, 29, 29, 0.20); color: #7f1d1d; }
.status-retirada       { background: rgba(31, 41, 55, 0.85); color: #ffffff; }
.status-pausada        { background: rgba(107, 114, 128, 0.16); color: #4b5563; }

.group-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.group-in  { background: rgba(16, 185, 129, 0.12); color: #047857; }
.group-out { background: rgba(239, 68, 68, 0.12);  color: #b91c1c; }

.source-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--main-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Forms (light area) ───────────────────────────────────────────────── */
.form-card { max-width: 880px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.input-wrap.light span { color: var(--main-text-soft); font-weight: 500; }
.input-wrap.light input,
.input-wrap.light select,
.input-wrap.light textarea {
    background: #ffffff;
    border: 1px solid var(--main-border);
    color: var(--main-text);
    font-size: 14px;
    backdrop-filter: none;
}
.input-wrap.light input:focus,
.input-wrap.light select:focus,
.input-wrap.light textarea:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.14);
}

.input-wrap.full-width { grid-column: 1 / -1; margin-top: 16px; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--main-border);
    align-items: center;
}

.empty-state {
    padding: 48px 20px;
    text-align: center;
    color: var(--main-text-muted);
}
.empty-state p { margin: 0 0 16px; }

/* ── Member detail page ───────────────────────────────────────────────── */
.detail-wrap { max-width: 820px; }
.detail-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.detail-toolbar-right { display: flex; gap: 8px; }

.detail-card { padding: 28px 32px; }
.detail-header { margin-bottom: 20px; }
.detail-header h2 {
    margin: 0 0 6px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--main-text);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px 28px;
    margin: 0;
}
.detail-grid dt {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--main-text-muted);
    margin-bottom: 4px;
}
.detail-grid dd {
    margin: 0;
    font-size: 15px;
    color: var(--main-text);
}

.row-name-link {
    color: var(--main-text);
    text-decoration: none;
}
.row-name-link:hover strong { color: var(--brand-accent); text-decoration: underline; }

.check-name-link {
    color: inherit;
    text-decoration: none;
}
.check-name-link:hover { color: var(--brand-accent); text-decoration: underline; }

/* ── Filter tabs (tasks page) ─────────────────────────────────────────── */
.filter-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--main-surface);
    border: 1px solid var(--main-border);
    border-radius: var(--radius-lg);
}
.filter-tabs .tab {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--main-text-soft);
    transition: background 0.12s ease, color 0.12s ease;
}
.filter-tabs .tab:hover { background: #ffffff; color: var(--main-text); }
.filter-tabs .tab.is-active {
    background: #ffffff;
    color: var(--brand-accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* ── Dashboard charts ─────────────────────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
    max-width: 924px;
}
@media (max-width: 720px) {
    .charts-grid { grid-template-columns: 1fr; }
}

/* ── Form bases reutilizables (perfil + modales + edición) ───────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}
.form-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.form-field.full { grid-column: 1 / -1; }
.form-field label {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--main-text-soft);
    margin-bottom: 6px;
}
.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    background: var(--main-surface);
    border: 1.5px solid var(--main-border);
    border-radius: var(--radius-md);
    color: var(--main-text);
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
.form-field textarea { min-height: 84px; padding: 10px 14px; resize: vertical; height: auto; }
.form-field select {
    /* chevron */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23475569' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 34px;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--brand-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(91, 42, 168, 0.12);
}
.form-field input:disabled,
.form-field select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--main-surface);
}
.form-hint {
    margin: 0;
    font-size: 11.5px;
    color: var(--main-text-muted);
}
.form-hint.full { grid-column: 1 / -1; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--main-border);
}

/* Botones reutilizables — mismos colores de marca en toda la app. */
.btn {
    height: 38px;
    padding: 0 18px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.08s, box-shadow 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    text-decoration: none;
}
.btn.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    box-shadow: var(--btn-primary-shadow);
}
.btn.btn-primary:hover {
    background: var(--btn-primary-bg-hover);
    transform: translateY(-1px);
    box-shadow: var(--btn-primary-shadow-hover);
}
.btn.btn-primary:focus-visible { outline: none; box-shadow: var(--btn-primary-shadow), var(--btn-primary-focus-ring); }
.btn.btn-primary:disabled { opacity: 0.6; cursor: wait; transform: none; }

.btn.btn-ghost {
    background: var(--main-surface);
    color: var(--main-text);
    border: 1.5px solid var(--main-border);
}
.btn.btn-ghost:hover { border-color: var(--brand-primary); color: var(--brand-primary); background: #fff; }

.btn.btn-danger {
    background: #dc2626;
    color: #fff;
}
.btn.btn-danger:hover { background: #b91c1c; transform: translateY(-1px); }

.btn.btn-sm { height: 32px; padding: 0 14px; font-size: 12px; border-radius: 10px; }

/* ── Role badge alto contraste en Mi Perfil ──────────────────────────── */
.profile-role-badge {
    display: inline-flex; align-items: center;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.profile-role-super_admin     { background: linear-gradient(135deg, #d97706 0%, #ec4899 100%); color: #ffffff; box-shadow: 0 2px 8px rgba(217, 119, 6, 0.45); }
.profile-role-admin           { background: #ec4899; color: #ffffff; box-shadow: 0 2px 6px rgba(236, 72, 153, 0.35); }
.profile-role-project_manager { background: #5b2aa8; color: #ffffff; box-shadow: 0 2px 6px rgba(91, 42, 168, 0.35); }
.profile-role-asistente       { background: #0ea5e9; color: #ffffff; box-shadow: 0 2px 6px rgba(14, 165, 233, 0.35); }

/* ── Variante para el role-badge del header (se superpone al existente) */
.role-badge.role-project_manager { background: rgba(91, 42, 168, 0.9); color: #ffffff; }

/* ── Banner "debe cambiar contraseña" ────────────────────────────────── */
.must-change-banner {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 18px;
    margin: 0 auto 18px;
    max-width: 760px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1.5px solid #f59e0b;
    border-radius: var(--radius-md);
    color: #78350f;
    font-size: 13.5px;
    line-height: 1.45;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}
.must-change-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
.must-change-banner strong { color: #78350f; font-weight: 700; }
.chart-card {
    background: #ffffff;
    border: 1px solid var(--main-border);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    box-shadow: var(--main-shadow);
}
.chart-card-head { margin-bottom: 16px; }
.chart-card-head h3 {
    margin: 0 0 2px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--main-text);
}
.chart-card-sub {
    font-size: 12px;
    color: var(--main-text-muted);
}
.chart-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: center;
}
.donut { flex-shrink: 0; display: block; }
.donut-total {
    font-family: 'Montserrat', sans-serif;
    font-size: 28px;
    font-weight: 800;
    fill: var(--main-text);
}
.chart-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chart-legend li {
    display: grid;
    grid-template-columns: 14px 1fr auto auto;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.legend-swatch {
    width: 12px; height: 12px;
    border-radius: 3px;
    display: inline-block;
}
.legend-label { color: var(--main-text-soft); }
.legend-value {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--main-text);
}
.legend-pct {
    font-size: 12px;
    color: var(--main-text-muted);
    min-width: 34px;
    text-align: right;
}
.chart-empty {
    padding: 32px 12px;
    text-align: center;
    color: var(--main-text-muted);
    font-size: 13px;
}

/* ── Horizontal bar chart (task summary side panel) ──────────────────── */
.bar-chart {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bar-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 3px;
}
.bar-label {
    font-size: 12px;
    color: var(--main-text-soft);
    font-weight: 600;
}
.bar-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--main-text);
}
.bar-pct {
    font-size: 11px;
    color: var(--main-text-muted);
    min-width: 32px;
    text-align: right;
}
.bar-track {
    height: 6px;
    background: var(--main-border);
    border-radius: 3px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease-out;
}

.summary-group { margin-bottom: 16px; }
.summary-group:last-of-type { margin-bottom: 14px; }
.summary-group-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--main-text-muted);
    margin-bottom: 10px;
}

.dashboard-card {
    background: #ffffff;
    border: 1px solid var(--main-border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 1px 3px rgba(23, 12, 48, 0.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dashboard-card > .summary-title {
    margin: 0 0 2px;
}
.dashboard-card .toolbar-compact { margin-bottom: 4px; }
.dashboard-card .checklist { gap: 6px; }
.dashboard-card .check-item {
    box-shadow: none;
    border-color: var(--main-border);
}
.dashboard-card > .summary-more { align-self: flex-start; margin-top: 2px; }

.preview-more-note {
    margin: 10px 2px 0;
    font-size: 12px;
    color: var(--main-text-muted);
    text-align: right;
}

/* ── Tasks page two-column layout ─────────────────────────────────────── */
.tasks-layout {
    display: grid;
    grid-template-columns: minmax(0, 640px) 260px;
    gap: 24px;
    align-items: flex-start;
}
@media (max-width: 960px) {
    .tasks-layout { grid-template-columns: 1fr; }
    .tasks-summary { order: -1; }
}

.tasks-summary {
    background: #ffffff;
    border: 1px solid var(--main-border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 1px 3px rgba(23, 12, 48, 0.04);
    position: sticky;
    top: 72px; /* alineado con la toolbar sticky del mismo scroll */
}
.summary-title {
    margin: 0 0 12px;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--main-text-muted);
}
.summary-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.mini-kpi {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--main-border);
    border-left-width: 4px;
    text-decoration: none;
    color: var(--main-text);
    transition: background 0.14s ease, transform 0.14s ease;
}
.mini-kpi:hover { background: var(--main-surface); transform: translateX(2px); }
.mini-kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--main-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.mini-kpi-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}
.mini-kpi-activa         { border-left-color: #10b981; }
.mini-kpi-activa .mini-kpi-value { color: #047857; }
.mini-kpi-por-vencer     { border-left-color: #f59e0b; }
.mini-kpi-por-vencer .mini-kpi-value { color: #b45309; }
.mini-kpi-vencida        { border-left-color: #ef4444; }
.mini-kpi-vencida .mini-kpi-value { color: #b91c1c; }
.mini-kpi-pendiente-pago { border-left-color: #7f1d1d; }
.mini-kpi-pendiente-pago .mini-kpi-value { color: #7f1d1d; }
.mini-kpi-retirada       { border-left-color: #1f2937; }
.mini-kpi-retirada .mini-kpi-value { color: #1f2937; }

.summary-more {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-accent);
    text-decoration: none;
}
.summary-more:hover { text-decoration: underline; }

/* ── Task checklist ───────────────────────────────────────────────────── */
.checklist-wrap { max-width: 640px; }
.toolbar-compact { margin-bottom: 12px; }

.checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.check-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: stretch;
    background: #ffffff;
    border: 1px solid var(--main-border);
    border-left: 4px solid var(--main-border);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 3px rgba(23, 12, 48, 0.04);
    overflow: hidden;
    transition: opacity 0.2s ease;
}
/* Legacy: borde según tipo (compat) */
.check-item.check-sacar            { border-left-color: #ef4444; }
.check-item.check-agregar          { border-left-color: #10b981; }
.check-item.check-tone-por-vencer     { border-left-color: #f59e0b; }
.check-item.check-tone-vencida        { border-left-color: #ef4444; }
.check-item.check-tone-pendiente-pago { border-left-color: #b91c1c; }
.check-item.check-tone-sacar          { border-left-color: #7f1d1d; }
.check-item.check-tone-agregar        { border-left-color: #10b981; }
.check-item.check-tone-migracion      { border-left-color: #0ea5e9; }

.check-item.check-done,
.check-item.check-dismissed { opacity: 0.55; }
.check-item.check-done .check-name,
.check-item.check-dismissed .check-name,
.check-item.check-done .check-action,
.check-item.check-dismissed .check-action {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}

/* Custom checkbox */
.check-tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 12px 12px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
}
.check-tick[disabled] { cursor: default; }
.tick-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--main-border);
    border-radius: 6px;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.14s ease, border-color 0.14s ease;
}
.check-tick:not([disabled]):hover .tick-box {
    border-color: var(--brand-accent);
    background: rgba(236, 72, 153, 0.06);
}
.check-item.check-done .tick-box,
.check-item.check-dismissed .tick-box {
    background: #10b981;
    border-color: #10b981;
}
.check-item.check-done .tick-box::after,
.check-item.check-dismissed .tick-box::after {
    content: '✓';
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.check-link {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 2px 10px;
    padding: 12px 16px 12px 4px;
    color: var(--main-text);
    text-decoration: none;
    transition: background 0.14s ease;
}
.check-link:hover { background: var(--main-surface); }

.check-action {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--main-text-muted);
    white-space: nowrap;
}
.check-item.check-sacar   .check-action { color: #b91c1c; }
.check-item.check-agregar .check-action { color: #047857; }
.check-item.check-tone-por-vencer     .check-action { color: #b45309; }
.check-item.check-tone-vencida        .check-action { color: #b91c1c; }
.check-item.check-tone-pendiente-pago .check-action { color: #7f1d1d; }
.check-item.check-tone-sacar          .check-action { color: #7f1d1d; }
.check-item.check-tone-agregar        .check-action { color: #047857; }
.check-item.check-tone-migracion      .check-action { color: #0369a1; }

.check-name {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    font-weight: 600;
    font-size: 14px;
}
.check-date {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    font-size: 11px;
    color: var(--main-text-muted);
    white-space: nowrap;
    align-self: center;
}
.check-link .task-status {
    grid-column: 3 / 4;
    grid-row: 1 / 3;
    align-self: center;
}
.check-chevron {
    grid-column: 4 / 5;
    grid-row: 1 / 3;
    font-size: 18px;
    color: var(--main-text-muted);
    align-self: center;
    line-height: 1;
}

/* ── Activity feed ────────────────────────────────────────────────────── */
.event-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.event-login          { background: rgba(16,185,129,0.14); color: #047857; }
.event-logout         { background: rgba(107,114,128,0.14); color: #4b5563; }
.event-task-created   { background: rgba(245,158,11,0.14); color: #b45309; }
.event-task-done      { background: rgba(16,185,129,0.16); color: #047857; }
.event-task-dismissed { background: rgba(107,114,128,0.18); color: #4b5563; }
.event-task-reopened  { background: rgba(139,92,246,0.16); color: #6d28d9; }
.event-member         { background: rgba(99,102,241,0.14); color: #4338ca; }
.event-payment        { background: rgba(236,72,153,0.14); color: #9d174d; }
.event-whatsapp       { background: rgba(37,211,102,0.18); color: #075e54; }
.event-neutral        { background: rgba(107,114,128,0.12); color: #4b5563; }

.filter-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--main-text-soft);
}
.filter-inline span { font-weight: 600; }
.filter-inline input[type="date"] {
    padding: 6px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--main-border);
    background: #ffffff;
    color: var(--main-text);
    font-size: 13px;
}

/* ── Task detail page ─────────────────────────────────────────────────── */
.task-detail-wrap { max-width: 1080px; }
/* v1.4.5: cuando hay panel "Notas del contacto" activo, quitamos el
 * max-width para que el contenido use todo el ancho disponible — mismo
 * comportamiento que .member-detail-with-chat. Sin este override la
 * columna izquierda quedaba ~600px (angosta) en pantallas anchas. */
.task-detail-wrap.task-detail-with-chat { max-width: none; }

.task-pager {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: #ffffff;
    border: 1px solid var(--main-border);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 3px rgba(23, 12, 48, 0.04);
}
.task-pager-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--main-text);
    transition: background 0.14s ease;
    min-width: 0;
}
.task-pager-btn span {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--brand-accent);
}
.task-pager-btn small {
    font-size: 11px;
    color: var(--main-text-muted);
    font-weight: 500;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.task-pager-btn:not(.is-disabled):hover { background: var(--main-surface); }
.task-pager-btn.is-disabled {
    cursor: default;
    opacity: 0.45;
}
.task-pager-btn.is-disabled span { color: var(--main-text-muted); }
.task-pager-right {
    align-items: flex-end;
    text-align: right;
}
.task-pager-count {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--main-text-muted);
    white-space: nowrap;
}
.detail-toolbar .task-status {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.task-detail-card {
    padding: 28px 32px;
    border-left: 5px solid var(--main-border);
}
.task-detail-card.task-sacar-detail   { border-left-color: #ef4444; }
.task-detail-card.task-agregar-detail { border-left-color: #10b981; }
.task-detail-card.task-detail-por-vencer     { border-left-color: #f59e0b; }
.task-detail-card.task-detail-vencida        { border-left-color: #ef4444; }
.task-detail-card.task-detail-pendiente-pago { border-left-color: #b91c1c; }
.task-detail-card.task-detail-sacar          { border-left-color: #7f1d1d; }
.task-detail-card.task-detail-agregar        { border-left-color: #10b981; }

.task-detail-card.task-detail-por-vencer     .task-detail-kicker { color: #b45309; }
.task-detail-card.task-detail-vencida        .task-detail-kicker { color: #b91c1c; }
.task-detail-card.task-detail-pendiente-pago .task-detail-kicker { color: #7f1d1d; }
.task-detail-card.task-detail-sacar          .task-detail-kicker { color: #7f1d1d; }
.task-detail-card.task-detail-agregar        .task-detail-kicker { color: #047857; }

.btn-wa-large {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 10px;
    background: #25d366;
    color: #ffffff !important;
    text-decoration: none;
    letter-spacing: 0.02em;
}
.btn-wa-large:hover { background: #1ebe5a; }

.task-detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--main-border);
}
.task-detail-icon { font-size: 28px; line-height: 1; }
.task-detail-kicker {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--main-text-muted);
    margin-bottom: 2px;
}
.task-detail-card.task-sacar-detail   .task-detail-kicker { color: #b91c1c; }
.task-detail-card.task-agregar-detail .task-detail-kicker { color: #047857; }
.task-detail-header h2 {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--main-text);
}

.task-detail-section { margin-bottom: 24px; }
.task-detail-section:last-of-type { margin-bottom: 0; }
.task-detail-section h3 {
    margin: 0 0 12px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--main-text-muted);
}

.task-steps {
    margin: 0;
    padding-left: 22px;
    color: var(--main-text);
}
.task-steps li {
    margin-bottom: 8px;
    line-height: 1.55;
    font-size: 14px;
}
.task-steps li::marker {
    font-weight: 700;
    color: var(--brand-accent);
}

.task-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 24px;
    margin: 0;
}
@media (max-width: 960px) {
    .task-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .task-detail-grid { grid-template-columns: 1fr; }
}
.task-detail-grid dt {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--main-text-muted);
    margin-bottom: 3px;
}
.task-detail-grid dd {
    margin: 0;
    font-size: 14px;
    color: var(--main-text);
}
.task-detail-grid dd a { color: var(--brand-accent); text-decoration: none; }
.task-detail-grid dd a:hover { text-decoration: underline; }
.task-detail-grid .task-full { grid-column: 1 / -1; }

.task-notes {
    margin: 0;
    padding: 12px 14px;
    background: var(--main-surface);
    border-radius: var(--radius-md);
    color: var(--main-text);
    font-size: 13px;
    line-height: 1.55;
}

.task-detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--main-border);
}

/* ── Legacy task cards (kept for any leftover usage) ──────────────────── */
.task-list { display: flex; flex-direction: column; gap: 12px; }

.task-card {
    background: #ffffff;
    border: 1px solid var(--main-border);
    border-left: 5px solid var(--main-border);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    box-shadow: var(--main-shadow);
}
.task-card.task-sacar   { border-left-color: #ef4444; }
.task-card.task-agregar { border-left-color: #10b981; }

.task-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.task-icon { font-size: 18px; }
.task-title {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--main-text);
    letter-spacing: 0.02em;
    flex: 1;
}
.task-status {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.task-status-pending   { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.task-status-done      { background: rgba(16, 185, 129, 0.16); color: #047857; }
.task-status-dismissed { background: rgba(107, 114, 128, 0.16); color: #4b5563; }

.task-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 20px;
    margin: 0;
}
.task-body dt {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--main-text-muted);
    margin-bottom: 2px;
}
.task-body dd { margin: 0; font-size: 14px; color: var(--main-text); }
.task-full { grid-column: 1 / -1; }

.task-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--main-border);
}

.task-card.is-done { opacity: 0.6; }
.task-card.row-flash {
    background: rgba(16, 185, 129, 0.08);
    transition: background 1.2s ease-out;
}

/* ── Banner de instalación PWA ─────────────────────────────────────── */
.pwa-install-banner {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 60;
    background: linear-gradient(135deg, #2d1b4e, #1f1b2e);
    color: #f5f3ff;
    border: 1px solid rgba(124, 58, 237, 0.45);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    max-width: 480px;
    margin: 0 auto;
}
.pwa-install-banner-content {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 12px;
    align-items: center;
}
.pwa-install-banner-icon {
    width: 40px; height: 40px; border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.pwa-install-banner-text strong {
    display: block; font-size: 14px; margin-bottom: 2px;
}
.pwa-install-banner-text p {
    margin: 0; font-size: 12px; color: rgba(245, 243, 255, 0.75); line-height: 1.4;
}
.pwa-install-banner-close {
    background: transparent;
    border: none;
    color: rgba(245, 243, 255, 0.7);
    font-size: 22px;
    width: 28px; height: 28px;
    cursor: pointer;
    border-radius: 50%;
    line-height: 1;
    padding: 0;
}
.pwa-install-banner-close:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.pwa-install-banner-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.pwa-install-banner-actions .btn-primary {
    flex: 1;
    margin-top: 0;
    padding: 10px 14px;
    font-size: 14px;
}
.pwa-install-banner-ios-hint {
    color: rgba(245, 243, 255, 0.8);
    font-size: 12px;
    line-height: 1.5;
    background: rgba(124, 58, 237, 0.12);
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(124, 58, 237, 0.25);
}

/* ── Barra de progreso de subida de arte ──────────────────────────── */
.upload-progress {
    margin-top: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(99, 102, 241, 0.06));
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.upload-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}
.upload-progress-label {
    font-size: 14px;
    font-weight: 600;
    color: #1f1b2e;
}
.upload-progress-pct {
    font-size: 16px;
    font-weight: 700;
    color: #7c3aed;
    font-variant-numeric: tabular-nums;
}
.upload-progress-track {
    width: 100%;
    height: 12px;
    background: rgba(124, 58, 237, 0.12);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #7c3aed, #ec4899);
    border-radius: 999px;
    transition: width 0.2s ease-out;
    position: relative;
    overflow: hidden;
}
/* Shimmer sutil para reforzar la sensación de "está cargando" */
.upload-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.25) 50%,
        transparent 100%
    );
    animation: upload-shimmer 1.4s linear infinite;
}
@keyframes upload-shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}
.upload-progress-meta {
    font-size: 12px;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

/* ── Nudge de push notifications (top de pantalla, desktop + móvil) ──
 * IMPORTANTE: cuando el elemento tiene atributo `hidden`, debe quedar
 * oculto. Por default `display: flex` GANA sobre el atributo `hidden` del
 * HTML, así que tenemos que forzar `display: none` explícito cuando hidden.
 * Sin esto, el banner se ve aunque JS marque `nudge.hidden = true`.
 */
.push-nudge[hidden] { display: none !important; }
.push-nudge {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    margin-bottom: 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(236, 72, 153, 0.1));
    border: 1px solid rgba(124, 58, 237, 0.35);
    flex-wrap: wrap;
}
.push-nudge-icon {
    font-size: 24px;
    flex-shrink: 0;
}
.push-nudge-text {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.push-nudge-text strong { font-size: 14px; color: #1f1b2e; }
.push-nudge-text span   { font-size: 12px; color: #4b5563; line-height: 1.4; }
.push-nudge-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
.push-nudge-actions .btn-primary {
    margin-top: 0;
    padding: 8px 16px;
    font-size: 13px;
}
.push-nudge-dismiss {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
}
.push-nudge-dismiss:hover { background: rgba(0, 0, 0, 0.05); color: #1f1b2e; }
@media (max-width: 560px) {
    .push-nudge { padding: 10px 12px; gap: 10px; }
    .push-nudge-actions { width: 100%; justify-content: flex-end; }
    .push-nudge-actions .btn-primary { padding: 8px 12px; font-size: 12px; }
}

/* ── Botón hamburguesa + drawer móvil ── */
.mobile-menu-toggle { display: none; }
.mobile-menu-backdrop { display: none; }
.mobile-quick-actions { display: none; }

@media (max-width: 720px) {
    /* Layout: una sola columna; el sidebar es drawer fixed */
    .app-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Botón hamburguesa: visible solo en móvil */
    .mobile-menu-toggle {
        display: flex;
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 50;
        width: 42px;
        height: 42px;
        align-items: center;
        justify-content: center;
        background: rgba(31, 27, 46, 0.92);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 12px;
        color: #fff;
        cursor: pointer;
        backdrop-filter: blur(8px);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
        transition: background 0.15s ease, transform 0.1s ease;
    }
    .mobile-menu-toggle:active { transform: scale(0.95); }
    .mobile-menu-toggle-bars {
        display: flex;
        flex-direction: column;
        gap: 4px;
        width: 22px;
    }
    .mobile-menu-toggle-bars span {
        display: block;
        height: 2px;
        background: #fff;
        border-radius: 2px;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }
    /* Hamburguesa transformándose en X cuando el menú está abierto */
    body.is-menu-open .mobile-menu-toggle-bars span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }
    body.is-menu-open .mobile-menu-toggle-bars span:nth-child(2) {
        opacity: 0;
    }
    body.is-menu-open .mobile-menu-toggle-bars span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    /* Backdrop con dim cuando el menú está abierto */
    .mobile-menu-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 40;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    body.is-menu-open .mobile-menu-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* Sidebar como drawer off-canvas */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 45;
        width: 280px;
        max-width: 85vw;
        height: 100dvh;
        padding: 70px 16px 20px; /* deja espacio para el botón hamburguesa */
        overflow-y: auto;
        background: rgba(16, 9, 38, 0.97);
        border-right: 1px solid var(--card-border);
        border-bottom: none;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        backdrop-filter: blur(10px);
    }
    body.is-menu-open .app-sidebar {
        transform: translateX(0);
    }
    .brand {
        padding: 0 0 16px;
        margin: 0;
        justify-content: center;
    }
    .brand-logo { max-width: 130px; width: 100%; max-height: 90px; margin: 0 auto; }

    /* Login cards se hacen más chicos en mobile pero respetan la proporción */
    .login-logo { max-width: 280px; max-height: 96px; margin-bottom: 10px; }

    /* En mobile el chip del sidebar SÍ se muestra dentro del drawer (sustituyendo el del header chico) */
    .sidebar-user { display: block; margin-top: auto; }

    .app-nav {
        flex-direction: column;
        gap: 2px;
        overflow-x: visible;
    }
    .nav-link {
        padding: 12px 14px;
        font-size: 14px;
        white-space: normal;
        flex: 0 0 auto;
    }
    .nav-badge { min-width: 20px; height: 20px; font-size: 11px; padding: 0 6px; }

    .app-main {
        padding: 14px 12px 32px;
        min-height: auto;
        overflow-x: hidden;
    }
    .app-header {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 14px;
    }
    /* El offset para el botón hamburguesa solo aplica a la primera fila (título + reloj),
       no al user-chip ni a los quick actions, que deben ir ancho completo. */
    .app-header-title-group { padding-left: 54px; }
    .app-header h1 { font-size: 19px; line-height: 1.25; }

    /* Base font: 14px para texto general, pero 16px en inputs para evitar el
       auto-zoom de iOS Safari cuando el usuario toca un campo (Safari hace
       zoom si el input tiene font-size < 16px y la página queda descuadrada). */
    body { font-size: 14px; }
    button { font-size: 14px; }
    input, select, textarea {
        /* iOS: prevenir el zoom adicional al focus — Safari fuerza zoom si < 16px.
           !important porque varios inputs traen font-size:14px inline. */
        font-size: 16px !important;
        max-width: 100%;
    }

    /* Order-new: grid de 2 columnas se colapsa en móvil para que correo y
       whatsapp queden cada uno en su propia línea, sin desbordar. */
    .order-new-grid-2 {
        grid-template-columns: 1fr !important;
    }

    /* User chip ancho completo en móvil — para que SALIR no se vea descuadrado */
    .user-chip {
        width: 100%;
        box-sizing: border-box;
        padding: 8px 12px;
        font-size: 12px;
        gap: 8px;
        justify-content: flex-start;
        flex-wrap: nowrap;
        min-width: 0;
        overflow: hidden;
    }
    .user-chip-identity { padding: 4px 6px; min-width: 0; flex-shrink: 1; }
    /* Ocultar nombre del usuario en mobile — el avatar y el rol son suficientes */
    .user-chip-name { display: none; }
    .role-badge {
        font-size: 10px;
        padding: 3px 8px;
        max-width: 160px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex-shrink: 1;
    }
    .user-chip-logout {
        margin-left: auto;
        flex-shrink: 0;
        color: #ffffff !important;
        background: transparent;
        border: none;
        font-weight: 600;
        padding: 6px 14px !important;
        border-radius: 8px;
        align-self: center;
        line-height: 1;
    }
    .user-chip-logout:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff !important;
    }

    /* Quick actions: solo móvil. Botones grandes Nueva orden / Cola de impresión */
    .mobile-quick-actions {
        display: flex;
        gap: 10px;
        width: 100%;
        margin-top: 8px;
        margin-bottom: 4px;
    }
    .mobile-quick-action {
        flex: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 10px;
        background: #1f1b2e;
        border: 1px solid rgba(124, 58, 237, 0.45);
        color: #f5f3ff;
        border-radius: 10px;
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
        transition: background 0.12s ease, transform 0.05s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    .mobile-quick-action:hover { background: #2d1b4e; border-color: rgba(124, 58, 237, 0.7); }
    .mobile-quick-action:active { transform: scale(0.98); }
    .mobile-quick-action-primary {
        background: var(--btn-primary-bg);
        border-color: transparent;
        box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
        color: #fff;
    }
    .mobile-quick-action-primary:hover {
        background: var(--btn-primary-bg-hover);
    }
    .mobile-quick-action-icon {
        display: inline-flex;
        align-items: center; justify-content: center;
        width: 22px; height: 22px;
        background: rgba(255, 255, 255, 0.16);
        border-radius: 6px;
        font-size: 14px;
        font-weight: 700;
    }
    .mobile-quick-action-primary .mobile-quick-action-icon {
        background: rgba(255, 255, 255, 0.22);
    }

    /* Data tables: en mobile transformamos a cards con label:valor (stack vertical).
       El <thead> queda oculto; cada <td> tiene su data-label inyectado por JS. */
    .card-flush { overflow-x: visible; }
    .data-table {
        font-size: 14px;
        min-width: 0;
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
    }
    .data-table thead { display: none; }
    .data-table tbody { display: block; }
    .data-table tbody tr {
        display: block;
        margin: 0 0 12px;
        padding: 4px 0;
        background: var(--main-bg);
        border: 1px solid var(--main-border);
        border-radius: var(--radius-md);
        box-shadow: var(--main-shadow);
    }
    .data-table tbody tr:last-child { margin-bottom: 0; }
    .data-table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 10px 14px;
        border-bottom: 1px dashed var(--main-border);
        text-align: right;
        min-height: 42px;
    }
    .data-table tbody td:last-child { border-bottom: none; }
    .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--main-text-soft);
        flex: 0 0 auto;
        white-space: nowrap;
        text-align: left;
    }
    /* Sin label (ej. celdas de acciones) */
    .data-table tbody td:not([data-label])::before,
    .data-table tbody td[data-label=""]::before { content: none; }
    /* La celda de acciones en mobile: label arriba, botones en fila completa abajo */
    .data-table tbody td.row-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .data-table tbody td.row-actions::before { text-align: left; }
    .data-table tbody td.row-actions > * {
        flex: 1;
        text-align: center;
        min-height: 40px;
        padding: 8px 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    /* El nombre (primera col) se muestra sin label y más grande */
    .data-table tbody td:first-child {
        justify-content: flex-start;
        text-align: left;
        background: var(--main-surface);
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        font-size: 15px;
        min-height: 48px;
    }
    .data-table tbody td:first-child::before { display: none; }
    .data-table tbody td:first-child .row-sub { font-size: 12px; color: var(--main-text-muted); margin-top: 2px; }
    .data-table tbody td:first-child strong { font-size: 15px; }
    /* Status chip, badges, etc dentro de cells — asegurar que no se achiquen */
    .data-table tbody td .status-chip,
    .data-table tbody td .group-tag,
    .data-table tbody td .role-badge,
    .data-table tbody td .event-chip { flex-shrink: 0; }

    /* Forms: todos los .form-grid apilan a 1 columna en mobile (profile, team modal, futuros) */
    .form-grid { grid-template-columns: 1fr; gap: 12px; }
    .form-actions { margin-top: 14px; padding-top: 12px; }
    .form-actions .btn { flex: 1; justify-content: center; }

    /* Footer: padding vertical menor + vuelve a edge-to-edge (en mobile no hay sidebar fija lateral) */
    .app-footer { left: 0; padding: 8px 14px; font-size: 11px; }

    /* Ajustes para team.php en tablets y mobile.
       IMPORTANTE: "Último ingreso" + botón quedan en la MISMA línea (el texto se trunca con ellipsis si falta espacio). */
    .team-header { gap: 10px; margin-bottom: 0; }
    .team-card { padding: 14px; }
    .team-card-footer { flex-wrap: nowrap; gap: 8px; }
    .team-last-login { font-size: 10.5px; }

    /* KPIs: 2 por fila cómodos */
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi-value { font-size: 26px; }
    .kpi-label { font-size: 11px; }

    /* Tap targets mínimo 44px para botones e inputs (guideline mobile) */
    .btn, .btn-primary, .btn-ghost, .btn-danger, .btn-link,
    .form-field input, .form-field select, .form-field textarea,
    .input-wrap input, .input-wrap select {
        min-height: 44px;
    }
    .btn.btn-sm { min-height: 40px; }

    /* Tipografía de tareas/checklist en mobile */
    .check-item { padding: 10px 8px; }
    .check-name { font-size: 14px; font-weight: 600; }
    .check-action, .check-date { font-size: 12px; }

    /* Summary lateral del dashboard: stack con KPIs mini en fila */
    .tasks-layout { grid-template-columns: 1fr !important; gap: 14px !important; }
    .tasks-summary { order: -1; }
    .summary-list { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .mini-kpi { padding: 10px 12px; }

    /* Cards genéricas más compactas */
    .dashboard-card, .chart-card, .bit-card { padding: 14px; border-radius: 14px; }
    .chart-card-head h3 { font-size: 14px; }
    .chart-card-sub { font-size: 11px; }

    /* Status chips más touch-friendly */
    .status-chip { font-size: 11px; padding: 4px 10px; }

    /* Detalle del miembro: grid de 2 → 1 */
    .member-detail-grid { grid-template-columns: 1fr !important; gap: 14px !important; }
    .member-info-list dt, .member-info-list dd { font-size: 13.5px; }

    /* Perfil: inputs más grandes (heredan min-height 44 global arriba) */
    .profile-card-body { padding: 16px; }
    .avatar-actions .btn { flex: 1; }

    /* Team: avatar un poco más chico para ganar espacio */
    .team-avatar { width: 42px; height: 42px; font-size: 13px; }

    /* Filters/Toolbar: más aire */
    .filter-tabs { gap: 6px; flex-wrap: wrap; }
    .filter-tabs .tab { padding: 8px 12px; font-size: 12.5px; min-height: 38px; display: flex; align-items: center; }

    /* Activity table: en mobile el user stats mini */
    .activity-stats-mini { padding: 12px; font-size: 12.5px; }

    /* Alert/empty states más cómodos */
    .empty-state { padding: 20px 14px; font-size: 14px; }
    .empty-state p { font-size: 14px; }

    /* Role badge alto contraste en profile en mobile */
    .profile-role-badge { font-size: 11px; padding: 5px 12px; }

    /* Toolbars/filtros: wrap completo */
    .toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
    .filter-form { width: 100%; }
    .filter-form input[type="search"],
    .filter-form select { flex: 1 1 140px; min-width: 0; }
    .filter-form input[type="search"] { min-width: 0; flex-basis: 100%; }

    /* Pager en detalle de tarea */
    .task-pager {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
    .task-pager-count {
        grid-column: 1 / -1;
        grid-row: 1 / 2;
        text-align: center;
    }
    .task-pager-btn { grid-row: 2 / 3; }
    .task-pager-btn small { max-width: 100%; }

    /* Charts */
    .chart-body {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: left;
    }
    .chart-legend { width: 100%; }

    /* Detail cards padding ajustado */
    .detail-card, .task-detail-card { padding: 20px 18px; }
    .detail-toolbar { flex-wrap: wrap; gap: 8px; }

    /* Form actions stack */
    .form-actions { flex-direction: column-reverse; align-items: stretch; }
    .form-actions .btn-primary { width: 100%; }
    .form-actions .btn-link { text-align: center; }

    /* Modal full-width */
    .modal-card { padding: 22px 18px 18px; }

    /* Mini KPIs del dashboard/tasks summary */
    .tasks-summary { padding: 14px; }
    .summary-list { gap: 5px; }
    .mini-kpi { padding: 9px 11px; }
    .mini-kpi-value { font-size: 18px; }
}

/* ── Dashboard health card ────────────────────────────────────────────── */
.health-card {
    margin-top: 24px;
    padding: 20px 24px;
    border-radius: 16px;
    border-left: 4px solid transparent;
    background: #ffffff;
}
.health-card.health-ok {
    background: linear-gradient(145deg, #ffffff 0%, #f0fdf4 100%);
    border-left-color: #10b981;
}
.health-card.health-warn {
    background: linear-gradient(145deg, #ffffff 0%, #fef3c7 100%);
    border-left-color: #f59e0b;
}
.health-head h3 {
    margin: 0 0 12px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.health-icon { font-size: 18px; }
.health-issues {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.health-issue {
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.health-issue.health-critical { border-left: 3px solid #dc2626; }
.health-issue.health-warning  { border-left: 3px solid #f59e0b; }
.health-hint {
    margin-top: 4px;
    padding: 4px 8px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
    font-family: "SF Mono", Menlo, monospace;
    border-radius: 6px;
    align-self: flex-start;
}

/* ── KPI grid 3 columnas (para 6 KPIs en tab clientes) ────────────────── */
.kpi-grid.kpi-grid-3col {
    grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 960px) {
    .kpi-grid.kpi-grid-3col { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .kpi-grid.kpi-grid-3col { grid-template-columns: 1fr; }
}

/* ── Tasks: toolbar con tabs + búsqueda en la misma línea ─────────────── */
.tasks-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    /* Sticky mientras se scrollea la lista de tareas, alineado al sidebar. */
    position: sticky;
    top: 72px; /* deja espacio para el app-header sticky arriba */
    z-index: 20;
    padding: 10px 0;
    background: linear-gradient(180deg, var(--main-bg) 0%, var(--main-bg) 80%, rgba(247, 243, 255, 0) 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    margin-top: -10px;
}
.tasks-toolbar .filter-tabs { flex: 0 1 auto; }

.tasks-search {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 1 auto;
}
.tasks-search input[type="search"] {
    padding: 8px 14px;
    border: 1px solid var(--main-border);
    border-radius: var(--radius-md);
    background: #ffffff;
    color: var(--main-text);
    font-size: 13px;
    font-family: inherit;
    min-width: 240px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tasks-search input[type="search"]:focus {
    outline: none;
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12);
}
.tasks-search-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--main-border);
    border-radius: var(--radius-md);
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tasks-search-btn:hover {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    background: rgba(236, 72, 153, 0.06);
}
.tasks-sort-toggle {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.tasks-sort-toggle:hover {
    color: var(--brand-primary);
    background: rgba(236, 72, 153, 0.06);
    border-color: var(--main-border);
}

/* Chips del resumen de filtros — con aire alrededor */
.checklist-wrap .filter-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 10px 0 4px;
    margin-bottom: 8px;
}
.checklist-wrap .filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(124, 58, 237, 0.10);
    color: #6d28d9;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
}
.checklist-wrap .filter-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.15);
    color: #6d28d9;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    transition: background 0.15s ease;
}
.checklist-wrap .filter-chip-x:hover {
    background: rgba(124, 58, 237, 0.30);
    color: #ffffff;
}

/* Mobile: toolbar apila verticalmente con el buscador ocupando el ancho */
@media (max-width: 720px) {
    .tasks-toolbar { gap: 12px; }
    .tasks-search { width: 100%; }
    .tasks-search input[type="search"] { flex: 1; min-width: 0; }
}

/* ── Tasks: 4 botones de acción unificados (task-detail) ──────────────── */
/* v1.4.4: los 4 botones (Registrar pago, Retirar, Descartar, Marcar
 * hecha) deben caber en UNA sola línea. Antes flex-wrap: wrap + basis
 * 210px hacía que no cupieran en la columna izq (56% del viewport) y
 * se apilaban. Cambio a flex 1 1 0 para repartir equitativamente +
 * padding/font compactos que dan espacio al texto más largo ("Retirar
 * de la academia"). En pantallas < 720px vuelven a wrap a 2x2. */
.task-detail-actions.task-actions-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: stretch;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}
@media (max-width: 720px) {
    .task-detail-actions.task-actions-grid { flex-wrap: wrap; }
}
.task-action-btn {
    flex: 1 1 0;
    min-width: 0;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.1;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: linear-gradient(180deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0.04) 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
@media (max-width: 720px) {
    .task-action-btn { flex-basis: calc(50% - 4px); }
}
.task-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
    filter: brightness(1.05);
}
.task-action-btn.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Registrar pago — verde oscuro con letras blancas */
.task-action-pay {
    background: linear-gradient(180deg, #059669 0%, #047857 100%);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}
.task-action-pay:hover {
    background: linear-gradient(180deg, #047857 0%, #065f46 100%);
}

/* Retirar — rojo con letras blancas.
 * flex-grow 1.4 — su texto es el más largo ("Retirar de la academia"),
 * así que toma ~40% más ancho que los otros 3 para no truncarse. */
.task-action-retire {
    flex-grow: 1.4;
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}
.task-action-retire:hover {
    background: linear-gradient(180deg, #b91c1c 0%, #991b1b 100%);
}

/* Descartar — glass neutro */
.task-action-dismiss {
    background: linear-gradient(180deg, rgba(255,255,255,0.90) 0%, rgba(248,250,252,0.85) 100%);
    color: #475569;
    border-color: rgba(15, 23, 42, 0.08);
}
.task-action-dismiss:hover { color: #1e293b; }

/* Marcar como hecha — brand rosa/morado */
.task-action-done {
    background: linear-gradient(135deg, var(--brand-accent), var(--brand-primary));
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.25);
}
.task-action-done:hover {
    box-shadow: 0 6px 18px rgba(236, 72, 153, 0.35);
}

/* ── Tasks: card de productividad personal "Completadas hoy" ──────────── */
.completed-today {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    margin: 14px 0 12px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(5, 150, 105, 0.14));
    border: 1px solid rgba(16, 185, 129, 0.20);
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.completed-today:hover {
    transform: translateY(-1px);
    border-color: rgba(16, 185, 129, 0.40);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.18);
}
.completed-today-label {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #047857;
}
.completed-today-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 30px;
    font-weight: 800;
    color: #047857;
    line-height: 1.1;
    margin: 2px 0;
}
.completed-today-sub {
    font-size: 11px;
    color: #059669;
    opacity: 0.8;
}

/* ── Tasks: bars clickeables del sidebar ──────────────────────────────── */
.bar-chart.bar-chart-clickable li { padding: 0; }
.bar-chart.bar-chart-clickable .bar-link {
    display: block;
    padding: 6px 8px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}
.bar-chart.bar-chart-clickable .bar-link:hover {
    background: rgba(236, 72, 153, 0.06);
}
.bar-chart.bar-chart-clickable .bar-link.is-active {
    background: rgba(236, 72, 153, 0.12);
    box-shadow: inset 2px 0 0 var(--brand-primary);
}

/* ── Sortable column headers (reports clientes) ───────────────────────── */
.th-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease;
}
.th-sort-link:hover { color: var(--brand-primary); }

/* ── Payment void (anular pago) ───────────────────────────────────────── */
.voided-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    background: #991b1b;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-left: 6px;
    vertical-align: middle;
}
.history-event.is-voided .history-title { text-decoration: line-through; opacity: 0.65; }
.history-event.is-voided .history-icon  { opacity: 0.4; filter: grayscale(1); }
.history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

/* ══════════════════════════════════════════════════════════════════════
   Reports module — tabs, method chips, premium tables, USD/VES donut
   ══════════════════════════════════════════════════════════════════════ */

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.reports-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid rgba(15, 23, 42, 0.08);
    margin-bottom: 24px;
}
.reports-tab {
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}
.reports-tab:hover {
    color: var(--brand-primary);
    background: rgba(236, 72, 153, 0.04);
}
.reports-tab.is-active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

/* ── Hotmart placeholder ──────────────────────────────────────────────── */
.hotmart-placeholder {
    padding: 48px 32px;
    text-align: center;
    background: linear-gradient(145deg, #fff 0%, #fef3f8 100%);
    border: 1px solid rgba(236, 72, 153, 0.15);
    border-radius: 16px;
}
.hotmart-placeholder h2 {
    margin: 0 0 12px;
    font-size: 22px;
    color: var(--brand-primary);
}
.hotmart-placeholder p {
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Method chips (colores por método de pago) ─────────────────────────── */
.method-chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.1px;
    color: #ffffff;
    background: #64748b;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.method-chip.method-yappy          { background: #1d4ed8; }  /* azul eléctrico */
.method-chip.method-pago-en-tienda { background: #065f46; }  /* verde oscuro */
.method-chip.method-pago-movil     { background: #dc2626; }  /* rojo */
.method-chip.method-transferencia  { background: #78350f; }  /* marrón */
.method-chip.method-hotmart        { background: #be185d; }  /* magenta */

/* ── Chips de método Hotmart — paleta consistente con el donut de
   "Distribución por método" en /reports.php?tab=hotmart. Si cambias un
   color aquí, actualizá también $hotmartMethodColors en reports.php. ── */
.method-chip.method-tarjeta-de-credito { background: #1d4ed8; }  /* azul */
.method-chip.method-paypal             { background: #0070ba; }  /* azul PayPal */
.method-chip.method-boleto             { background: #78350f; }  /* marrón Brasil */
.method-chip.method-pix                { background: #00a868; }  /* verde PIX */
.method-chip.method-google-pay         { background: #4285f4; }  /* azul Google */
.method-chip.method-apple-pay          { background: #111111; }  /* negro Apple */
.method-chip.method-samsung-pay        { background: #1428a0; }  /* azul Samsung */
.method-chip.method-efectivo           { background: #16a34a; }  /* verde billete */
.method-chip.method-nequi              { background: #dc2626; }  /* rojo Nequi */
.method-chip.method-daviplata          { background: #e11d48; }  /* rose Daviplata */
.method-chip.method-mercado-pago       { background: #009ee3; }  /* celeste MP */
.method-chip.method-pago-mixto         { background: #7c3aed; }  /* violeta */
.method-chip.method-compra-in-app      { background: #334155; }  /* gris oscuro */

/* ── 3-column charts grid (USD, VES, Proporción) ──────────────────────── */
.charts-grid.charts-grid-3 {
    grid-template-columns: repeat(3, 1fr);
    max-width: none;
    margin-bottom: 40px; /* aire entre donuts y el siguiente header */
    align-items: stretch;  /* cards al mismo alto */
}
.charts-grid.charts-grid-3 > .chart-card {
    display: flex;
    flex-direction: column;
}
/* Alineación superior del contenido de cada chart-card: donas y mapa
   arrancan en el mismo top, sin espacio muerto arriba. */
.charts-grid.charts-grid-3 > .chart-card > .chart-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

/* Chart-card del mapa mundial Leaflet — padding reducido para aprovechar el tile */
.chart-card-world-map .chart-body-map {
    padding: 0;
    align-items: stretch !important;  /* override: el mapa se estira al 100% */
}
.chart-card-world-map #hotmart-world-map {
    flex: 1;
    min-height: 280px;
}
.chart-card-world-map .leaflet-container {
    border-radius: 12px;
    font-family: inherit;
}
.chart-card-world-map .leaflet-popup-content-wrapper {
    border-radius: 8px;
    font-size: 13px;
}
.chart-card-world-map .leaflet-popup-content {
    margin: 8px 12px;
    line-height: 1.4;
}

/* Aire entre cada sección de reportes: cuando un header de sección sigue a
   una tabla en card-flush, le damos 36px de separación para que respire. */
.card.card-flush + .section-header {
    margin-top: 36px;
}
@media (max-width: 1024px) {
    .charts-grid.charts-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
    .charts-grid.charts-grid-3 { grid-template-columns: 1fr; }
}

/* ── Premium table styling (only with .data-table-premium modifier) ───── */
.data-table-premium {
    border-collapse: separate;
    border-spacing: 0;
}
.data-table-premium thead th {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11.5px;
    font-weight: 700;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding: 14px 16px;
}
.data-table-premium thead th:first-child { border-top-left-radius: 12px; }
.data-table-premium thead th:last-child  { border-top-right-radius: 12px; }
.data-table-premium tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    font-size: 14px;
    color: #1e293b;
    vertical-align: middle;
    transition: background 0.15s ease;
}
.data-table-premium tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.5);
}
.data-table-premium tbody tr:hover td {
    background: rgba(236, 72, 153, 0.06);
}
.data-table-premium tbody tr:last-child td { border-bottom: none; }
.data-table-premium tbody tr:last-child td:first-child { border-bottom-left-radius: 12px; }
.data-table-premium tbody tr:last-child td:last-child  { border-bottom-right-radius: 12px; }
.data-table-premium .row-name-link {
    color: var(--main-text);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
}
.data-table-premium .row-name-link:hover {
    color: var(--brand-primary);
}

/* Mobile — chips mantienen tamaño mínimo clicable */
@media (max-width: 720px) {
    .method-chip { padding: 5px 11px; font-size: 12px; }
    .data-table-premium thead th { padding: 11px 12px; font-size: 10.5px; }
    .data-table-premium tbody td { padding: 12px; }
    .reports-tab { padding: 10px 16px; font-size: 13px; }
}

/* ══════════════════════════════════════════════════════════════════════
   v1.2 — Visual polish
   ══════════════════════════════════════════════════════════════════════ */

/* ── 1. Glass effect sutil — limpio, sin sombras cargadas ─────────────── */
/* El efecto premium viene del glass (gradient translúcido + blur + borde blanco),
   no de sombras pesadas. La sombra es solo un toque de elevación sutil. */
.card,
.kpi-card,
.chart-card,
.tasks-summary,
.dashboard-card,
.profile-card,
.team-card,
.hotmart-placeholder,
.health-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.99) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--main-shadow);
}
/* Cards clickables: elevación sutil al hover para dar sensación premium sin cargar la vista. */
a.kpi-card:hover,
a.mini-kpi:hover,
a.dashboard-card:hover,
.team-card:hover {
    box-shadow:
        0 2px 6px rgba(15, 23, 42, 0.06),
        0 12px 28px -10px rgba(236, 72, 153, 0.18);
}

/* ── 2. Tareas + Dashboard: proporción 65:35 (izquierda / sidebar) ────── */
.tasks-layout {
    grid-template-columns: minmax(0, 70fr) minmax(0, 30fr);
    max-width: 1280px;
}
/* Dashboard: el sidebar resumen estira al mismo alto que la caja de tareas.
   Además las mini-KPIs crecen verticalmente para llenar el espacio del
   sidebar (sin dejar ese hueco grande antes de "Ver todos los miembros"). */
.tasks-layout:has(.dashboard-card) { align-items: stretch; }
.tasks-layout:has(.dashboard-card) .tasks-summary {
    position: relative;
    top: auto;
    display: flex;
    flex-direction: column;
}
.tasks-layout:has(.dashboard-card) .tasks-summary .summary-list {
    flex: 1;
    gap: 8px;
}
.tasks-layout:has(.dashboard-card) .tasks-summary .mini-kpi {
    flex: 1;
    min-height: 0;
}
.app-content > .charts-grid { max-width: 1280px; }
.checklist-wrap {
    max-width: none;
    min-width: 0;
}
.tasks-summary { padding: 16px; }
@media (max-width: 960px) {
    .tasks-layout { grid-template-columns: 1fr; max-width: none; }
}

/* Tareas: tabs + buscador forzados en la misma línea en desktop.
   El input es compacto y la barra de tabs puede scroll si no cabe. */
.tasks-toolbar { flex-wrap: nowrap; }
.tasks-toolbar .filter-tabs {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.tasks-toolbar .filter-tabs::-webkit-scrollbar { display: none; }
.tasks-search { flex: 0 0 auto; }
.tasks-search input[type="search"] { min-width: 180px; }
@media (max-width: 720px) {
    .tasks-toolbar { flex-wrap: wrap; }
    .tasks-search { width: 100%; }
    .tasks-search input[type="search"] { flex: 1; min-width: 0; }
}

/* ── 3. Miembros: KPIs más angostas (solo ancho, no fuente) ───────────── */
.kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    gap: 10px;
}
/* fuente y padding quedan como originales — solo reducimos el ancho del grid */

/* Wrapper de tablas con scroll INTERNO en ambos ejes (vertical + horizontal).
   El thead queda sticky respecto al contenedor, y las columnas 1-2 (Nombre,
   WhatsApp) en members quedan sticky-left con fondo sólido para que no se
   vea el contenido de otras columnas por debajo al hacer scroll horizontal. */
.members-table,
.retirados-table {
    overflow: auto;
    max-height: max(520px, calc(100vh - 280px));
    position: relative;
    overscroll-behavior: contain;
}

/* Thead sticky al scroll vertical del CONTENEDOR (members + retirados) */
.members-table .data-table thead th,
.retirados-table .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--main-surface);
}

/* Alineación de encabezados: Nombre y WhatsApp a la izquierda, el resto centrado */
.members-table .data-table thead th { text-align: center; }
.members-table .data-table thead th:nth-child(1),
.members-table .data-table thead th:nth-child(2) { text-align: left; }
/* El sort-link es un flex, ajustamos su justify-content en línea con el text-align */
.members-table .data-table thead th.th-sort a { justify-content: center; }
.members-table .data-table thead th:nth-child(1).th-sort a,
.members-table .data-table thead th:nth-child(2).th-sort a { justify-content: flex-start; }
/* Columnas 1 (Nombre) y 2 (WhatsApp) sticky en members.php */
.members-table .data-table thead th:nth-child(1),
.members-table .data-table thead th:nth-child(2),
.members-table .data-table tbody td:nth-child(1),
.members-table .data-table tbody td:nth-child(2) {
    position: sticky;
    background: #ffffff;
    z-index: 2;
}
.members-table .data-table thead th:nth-child(1),
.members-table .data-table tbody td:nth-child(1) { left: 0; }
.members-table .data-table thead th:nth-child(2),
.members-table .data-table tbody td:nth-child(2) {
    left: var(--sticky-col1-w, 220px);
    box-shadow: 1px 0 0 var(--main-border);
}
.members-table .data-table thead th:nth-child(1),
.members-table .data-table thead th:nth-child(2) {
    background: var(--main-surface);
    z-index: 5; /* esquinas: sticky top + sticky left, encima de todo */
}
/* Hover SÓLIDO en columnas sticky — nunca rgba con alpha, porque durante scroll
   horizontal las filas de otras columnas se verían por debajo. */
.members-table .data-table tbody tr:hover td:nth-child(1),
.members-table .data-table tbody tr:hover td:nth-child(2) {
    background: #fdf2f8;
}
/* Fechas + otras cells numéricas no deben partirse en dos líneas */
.members-table .data-table tbody td,
.members-table .data-table thead th {
    white-space: nowrap;
}

/* ── 4. Equipo: alinear botones Editar / Suspender ────────────────────── */
/* .btn-primary global tiene margin-top:8px, que en .team-card-actions
   empuja el botón "Editar" una fila hacia abajo. Neutralizar aquí. */
.team-card-actions .btn { margin-top: 0; }

/* ── 5. Mi perfil: un poco más ancho ──────────────────────────────────── */
.profile-wrap { max-width: 860px; }

/* ── 6. Dashboard: reloj en vivo bajo el título ───────────────────────── */
.dashboard-clock {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    max-width: max-content;
    margin: -6px 0 18px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.06), rgba(124, 58, 237, 0.06));
    border: 1px solid rgba(236, 72, 153, 0.12);
    border-radius: 999px;
    font-size: 13px;
    color: #6d28d9;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.dashboard-clock-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: dashboard-clock-pulse 2s ease-out infinite;
}
.dashboard-clock-date { color: #5b21b6; font-weight: 500; opacity: 0.85; }
.dashboard-clock-sep  { opacity: 0.4; }
@keyframes dashboard-clock-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}



/* ═══════════════════════════════════════════════════════════════════
   v1.3 — Módulo de Leads
   ═══════════════════════════════════════════════════════════════════ */

/* Chips de fuente en la tabla de leads */
.source-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
    white-space: nowrap;
}
.source-chip.source-manychat               { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.source-chip.source-elementor              { background: rgba(239, 68, 68, 0.12);  color: #b91c1c; }
.source-chip.source-manual                 { background: rgba(100, 116, 139, 0.15); color: #334155; }
.source-chip.source-hotmart_cart_abandoned { background: rgba(236, 72, 153, 0.12); color: #be185d; }

/* Tonos de status para .status-chip en leads */
.status-chip.tone-lead-nuevo       { background: rgba(249, 115, 22, 0.14); color: #c2410c; border-color: rgba(249, 115, 22, 0.22); }
.status-chip.tone-lead-contactado  { background: rgba(59, 130, 246, 0.14); color: #1d4ed8; border-color: rgba(59, 130, 246, 0.22); }
.status-chip.tone-lead-en-proceso  { background: rgba(168, 85, 247, 0.14); color: #7c3aed; border-color: rgba(168, 85, 247, 0.22); }
.status-chip.tone-lead-lista-de-espera { background: rgba(8, 145, 178, 0.14); color: #0e7490; border-color: rgba(8, 145, 178, 0.22); }
.status-chip.tone-lead-ganado      { background: rgba(16, 185, 129, 0.14); color: #047857; border-color: rgba(16, 185, 129, 0.22); }
.status-chip.tone-lead-perdido     { background: rgba(148, 163, 184, 0.18); color: #475569; border-color: rgba(148, 163, 184, 0.28); }
.status-chip.tone-neutral          { background: rgba(148, 163, 184, 0.15); color: #475569; }

/* v1.12.0 — chips para tipo de membresía (member.membership_tier). */
.status-chip.tier-normal { background: rgba(148, 163, 184, 0.15); color: #475569; border-color: rgba(148, 163, 184, 0.28); }
.status-chip.tier-24h    { background: rgba(217, 119, 6, 0.14);  color: #b45309; border-color: rgba(217, 119, 6, 0.28); }

/* Grid del detalle de lead */
.lead-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
.lead-detail-grid .card { min-height: 0; }
@media (max-width: 900px) {
    .lead-detail-grid { grid-template-columns: 1fr; }
}

/* Header dentro de una tarjeta (título + badge) */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

/* Grilla dl para clave-valor */
.kv-grid {
    display: grid;
    grid-template-columns: minmax(120px, max-content) 1fr;
    gap: 8px 16px;
    margin: 0 0 16px;
    font-size: 14px;
}
.kv-grid dt { font-weight: 600; color: #64748b; }
.kv-grid dd { margin: 0; color: #0f172a; }

/* Timeline reusable (notas + historial de sources) */
.timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 2px solid rgba(99, 102, 241, 0.12);
}
.timeline-item {
    position: relative;
    padding: 8px 0 12px 18px;
    font-size: 14px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #a855f7;
    border: 2px solid #fff;
}
.timeline-meta { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.timeline-body { color: #0f172a; line-height: 1.45; }

/* Chips de UTM en el historial de sources */
.utm-chip {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 4px;
    margin-bottom: 4px;
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'SFMono-Regular', Menlo, monospace;
}

/* Forms compactos */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}
.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}
.form-grid .form-full { grid-column: 1 / -1; }
.form-grid input,
.form-grid select,
.form-grid textarea {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-grid textarea { resize: vertical; }
.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}
.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.inline-form select, .inline-form input { padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; }

/* Checkbox inline en filtros */
.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
}
.checkbox-inline input { accent-color: #7c3aed; }

/* Utilities */
.muted-sm { font-size: 12px; color: #64748b; }
.align-right { text-align: right; }

/* Flash messages */
.flash {
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid transparent;
}
.flash-success {
    background: rgba(16, 185, 129, 0.08);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.22);
}

/* Banner de "llegaron leads nuevos" */
.update-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #0f172a;
    color: #fff;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
    font-size: 13px;
    z-index: 500;
}
.update-banner .btn-link { color: #a78bfa; text-decoration: underline; }

/* Tones del activity log para leads + conversiones */
.activity-chip.activity-chip-lead       { background: rgba(249, 115, 22, 0.14); color: #c2410c; }
.activity-chip.activity-chip-conversion { background: rgba(16, 185, 129, 0.14); color: #047857; }

/* Separador entre grupos del sidebar (v1.3) */
.app-nav .nav-divider {
    display: block;
    height: 1px;
    margin: 10px 18px;
    background: rgba(255, 255, 255, 0.16);
}

/* Tabla de leads — reutiliza .data-table del sistema + afinaciones específicas */
.leads-table-card { margin-top: 4px; }
.leads-data-table tbody td {
    vertical-align: top;
}
.leads-data-table .col-contact {
    min-width: 220px;
}
.leads-data-table .contact-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--main-text, #0f172a);
    text-decoration: none;
    line-height: 1.4;
}
.leads-data-table .contact-line + .contact-line {
    margin-top: 2px;
}
.leads-data-table .contact-email {
    color: var(--main-text-soft, #64748b);
    font-size: 12.5px;
}
.leads-data-table .contact-wa:hover {
    color: var(--brand-accent, #be185d);
    text-decoration: underline;
}
.leads-data-table .contact-ico {
    width: 14px;
    text-align: center;
    opacity: 0.7;
    font-size: 12px;
}
.leads-data-table .col-date {
    color: var(--main-text-soft, #64748b);
    font-size: 13px;
    white-space: nowrap;
}
.leads-data-table .col-status {
    min-width: 140px;
}
.leads-data-table .row-actions {
    white-space: nowrap;
}
.leads-data-table .row-actions .btn-link {
    margin-right: 8px;
}

/* ═══════════════════════════════════════════════════════════════════
   v1.3 — Leads (rediseño estilo reportes.adsmarketinglab.com)
   Scope: todo bajo .leads-content-wrap para no pisar estilos globales.
   ═══════════════════════════════════════════════════════════════════ */

.leads-content-wrap {
    width: 100%;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 4px 40px rgba(8, 23, 71, 0.10), 0 1px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

/* ── Stats section ────────────────────────────────────────────────── */
.leads-stats-section {
    padding: 24px 24px 20px;
    border-bottom: 1px solid #f1f5f9;
}
.leads-stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}
.leads-stat-card {
    background: #f8fafc;
    border: 1.5px solid #e8ecf5;
    border-radius: 14px;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.18s;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: block;
}
.leads-stat-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--card-accent, transparent);
    opacity: 0.5;
    transition: opacity 0.2s;
}
.leads-stat-card:hover {
    background: #ffffff;
    border-color: #cbd5e8;
    box-shadow: 0 4px 16px rgba(8, 23, 71, 0.09);
    transform: translateY(-1px);
}
.leads-stat-card.is-active {
    background: #ffffff;
    border-color: #c8d5ea;
    box-shadow: 0 4px 16px rgba(8, 23, 71, 0.11);
}
.leads-stat-card.is-active::before { opacity: 1; }

.leads-stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    background: var(--icon-bg, rgba(8, 23, 71, 0.05));
}
.leads-stat-num {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #0f172a;
}
.leads-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Search section ───────────────────────────────────────────────── */
.leads-search-section {
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
}
.leads-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.leads-search-wrap {
    position: relative;
    flex: 1;
    min-width: 260px;
}
.leads-search-wrap input {
    width: 100%;
    height: 42px;
    background: #f8fafc;
    border: 1.5px solid #e8ecf5;
    border-radius: 11px;
    color: #0f172a;
    padding: 0 16px 0 42px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}
.leads-search-wrap input:focus {
    border-color: #7c3aed;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.07);
}
.leads-search-wrap input::placeholder { color: #94a3b8; }
.leads-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}
.leads-select {
    height: 42px;
    background: #f8fafc;
    border: 1.5px solid #e8ecf5;
    border-radius: 11px;
    color: #0f172a;
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}
.leads-select:focus { border-color: #7c3aed; }
.leads-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
}
.leads-checkbox input { accent-color: #7c3aed; }
.leads-btn {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 18px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
}
.leads-btn-primary {
    /* Usa los mismos tokens que .btn.btn-primary para consistencia visual
     * en toda la app. Al cambiar la paleta del cliente, los tokens de
     * :root hacen que TODOS los botones primarios se actualicen a la vez. */
    background: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    border-color: transparent;
    box-shadow: var(--btn-primary-shadow);
}
.leads-btn-primary:hover {
    background: var(--btn-primary-bg-hover);
    transform: translateY(-1px);
    box-shadow: var(--btn-primary-shadow-hover);
}
.leads-btn-primary:focus-visible { outline: none; box-shadow: var(--btn-primary-shadow), var(--btn-primary-focus-ring); }
.leads-btn-primary:disabled { opacity: 0.6; cursor: wait; transform: none; }
.leads-btn-secondary {
    background: #f8fafc;
    border-color: #e8ecf5;
    color: #0f172a;
}
.leads-btn-secondary:hover { background: #ffffff; border-color: #cbd5e8; }
.leads-btn-new { margin-left: auto; }
.leads-btn-link {
    font-size: 12.5px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    padding: 0 8px;
    line-height: 42px;
}
.leads-btn-link:hover { color: #7c3aed; }

/* ── Table section ────────────────────────────────────────────────── */
.leads-table-section { flex: 1; }
.leads-table-card-header {
    padding: 16px 22px 14px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.leads-table-card-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
}
.leads-table-filter-note {
    font-size: 11.5px;
    color: #94a3b8;
    font-weight: 500;
    margin-left: 6px;
}
.leads-table-count-badge {
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    border-radius: 20px;
    padding: 2px 10px;
}
.leads-table-wrap { overflow-x: auto; }

.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.leads-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 2px solid #f1f5f9;
    white-space: nowrap;
}
.leads-table thead th.th-actions { text-align: right; }
.leads-table tbody tr {
    border-bottom: 1px solid #f8fafc;
    transition: background 0.12s;
}
.leads-table tbody tr:last-child { border-bottom: none; }
.leads-table tbody tr:hover { background: #f8fafd; }
.leads-table td {
    padding: 13px 16px;
    vertical-align: middle;
    color: #1e293b;
}
.leads-table .td-date {
    color: #94a3b8;
    font-size: 12px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.leads-table .td-name {
    font-weight: 600;
    color: #0f172a;
    font-size: 13.5px;
}
.leads-table .td-name a {
    color: #0f172a;
    text-decoration: none;
}
.leads-table .td-name a:hover {
    color: #7c3aed;
    text-decoration: underline;
}
.leads-table .td-email,
.leads-table .td-phone {
    color: #475569;
    font-size: 12.5px;
}
.leads-table .td-phone a {
    color: #475569;
    text-decoration: none;
}
.leads-table .td-phone a:hover { color: #7c3aed; }
.leads-table .td-meta {
    font-size: 12px;
    color: #64748b;
}
.leads-table .td-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}
.leads-table .td-empty {
    color: #cbd5e1;
    font-style: italic;
}
.leads-table .td-actions {
    text-align: right;
    white-space: nowrap;
}
.leads-table .td-actions .leads-btn-link {
    line-height: 1;
    padding: 0 8px;
}
.leads-table .td-actions .leads-btn-convert {
    height: 30px;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 4px;
}

/* ── Status badges ─────────────────────────────────────────────── */
.leads-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid;
    letter-spacing: 0.02em;
    text-transform: none;
}
.leads-badge-nuevo      { background: rgba(139, 92, 246, 0.12); color: #7c3aed; border-color: rgba(139, 92, 246, 0.28); }
.leads-badge-contactado { background: rgba(22, 163, 74, 0.12);  color: #16a34a; border-color: rgba(22, 163, 74, 0.25); }
.leads-badge-en_proceso { background: rgba(202, 138, 4, 0.12);  color: #ca8a04; border-color: rgba(202, 138, 4, 0.25); }
.leads-badge-lista_de_espera { background: rgba(8, 145, 178, 0.12); color: #0e7490; border-color: rgba(8, 145, 178, 0.25); }
.leads-badge-ganado     { background: rgba(236, 72, 153, 0.12); color: #be185d; border-color: rgba(236, 72, 153, 0.28); }
.leads-badge-perdido    { background: rgba(100, 116, 139, 0.10); color: #64748b; border-color: rgba(100, 116, 139, 0.2); }

/* ── Empty state ──────────────────────────────────────────────── */
.leads-empty {
    padding: 70px 20px;
    text-align: center;
    color: #94a3b8;
}
.leads-empty-icon { font-size: 44px; margin-bottom: 14px; }
.leads-empty-text { font-size: 14px; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1180px) {
    .leads-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .leads-stats-section { padding: 18px 16px 14px; }
    .leads-search-section { padding: 14px 16px; }
    .leads-stats { grid-template-columns: repeat(2, 1fr); }
    .leads-btn-new { margin-left: 0; }
    .leads-table td,
    .leads-table th { padding: 10px 12px; }
}

/* ═══════════════════════════════════════════════════════════════════
   v1.3 — Lead detail redesign (2 columnas + timeline ClickUp)
   ═══════════════════════════════════════════════════════════════════ */

.lead-detail-wrap {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    color: #1e293b;
}
/* v1.4.5: cuando el wrap contiene el grid 2col (panel de chat a la
 * derecha), usar todo el ancho disponible. Consistente con member-detail
 * y task-detail-with-chat. */
.lead-detail-wrap:has(.lead-detail-grid-2col) { max-width: none; }

/* Header */
.lead-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 22px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(8, 23, 71, 0.06);
    margin-bottom: 14px;
}
.lead-detail-name {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px;
    line-height: 1.2;
}
.lead-detail-sub {
    font-size: 12.5px;
    color: #64748b;
}
.lead-detail-header-badges {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

/* Grid 2 columnas 50/50 (v1.3 — feedback usuario) */
/* v1.4.4: misma proporción que /member-detail (56% izq · 44% der con
 * mínimos) para que TODAS las pantallas con panel "Notas del contacto"
 * (lead-detail, member-detail, task-detail, convertir lead a miembro)
 * tengan la misma diagramación. Antes era 50/50 solo en lead/convert —
 * ahora es consistente en los 4 contextos. */
.lead-detail-grid-2col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 44%);
    gap: 18px;
    align-items: start;
}
@media (max-width: 1100px) {
    .lead-detail-grid-2col { grid-template-columns: 1fr; }
}

.lead-detail-left {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Cards en la columna izquierda */
.lead-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 2px 16px rgba(8, 23, 71, 0.05);
    border: 1px solid #f1f5f9;
}
.lead-card-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0 0 12px;
}
.lead-card-hint {
    font-size: 11.5px;
    color: #94a3b8;
    margin: -8px 0 10px;
}
.lead-card-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
}
.lead-convert-cta {
    width: 100%;
    justify-content: center;
}

/* KV list */
.lead-kv {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px 12px;
    margin: 0;
    font-size: 13px;
}
.lead-kv dt {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    align-self: center;
}
.lead-kv dd {
    margin: 0;
    color: #0f172a;
    word-break: break-word;
}
.lead-kv-wa {
    color: #16a34a;
    text-decoration: none;
    font-weight: 600;
}
.lead-kv-wa:hover { text-decoration: underline; }

/* Inline forms dentro de cards */
.lead-inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.lead-inline-form .leads-select { flex: 1; min-width: 0; }

/* Card admin (archivar/eliminar) — botones con mismo estilo de la plataforma */
.lead-admin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.lead-admin-form { margin: 0; }
.lead-admin-form .leads-btn {
    height: 38px;
    padding: 0 16px;
    font-size: 12.5px;
    gap: 6px;
    display: inline-flex;
    align-items: center;
}
/* Botón danger (Eliminar) */
.leads-btn-danger {
    background: #ffffff;
    border: 1.5px solid #fca5a5;
    color: #dc2626;
}
.leads-btn-danger:hover {
    background: #fef2f2;
    border-color: #dc2626;
    color: #b91c1c;
}
.leads-btn-sm {
    height: 32px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
}

/* ── Columna derecha: timeline ─────────────────────────────────── */
.lead-timeline-col {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(8, 23, 71, 0.05);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.lead-timeline-header {
    padding: 16px 22px 14px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
}
.lead-timeline-title {
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
}
.lead-timeline-count {
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #64748b;
    border-radius: 20px;
    padding: 2px 10px;
}

.lead-timeline {
    list-style: none;
    margin: 0;
    padding: 20px 22px 12px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
}
.lead-timeline-item {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    align-items: flex-start;
}

.lead-tl-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}
.lead-tl-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lead-tl-avatar-system     { background: #94a3b8; }
.lead-tl-avatar-user       { background: linear-gradient(135deg, #7c3aed, #be185d); }
.lead-tl-avatar-conversion { background: linear-gradient(135deg, #16a34a, #0891b2); }

.lead-tl-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lead-tl-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
}
.lead-tl-author {
    font-weight: 700;
    color: #0f172a;
    font-size: 12.5px;
}
.lead-tl-date {
    font-size: 11.5px;
    color: #94a3b8;
}
.lead-tl-relative { color: #cbd5e1; }
.lead-tl-chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 9px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 700;
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
    letter-spacing: 0.02em;
}
.lead-tl-utms {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}
.lead-tl-utm-chip {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(8, 23, 71, 0.04);
    color: #475569;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'SFMono-Regular', Menlo, monospace;
}
.lead-tl-text {
    font-size: 13.5px;
    line-height: 1.55;
    color: #1e293b;
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px 14px;
    border: 1px solid #f1f5f9;
    word-wrap: break-word;
}
.lead-tl-origin .lead-tl-text { background: #fef3f9; border-color: #fbd5e8; }
.lead-tl-conversion .lead-tl-text {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.15);
}

.lead-timeline-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    text-align: center;
    color: #94a3b8;
    grid-column: 1 / -1;
}
.lead-timeline-empty-icon { font-size: 36px; margin-bottom: 10px; }
.lead-timeline-empty p { margin: 0; font-size: 13px; }

/* Compose box al final del timeline */
.lead-compose-form {
    padding: 14px 22px 18px;
    background: #fafbfc;
    border-top: 1px solid #f1f5f9;
}
.lead-compose-row {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    align-items: flex-start;
}
.lead-compose-row textarea {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    color: #0f172a;
    padding: 10px 14px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    resize: vertical;
    min-height: 62px;
    transition: all 0.15s;
}
.lead-compose-row textarea:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}
.lead-compose-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-left: 48px;
}
.lead-compose-hint {
    font-size: 11.5px;
    color: #94a3b8;
}

/* Capture lead (new) */
.lead-detail-new {
    background: #ffffff;
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(8, 23, 71, 0.06);
    max-width: 640px;
}
.lead-new-title { margin: 0 0 6px; font-size: 20px; color: #0f172a; }
.lead-new-desc { margin: 0 0 22px; font-size: 13.5px; color: #64748b; line-height: 1.5; }
.lead-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.lead-form-field { display: flex; flex-direction: column; gap: 5px; }
.lead-form-field-full { grid-column: 1 / -1; }
.lead-form-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.lead-form-field input,
.lead-form-field textarea {
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: all 0.15s;
}
.lead-form-field input:focus,
.lead-form-field textarea:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}
.lead-form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}
.lead-detail-back {
    margin-top: 16px;
    text-align: left;
}


/* ═══════════════════════════════════════════════════════════════════
   v1.3 — Threads de comentarios tipo ClickUp (dentro de cada nota)
   ═══════════════════════════════════════════════════════════════════ */

/* La nota es un botón interactivo */
.lead-tl-note-bubble {
    all: unset;
    display: block;
    cursor: pointer;
    font-size: 13.5px;
    line-height: 1.55;
    color: #1e293b;
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px 14px;
    border: 1px solid #f1f5f9;
    word-wrap: break-word;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
    box-sizing: border-box;
}
.lead-tl-note-bubble:hover {
    border-color: #cbd5e8;
    background: #ffffff;
}
.lead-tl-note-bubble.is-open {
    border-color: #c8d5ea;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.06);
}

.lead-tl-note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
    font-size: 11.5px;
}
.lead-tl-note-comments-count {
    color: #7c3aed;
    font-weight: 600;
}
.lead-tl-note-toggle-hint {
    color: #94a3b8;
    font-size: 11px;
}
.lead-tl-note-bubble.is-open .lead-tl-note-toggle-hint::before {
    content: 'Click para cerrar';
}
.lead-tl-note-bubble.is-open .lead-tl-note-toggle-hint {
    font-size: 0;
}
.lead-tl-note-bubble.is-open .lead-tl-note-toggle-hint::before {
    font-size: 11px;
}

/* Thread panel (oculto hasta click) */
.lead-thread {
    margin-top: 10px;
    margin-left: -48px;  /* alinear con el avatar padre */
    padding: 12px 14px 14px 14px;
    background: #fafbfc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    animation: leadThreadFadeIn 0.2s ease-out;
}
@keyframes leadThreadFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lead-thread-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.lead-thread-item {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    align-items: flex-start;
}
.lead-tl-avatar-sm {
    width: 28px !important;
    height: 28px !important;
    font-size: 11px !important;
}
.lead-thread-body { min-width: 0; }
.lead-thread-meta {
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-size: 11.5px;
    margin-bottom: 3px;
}
.lead-thread-author {
    font-weight: 700;
    color: #0f172a;
    font-size: 12px;
}
.lead-thread-date {
    color: #94a3b8;
    font-size: 11px;
}
.lead-thread-text {
    font-size: 12.5px;
    line-height: 1.5;
    color: #334155;
    background: #ffffff;
    border: 1px solid #eef2f7;
    border-radius: 8px;
    padding: 7px 11px;
    word-wrap: break-word;
}

/* Compose del thread */
.lead-thread-compose {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    align-items: flex-start;
}
.lead-thread-compose-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lead-thread-compose-input textarea {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    color: #0f172a;
    padding: 8px 11px;
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
    resize: none;
    min-height: 38px;
    transition: all 0.15s;
}
.lead-thread-compose-input textarea:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}
.lead-thread-compose-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.lead-thread-compose-hint {
    font-size: 10.5px;
    color: #94a3b8;
}
.lead-thread-compose-hint kbd {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 10px;
    font-family: inherit;
    color: #475569;
    margin: 0 1px;
}

/* ── Mention chips en texto renderizado ────────────────────────── */
.lead-mention {
    display: inline-block;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    padding: 0 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.92em;
}

/* ── Popup de autocompletar @mentions ──────────────────────────── */
.lead-mention-popup {
    position: absolute;
    z-index: 1000;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(8, 23, 71, 0.15);
    padding: 6px;
    min-width: 220px;
    max-width: 320px;
    max-height: 260px;
    overflow-y: auto;
}
.lead-mention-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12.5px;
}
.lead-mention-opt:hover,
.lead-mention-opt.is-active {
    background: rgba(124, 58, 237, 0.08);
}
.lead-mention-opt-initials {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #be185d);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}
.lead-mention-opt-name {
    font-weight: 600;
    color: #0f172a;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lead-mention-opt-username {
    color: #94a3b8;
    font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════════════
   v1.3 — Notificaciones (campana + panel)
   ═══════════════════════════════════════════════════════════════════ */
.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: #f3f3f3;
    cursor: pointer;
    transition: opacity 0.15s ease;
    padding: 0 6px 0 0;
    margin-right: 4px;
    gap: 8px;
}
.notif-bell:hover { opacity: 0.85; background: transparent; }
/* v1.4.0 — Pill rojo "NOTIFICACIONES" visible solo cuando hay unread.
 * Reemplaza el dot pequeño legacy. Letras blancas negritas como pidió
 * el usuario. Se oculta via atributo [hidden] cuando unread=0. */
.notif-bell-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #dc2626;
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
}
.notif-bell-pill[hidden] { display: none; }
.notif-bell-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}
/* Dot legacy — ya no se usa pero lo dejamos con display:none por si alguna
 * página viejo CSS cache lo pide. */
.notif-bell-dot { display: none; }
.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 16px;
    width: 360px;
    max-height: 440px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(8, 23, 71, 0.18);
    border: 1px solid #e8ecf5;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 900;
}
.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
}
.notif-panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}
.notif-mark-all {
    background: none;
    border: none;
    color: #7c3aed;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 4px;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-panel-body {
    flex: 1;
    overflow-y: auto;
}
.notif-empty {
    padding: 30px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}
.notif-item {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid #f8fafc;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}
.notif-item:hover { background: #f8fafd; }
.notif-item.is-unread {
    background: rgba(124, 58, 237, 0.04);
    border-left: 3px solid #7c3aed;
    padding-left: 13px;
}
.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    line-height: 1.35;
}
.notif-item-snippet {
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
    margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.notif-item-meta {
    font-size: 11px;
    color: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════════════
   v1.3 — Subtitle del header (fecha debajo del nombre) + badge inline
   ═══════════════════════════════════════════════════════════════════ */
.app-header-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.app-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0;
}
.app-header-badge {
    font-size: 11px !important;
    padding: 3px 10px !important;
    border-radius: 20px !important;
}
.app-header-subtitle {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   v1.3 — Chat drawer lateral (tipo ClickUp)
   ═══════════════════════════════════════════════════════════════════ */
.lead-chat-drawer {
    position: fixed;
    inset: 0;
    z-index: 950;
}
.lead-chat-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(1px);
    animation: leadDrawerFadeIn 0.2s ease-out;
}
@keyframes leadDrawerFadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
.lead-chat-drawer-panel {
    position: absolute;
    /* 80px = altura del .app-header (~72px) + 8px de aire arriba.
       50px = altura del .app-footer fijo (~36px) + 14px de aire abajo.
       Sin estos offsets el drawer queda por DEBAJO del user-chip (z-index del chip
       crea su propio stacking context) y por debajo del .app-footer (z-index 30). */
    top: 80px;
    right: 0;
    bottom: 50px;
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(8, 23, 71, 0.18);
    border-radius: 14px 0 0 14px;
    animation: leadDrawerSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
/* En mobile: el drawer ocupa todo el ancho, así que también ocupa todo el alto
   (sin esquinas redondeadas, edge-to-edge). */
@media (max-width: 720px) {
    .lead-chat-drawer-panel {
        top: 0;
        bottom: 0;
        max-width: 100%;
        border-radius: 0;
    }
}
@keyframes leadDrawerSlideIn {
    from { transform: translateX(100%); } to { transform: translateX(0); }
}
.lead-chat-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}
.lead-chat-drawer-header-text { min-width: 0; }
.lead-chat-drawer-header-text h3 {
    margin: 0 0 2px;
    font-size: 14.5px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}
.lead-chat-drawer-sub {
    margin: 0;
    font-size: 11.5px;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lead-chat-drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lead-chat-drawer-count {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
    min-width: 24px;
    text-align: center;
}
.lead-chat-drawer-close {
    background: none;
    border: none;
    padding: 4px;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
}
.lead-chat-drawer-close:hover { background: #f1f5f9; color: #0f172a; }

.lead-chat-drawer-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
/* Mientras el drawer está abierto, evitar scroll del body */
body.lead-chat-drawer-open { overflow: hidden; }

/* Contenido del thread (item movido desde el pool al drawer) */
.lead-thread-pool-item {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Nota raíz del thread */
.lead-chat-thread-root {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 10px;
    padding: 16px 18px 14px;
    background: linear-gradient(180deg, rgba(236, 72, 153, 0.04), transparent);
    border-bottom: 1px solid #f1f5f9;
}
.lead-chat-thread-root-body { min-width: 0; }
.lead-chat-msg-meta {
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-size: 11.5px;
    margin-bottom: 4px;
}
.lead-chat-msg-author {
    font-weight: 700;
    color: #0f172a;
    font-size: 12.5px;
}
.lead-chat-msg-date { color: #94a3b8; font-size: 11px; }
.lead-chat-msg-text {
    font-size: 13.5px;
    line-height: 1.55;
    color: #1e293b;
    word-wrap: break-word;
}

/* Lista de comentarios scroll-friendly */
.lead-chat-thread-list {
    list-style: none;
    margin: 0;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}
.lead-chat-thread-empty {
    text-align: center;
    padding: 28px 12px;
    color: #94a3b8;
    font-size: 12.5px;
    list-style: none;
    background: #f8fafc;
    border-radius: 10px;
}
.lead-chat-thread-empty code {
    background: #e2e8f0;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11px;
    color: #475569;
}
.lead-chat-msg {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    align-items: flex-start;
    list-style: none;
}
.lead-chat-msg-body { min-width: 0; }
.lead-chat-msg .lead-chat-msg-text {
    background: #f8fafc;
    border-radius: 10px;
    padding: 8px 12px;
    border: 1px solid #f1f5f9;
}
.lead-chat-msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.lead-chat-msg-attachments a {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}
.lead-chat-msg-attachments img {
    display: block;
    max-width: 160px;
    max-height: 120px;
    object-fit: cover;
}

/* Compose (tanto root compose como thread compose) */
.lead-chat-compose {
    border-top: 1px solid #f1f5f9;
    padding: 12px 16px 14px;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.lead-chat-compose[data-chat-compose="root"] {
    border-top: none;
    background: transparent;
    padding: 14px 0 0;
}
.lead-chat-compose-input-wrap {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    align-items: flex-start;
}
.lead-chat-compose-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.lead-chat-compose-input textarea {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    color: #0f172a;
    padding: 10px 14px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    resize: none;
    min-height: 40px;
    transition: all 0.15s;
}
.lead-chat-compose-input textarea:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}
.lead-chat-compose-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 38px;
}
.lead-chat-compose[data-chat-compose="root"] .lead-chat-compose-footer {
    padding-left: 48px;
}
.lead-chat-compose-hint {
    flex: 1;
    font-size: 11px;
    color: #94a3b8;
}
.lead-chat-attach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}
.lead-chat-attach-btn:hover {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.15);
}
.leads-btn-sm svg { margin-right: 4px; }

/* Preview de attachments en el compose */
.lead-chat-attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0;
}
.lead-chat-thumb {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.lead-chat-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.lead-chat-thumb-rm {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    border: none;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.lead-chat-thumb-rm:hover { background: #dc2626; }

/* Attachments inline en la tarjeta de nota del timeline */
.lead-tl-note-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 8px 0 0;
}
.lead-tl-note-attachment-thumb {
    max-width: 80px;
    max-height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* Responsive drawer */
@media (max-width: 560px) {
    .lead-chat-drawer-panel { max-width: 100%; }
}



/* ═══════════════════════════════════════════════════════════════════
   v1.3 — Fixes: campana circular + panel notifs hidden real
   ═══════════════════════════════════════════════════════════════════ */
/* Bell sin fondo: queda solo el icono SVG + el pill rojo opcional. */

/* El atributo [hidden] en <div> es a veces ignorado por position: absolute.
   Forzamos display: none explícito para los paneles y drawer. */
.notif-panel[hidden],
.lead-chat-drawer[hidden],
.lead-mention-popup[hidden] {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════
   v1.3 — Convertir lead → miembro: layout 50/50 (mismo que lead-detail)
   Banner arriba, form a la izquierda, chat panel a la derecha.
   ═══════════════════════════════════════════════════════════════════ */
.convert-lead-banner {
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
}
.convert-lead-form-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.convert-lead-form-col .form-card {
    margin: 0;
    max-width: none;
    width: 100%;
}
/* Dentro de la columna 50%, la grid de 2 col del form puede quedar muy
   apretada. Forzamos 1 columna cuando el espacio es corto. */
.convert-lead-form-col .form-grid {
    grid-template-columns: 1fr !important;
}

/* v1.3 — Eventos del sistema en el timeline del lead */
.lead-tl-avatar-event {
    background: #e2e8f0;
    color: #475569;
    font-size: 14px;
}
.lead-tl-event {
    /* La entrada event tiene solo una línea compacta */
}
.lead-tl-event .lead-tl-meta {
    align-items: baseline;
}
.lead-tl-event-text {
    font-size: 13px;
    color: #475569;
    line-height: 1.45;
    flex: 1;
    min-width: 0;
}
.lead-tl-event-text strong {
    color: #0f172a;
    font-weight: 700;
}
.lead-tl-event-text em {
    font-style: normal;
    color: #94a3b8;
}

/* v1.3 — Fila de adjuntar captura en "Convertir lead a miembro" */
.convert-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    margin-top: 4px;
}
.convert-file-name {
    flex: 1;
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.convert-file-row .lead-chat-attach-btn {
    flex-shrink: 0;
}
.convert-file-row .lead-chat-thumb-rm {
    position: static;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* v1.3 — Pantalla de éxito tras convertir lead → miembro */
.convert-success-card {
    max-width: 560px;
    margin: 40px auto;
    padding: 40px 32px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(8, 23, 71, 0.08);
    text-align: center;
    border: 1px solid #f1f5f9;
}
.convert-success-icon {
    font-size: 56px;
    line-height: 1;
    margin-bottom: 18px;
    animation: convertPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes convertPop {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.convert-success-title {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}
.convert-success-sub {
    margin: 0 0 28px;
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}
.convert-success-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* v1.3 — Member-detail con panel "Notas del contacto" al lado derecho
   (solo se activa cuando el miembro tiene converted_from_lead) */
.member-detail-with-chat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 44%);
    gap: 18px;
    align-items: start;
}
.member-detail-with-chat-left { min-width: 0; }
.member-detail-with-chat-left .detail-wrap { margin: 0; max-width: none; }
.member-detail-with-chat-right {
    position: sticky;
    /* 90px = altura del .app-header sticky (~70px) + 20px de aire.
       Sin esto el header se superpone con el panel al hacer scroll. */
    top: 90px;
    max-height: calc(100vh - 190px);
    display: flex;
    flex-direction: column;
}
.member-detail-with-chat-right .lead-timeline-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.member-detail-with-chat-right .lead-timeline {
    overflow-y: auto;
}
@media (max-width: 1100px) {
    .member-detail-with-chat {
        grid-template-columns: 1fr;
    }
    .member-detail-with-chat-right {
        position: static;
        max-height: none;
    }
}

/* v1.3.1 — Chip "↩️ recurrente" en la tabla de leads (miembros que vuelven) */
.leads-badge-recurrente {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    background: #fef3c7;
    color: #78350f;
    border: 1px solid #f59e0b;
    margin-top: 4px;
    letter-spacing: 0.02em;
}

/* ── v1.3.3: compose sin avatar + padding interno mayor ──────────────────
 * Decidimos quitar el círculo con iniciales del compose (root + thread)
 * para dar más aire al textarea. Con el avatar fuera, reajustamos los
 * paddings del contenedor y del footer para que ni el input ni el botón
 * queden pegados a la orilla.
 */
.lead-compose-row-noavatar {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
}
.lead-chat-compose-input-wrap-noavatar {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
}

/* Compose principal del panel (card "Notas del contacto").
 * Padding uniforme en los 4 lados — el 0 izquierdo era herencia del avatar
 * viejo que ya no está. */
.lead-chat-compose[data-chat-compose="root"] {
    padding: 14px 18px 18px 18px !important;
}
.lead-chat-compose[data-chat-compose="root"] .lead-chat-compose-footer {
    padding-left: 0;
    padding-right: 4px;  /* minúsculo respiro lateral del botón */
}

/* Compose dentro del drawer de comentarios (thread) */
.lead-chat-compose[data-chat-compose="thread"] {
    padding: 14px 18px 18px 18px !important;  /* caja uniforme en el drawer */
}
.lead-chat-compose[data-chat-compose="thread"] .lead-chat-compose-footer {
    padding-left: 0;
    padding-right: 4px;
}

/* Compose al final del timeline en lead-detail (variante standalone) */
.lead-compose-form {
    padding: 16px 22px 20px 22px;  /* bajada extra de aire inferior */
}
.lead-compose-row.lead-compose-row-noavatar + .lead-compose-actions,
.lead-compose-actions {
    padding-left: 0;
    padding-right: 2px;
}

/* ── v1.3.3: navegación entre leads ─────────────────────────────────────
 * Arriba: "← Volver al listado" como breadcrumb sutil.
 * Abajo: fila con "Volver al listado" (izq) + "Anterior / Siguiente" (der).
 */
.lead-detail-back-top {
    margin: 0 0 14px;
    text-align: left;
}

.lead-detail-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}
.lead-detail-nav-pager {
    display: flex;
    gap: 18px;
    align-items: center;
}
.leads-btn-link.is-disabled {
    color: #cbd5e1 !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── v1.3.3: más aire entre campos del form "Convertir lead a miembro" ──
 * Los campos se sentían apretados — subimos el gap del grid y el margen
 * vertical entre secciones (producto, datos, pago).
 */
.convert-lead-form-col .form-grid {
    gap: 22px 20px;  /* row-gap 22px (más aire vertical) · col-gap 20px */
}
.convert-lead-form-col form.card.form-card > .form-grid {
    margin-top: 6px;
}
.convert-lead-form-col form.card.form-card .form-grid + .input-wrap.full-width,
.convert-lead-form-col form.card.form-card .input-wrap.full-width {
    margin-top: 22px;
}
.convert-lead-form-col .convert-payment-fields {
    display: grid;
    gap: 22px;
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid #e2e8f0;
}
/* El grid interno del bloque de pagos también respira */
.convert-lead-form-col .convert-payment-fields > .input-wrap {
    margin-top: 0;
}

/* ── v1.4.0: detalle técnico de incidencias Hotmart ─────────────────────
 * Cuando el payload trae procesador_code + procesador_message, los mostramos
 * con tipografía monoespaciada para dejar claro que es respuesta cruda del
 * gateway (útil para debuggear rechazos sin entrar al webhook-log).
 */
.history-field-tech dt {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.history-field-tech dd {
    font-family: 'SFMono-Regular', Menlo, Monaco, 'Courier New', monospace;
    font-size: 12px;
    color: #475569;
    background: #f8fafc;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 2px;
}

/* ── v1.4.0: Panel "Notas del contacto" en /task-detail.php ─────────────
 * Replica el grid de 2 columnas que ya tienen /lead-detail.php y
 * /member-detail.php. Misma regla responsive (colapsa a 1 col en mobile).
 */
.task-detail-with-chat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 44%);
    gap: 18px;
    align-items: start;
}
.task-detail-with-chat-left { min-width: 0; }
/* v1.4.3: MISMA estructura que .member-detail-with-chat-right.
 * Antes usábamos `overflow-y: auto` en el contenedor, lo que RECORTABA
 * el popup del autocomplete de @menciones (el user veía scroll dentro
 * de la caja). Ahora el scroll vive solo en .lead-timeline interno y
 * el contenedor queda con overflow visible → el popup del @ puede
 * desbordar correctamente, igual que en /lead-detail y /member-detail. */
.task-detail-with-chat-right {
    position: sticky;
    /* Mismo offset que .member-detail-with-chat-right: deja pasar el .app-header sticky. */
    top: 90px;
    max-height: calc(100vh - 190px);
    display: flex;
    flex-direction: column;
}
.task-detail-with-chat-right .lead-timeline-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.task-detail-with-chat-right .lead-timeline {
    overflow-y: auto;
}
@media (max-width: 960px) {
    .task-detail-with-chat {
        grid-template-columns: 1fr;
    }
    .task-detail-with-chat-right {
        position: static;
        max-height: none;
    }
}

/* ── v1.4.1: Banner de advertencia "pago duplicado" ─────────────────────
 * Se inyecta al tope del form del modal de pago cuando el backend detecta
 * una referencia o pago idéntico ya registrado. Mostramos los datos del
 * pago previo + 2 botones para decidir. */
.pay-dup-warning {
    background: #fffbeb;
    border: 1.5px solid #f59e0b;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
    color: #78350f;
    font-size: 13.5px;
    line-height: 1.5;
}
.pay-dup-warning-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}
.pay-dup-warning-ico { font-size: 18px; }
.pay-dup-warning-msg { margin: 0 0 10px; }
.pay-dup-warning-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px 14px;
    margin: 10px 0 14px;
    padding: 10px 12px;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 6px;
}
.pay-dup-warning-details > div { display: flex; flex-direction: column; gap: 2px; }
.pay-dup-warning-details dt {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #92400e;
}
.pay-dup-warning-details dd { margin: 0; font-size: 13px; color: #451a03; }
.pay-dup-warning-details code {
    background: rgba(245, 158, 11, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
}
.pay-dup-warning-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ── v1.4.2: Tabs del panel de notificaciones (Sin leer / Historial) ────
 * Pills debajo del header. La activa en morado marca, la inactiva en gris. */
.notif-panel-tabs {
    display: flex;
    gap: 6px;
    padding: 0 16px 10px;
    border-bottom: 1px solid #e8ecf5;
    background: #ffffff;
}
.notif-tab {
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid transparent;
    color: #64748b;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.notif-tab:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.notif-tab.is-active {
    background: rgba(124, 58, 237, 0.10);
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.25);
}


/* ── Cursos: cards clickables (sustituyen tablas en /cursos.php) ───────── */
.course-cards { display: flex; flex-direction: column; gap: 10px; }

.course-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1.2fr) minmax(180px, 1.2fr) minmax(120px, 0.8fr);
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 2px rgba(91, 42, 168, 0.04);
    transition: transform 0.12s, box-shadow 0.18s, border-color 0.18s;
}
.course-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(91, 42, 168, 0.10);
    border-color: rgba(124, 58, 237, 0.3);
}

.course-card-meta { display: flex; flex-direction: column; gap: 2px; }
.course-card-date  { font-size: 12px; color: #7a6a8a; }
.course-card-buyer { display: flex; flex-direction: column; gap: 1px; }
.course-card-buyer strong { font-size: 14px; color: #2a1a3a; }
.course-card-buyer .muted { font-size: 12px; }

.course-card-course {
    font-weight: 500;
    color: #2a1a3a;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
/* v1.14.0: badge de tarifa aplicada en cada card de venta */
.course-card-tier {
    font-size: 11px;
    font-weight: 500;
    color: #b45309;
    background: rgba(217, 119, 6, 0.1);
    padding: 2px 8px;
    border-radius: 999px;
    align-self: flex-start;
}

/* v1.14.0: fila "Tarifa actual" + botón "Cambiar tarifa" en course-plan-detail */
.plan-tier-row {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(217, 119, 6, 0.06);
    border: 1px solid rgba(217, 119, 6, 0.18);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
}
.plan-tier-current { flex: 1; min-width: 200px; }
.plan-tier-current strong { color: #b45309; }
.course-card-currency {
    font-size: 11px;
    color: #7a6a8a;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.course-card-progress { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.course-card-progress-amounts { font-size: 13px; }
.course-card-progress-amounts strong { color: #2a1a3a; }
.course-card-type {
    font-size: 11px;
    color: #5b2aa8;
    background: rgba(124, 58, 237, 0.08);
    padding: 2px 8px;
    border-radius: 999px;
    align-self: flex-start;
    font-weight: 500;
}
.course-progress-bar {
    background: #eee;
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}
.course-progress-bar > div {
    height: 100%;
    background: linear-gradient(90deg, #5b2aa8, #ec4899);
    transition: width 0.3s;
}

.course-card-status { text-align: right; }

@media (max-width: 800px) {
    .course-card {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .course-card-status { text-align: left; }
}

/* ── Plan de cuotas: detalle (header tipo member-detail) ───────────────── */
.course-pill {
    display: inline-block;
    padding: 4px 10px;
    margin-left: 6px;
    background: rgba(124, 58, 237, 0.10);
    color: #5b2aa8;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
    letter-spacing: 0.02em;
}

.detail-header-meta {
    margin-top: 4px;
    color: #7a6a8a;
    font-size: 13px;
}

.plan-progress-block {
    margin: 16px 0 20px;
    padding: 14px 16px;
    background: rgba(124, 58, 237, 0.04);
    border-radius: 12px;
}
.plan-progress-amounts {
    font-size: 18px;
    margin-bottom: 8px;
}
.plan-progress-amounts strong { color: #2a1a3a; font-weight: 700; }
.plan-progress-remaining       { font-size: 13px; }

/* v1.13.1: línea "Próximo recordatorio" debajo de la barra de progreso. */
.plan-next-reminder {
    margin-top: 10px;
    font-size: 13px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.plan-next-reminder strong { color: #2a1a3a; font-weight: 600; }
.plan-next-reminder-icon { font-size: 14px; }
.plan-next-reminder-link { font-size: 12px; margin-left: auto; }

/* v1.13.1: Toast popup que aparece al programar un recordatorio. Más visible
   que un alert banner — flota arriba a la derecha y se desvanece. */
.plan-toast {
    position: fixed;
    top: 90px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #16a34a;
    min-width: 320px;
    max-width: 420px;
    animation: planToastIn 0.25s ease-out;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.plan-toast.is-leaving {
    opacity: 0;
    transform: translateX(20px);
}
.plan-toast-icon { font-size: 20px; }
.plan-toast-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.plan-toast-body strong { color: #15803d; font-size: 14px; font-weight: 600; }
.plan-toast-body span   { color: #475569; font-size: 13px; }
.plan-toast-close {
    background: transparent; border: 0; cursor: pointer;
    color: #94a3b8; font-size: 22px; line-height: 1; padding: 0 4px;
}
.plan-toast-close:hover { color: #475569; }
@keyframes planToastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Status chip nuevo: status-cancelled (alias rojo) */
.status-cancelled    { background: rgba(239, 68, 68, 0.14); color: #b91c1c; }

/* Divider visual dentro del modal "Crear plan" — separa "Plan" de "Primera cuota" */
.cpm-divider {
    margin: 18px 0 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-weight: 600;
    color: #2a1a3a;
    font-size: 14px;
}
.cpm-divider .muted { font-weight: 400; font-size: 12px; }

/* v1.13.0: Badge "📌 Desde lead" — aparece cuando el modal de plan se abre
   desde el chooser de /leads.php con prefill de un lead específico. */
.cpm-lead-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 16px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.25);
    color: #6b21a8;
    font-size: 13px;
}
.cpm-lead-badge-icon { font-size: 14px; }
.cpm-lead-badge strong { font-weight: 600; }

/* ── Detail-card title (member-detail style) used in plan-detail ────────── */
.detail-card .detail-card-title { margin: 0 0 14px; font-size: 16px; }

/* Cuotas registradas — tabla en una sola línea por fila */
.plan-cuotas-table th,
.plan-cuotas-table td { white-space: nowrap; }
.plan-cuotas-table td  { font-size: 13px; padding: 10px 12px; }

/* Reminder form en plan-detail: input de fecha + botón en línea */
.reminder-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.reminder-date-wrap { flex: 1 1 240px; min-width: 200px; }

/* Header del plan-detail: nombre + course-pill + status-chip en línea */
.plan-detail-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.plan-detail-name  { font-weight: 700; }

/* Cuota-curso tone (violeta) — para tasks list + task-detail */
.check-tone-cuota-curso { border-left: 4px solid #a855f7; }
.check-tone-cuota-curso .check-action { color: #7c3aed; }
.task-detail-cuota-curso { border-color: rgba(168, 85, 247, 0.35); }
.task-detail-cuota-curso .task-detail-kicker { color: #7c3aed; }

/* Just-created modal — input read-only del link Stripe */
.just-created-stripe-url { margin: 16px 0 4px; }
.just-created-stripe-url input {
    width: 100%; padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: rgba(124, 58, 237, 0.04);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px; color: #2a1a3a;
}

/* ── Modal más ancho para forms con campos extra (Pagomóvil) ───────────── */
.modal-card.modal-card-wide { max-width: 720px; }

/* ── Cuotas registradas: filas expandibles ──────────────────────────────── */
.cuota-row-expandable { cursor: pointer; }
.cuota-row-expandable:hover { background: rgba(124, 58, 237, 0.04); }
.cuota-toggle-cell { width: 24px; padding-right: 0 !important; }
.cuota-toggle {
    display: inline-block;
    color: #7a6a8a;
    font-size: 12px;
    transition: transform 0.15s;
}
.cuota-row-expandable.is-expanded .cuota-toggle { transform: rotate(90deg); }
.cuota-row-details td {
    padding: 0 !important;
    background: rgba(124, 58, 237, 0.03);
}
.cuota-row-details > td > .cuota-details-grid {
    padding: 12px 18px;
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}
.cuota-details-grid > div { min-width: 160px; }
.cuota-details-grid dt {
    font-size: 11px;
    color: #7a6a8a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 2px;
}
.cuota-details-grid dd {
    margin: 0;
    font-size: 13px;
    color: #2a1a3a;
}

/* v1.16.0 — Detalles del pago Stripe (sub-bloque dentro del expand de cuota) */
.cuota-stripe-details {
    margin: 0 18px 14px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: 10px;
}
.cuota-stripe-details h4 {
    margin: 0 0 10px;
    font-size: 12px;
    color: #5b2aa8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}
.cuota-stripe-grid {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px 24px;
}
.cuota-stripe-grid > div { min-width: 0; }
.cuota-stripe-grid dt {
    font-size: 11px;
    color: #7a6a8a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 2px;
}
.cuota-stripe-grid dd {
    margin: 0;
    font-size: 13px;
    color: #2a1a3a;
}
.cuota-stripe-id-row { grid-column: 1 / -1; }
.cuota-stripe-id {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 12px;
    color: #4a3a5a;
    background: rgba(124, 58, 237, 0.06);
    padding: 3px 8px;
    border-radius: 6px;
    word-break: break-all;
    display: inline-block;
}

/* Paste hint en file inputs dentro de modales */
.input-wrap.light input[type="file"] + .paste-hint {
    margin-top: 4px;
    font-size: 11px;
    color: #7a6a8a;
}
.paste-feedback {
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    font-size: 12px;
    display: none;
}
.paste-feedback.is-shown { display: block; }

/* Separación generosa entre cards dentro del wrap del detalle.
   Se usa margin-bottom (no gap) para que funcione aunque haya
   modales/scripts intercalados en el DOM. */
.detail-wrap > .detail-card { margin-bottom: 35px; }
.detail-wrap > .detail-card:last-of-type { margin-bottom: 0; }

/* Cuota expandida: el botón "Ver captura" usa un <dt>&nbsp;</dt> invisible
   como spacer para que su <dd> quede a la altura de los otros <dd>. */

/* Barra de progreso del plan dentro del header de la tarea cobrar_cuota_curso. */
.task-detail-header { gap: 16px; }
.task-detail-header-text { flex: 1; min-width: 0; }
.task-plan-progress { min-width: 220px; max-width: 280px; }
.task-plan-progress-amounts { font-size: 14px; color: #2a1a3a; margin-bottom: 6px; }
.task-plan-progress-remaining { font-size: 12px; margin-top: 4px; }

/* Activity rows: cuando el evento es navegable, todo el chip+target son links sin underline */
.activity-row-clickable:hover { background: rgba(124, 58, 237, 0.04); }
.event-chip-link              { text-decoration: none; }

/* ============================================================
   Mundo Pritty — Sistema de Gestión de Órdenes (custom v0.1.0)
   ============================================================ */
.brand-text {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    text-align: center; color: #f8fafc;
    text-decoration: none;
}
.brand-text strong {
    font-size: 17px; font-weight: 700; letter-spacing: 0.4px;
    color: #ffffff;
}
.brand-text .brand-sub {
    font-size: 11px; font-weight: 500; letter-spacing: 1px;
    color: rgba(248, 250, 252, 0.65); text-transform: uppercase;
}
.role-badge.role-recepcion {
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
    color: #fff;
}
.role-badge.role-disenador {
    background: linear-gradient(135deg, #c026d3 0%, #e879f9 100%);
    color: #fff;
}
.role-badge.role-tienda {
    background: linear-gradient(135deg, #16a34a 0%, #4ade80 100%);
    color: #fff;
}

/* ============================================================
   Mundo Pritty — Cards y forms en fondo claro
   ============================================================ */
.glass-panel {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    padding: 28px 32px;
    box-shadow: 0 4px 16px rgba(20, 10, 45, 0.04);
    color: #1f1b2e;
}
.glass-panel h2,
.glass-panel h3 {
    color: #1f1b2e;
    font-weight: 700;
}
.glass-panel p { color: #4b5563; }
/* Links de texto en glass-panel son morados, pero los botones primary quedan blancos.
   Excluimos .btn-primary y .btn-link para que mantengan su color original. */
.glass-panel a:not(.btn-primary):not(.btn-link) { color: #7c3aed; }
.glass-panel a.btn-primary { color: #ffffff; text-decoration: none; }
.glass-panel .input-wrap span {
    color: #374151;
    font-weight: 600;
    font-size: 13px;
}
.glass-panel .input-wrap input,
.glass-panel .input-wrap select,
.glass-panel .input-wrap textarea {
    background: #ffffff;
    color: #1f1b2e;
    border: 1px solid rgba(0, 0, 0, 0.12);
}
.glass-panel .input-wrap input:focus,
.glass-panel .input-wrap select:focus,
.glass-panel .input-wrap textarea:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}
.glass-panel .input-wrap small { color: #9ca3af; }
.glass-panel hr { background: rgba(0, 0, 0, 0.08) !important; border-top-color: rgba(0, 0, 0, 0.08) !important; }
.glass-panel .password-toggle {
    color: #6b7280;
}
.glass-panel .password-field { position: relative; }
.glass-panel .password-field .password-toggle {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; cursor: pointer; padding: 4px;
}

/* Alerts en glass-panel claro */
.glass-panel .alert {
    padding: 12px 16px; border-radius: 10px; font-size: 14px; line-height: 1.5;
}
.glass-panel .alert-success {
    background: #ecfdf5; color: #047857; border: 1px solid #6ee7b7;
}
.glass-panel .alert-error {
    background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5;
}
.glass-panel .alert-warning {
    background: #fffbeb; color: #92400e; border: 1px solid #fcd34d;
}
.glass-panel .alert code {
    background: rgba(0,0,0,0.06); padding: 2px 8px; border-radius: 6px;
    font-family: 'SFMono-Regular', Menlo, monospace;
}

/* Tabla del listado de equipo */
.glass-panel table th { color: #6b7280; font-weight: 600; font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; }
.glass-panel table td  { color: #1f1b2e; }
.glass-panel table tr:hover { background: rgba(124, 58, 237, 0.02); }

/* Botón link dentro de glass-panel */
.glass-panel .btn-link { color: #7c3aed; padding: 4px 8px; border-radius: 6px; }
.glass-panel .btn-link:hover { background: rgba(124, 58, 237, 0.08); color: #6d28d9; }

/* ============================================================
   Mundo Pritty — Pills de tipo y estado de orden
   ============================================================ */
.order-type-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
}
.order-type-dtf {
    background: #ede9fe;
    color: #5b21b6;
}
.order-type-uvdtf {
    background: #fce7f3;
    color: #9d174d;
}

.order-state-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
}
.order-state-neutral  { background: #f3f4f6; color: #4b5563; }
.order-state-info     { background: #dbeafe; color: #1e40af; }
.order-state-progress { background: #fef3c7; color: #92400e; }
.order-state-ready    { background: #cffafe; color: #155e75; }
.order-state-done     { background: #d1fae5; color: #065f46; }
.order-state-danger   { background: #fee2e2; color: #b91c1c; }

/* ============================================================
   Mundo Pritty — Autocomplete clientes recurrentes (hito 4)
   ============================================================ */
.cs-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(20, 10, 45, 0.12);
    z-index: 50;
    max-height: 320px;
    overflow-y: auto;
}
.cs-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    align-items: baseline;
}
.cs-item:last-child { border-bottom: none; }
.cs-item:hover { background: rgba(124, 58, 237, 0.06); }
.cs-item-name {
    font-weight: 600;
    color: #1f1b2e;
    font-size: 14px;
    grid-column: 1;
    grid-row: 1;
}
.cs-item-meta {
    color: #6b7280;
    font-size: 12px;
    grid-column: 1;
    grid-row: 2;
}
.cs-item-badge {
    background: #ede9fe;
    color: #5b21b6;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    white-space: nowrap;
}

.cs-dropdown[hidden] { display: none !important; }
.cs-frequent-badge[hidden] { display: none !important; }
.cs-frequent-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 10px;
    color: #92400e;
    font-size: 14px;
}
.cs-frequent-badge .btn-link {
    color: #92400e !important;
    text-decoration: underline;
}

/* ============================================================
   Mundo Pritty — Dropzone de arte (hito 6)
   ============================================================ */
.art-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f9fafb;
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    outline: none;
}
.art-dropzone:hover { border-color: #7c3aed; background: #faf5ff; }
.art-dropzone:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18); }
.art-dropzone.is-dragover { border-color: #7c3aed; background: #f5f3ff; }
.art-dropzone.is-filled {
    text-align: left;
    background: #ffffff;
    border-style: solid;
    border-color: #d1d5db;
    padding: 14px 16px;
}
.art-empty {
    color: #4b5563;
    font-size: 14px;
}
.art-selected {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Multi-file: lista vertical de archivos seleccionados */
.art-selected-list {
    display: flex; flex-direction: column; gap: 8px;
}
.art-selected-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    background: #faf5ff;
    border: 1px solid #ddd6fe;
    border-radius: 10px;
}
.art-selected-info { flex: 1; min-width: 0; }
.art-selected-name { font-weight: 600; color: #1f1b2e; font-size: 14px; word-break: break-all; }
.art-selected-meta { color: #6b7280; font-size: 12px; margin-top: 2px; }

.art-thumb {
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #ede9fe;
    overflow: hidden;
}
.art-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-thumb-ext {
    color: #5b21b6;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
}

#art-edit-descriptions {
    display: inline-block;
    margin-top: 8px;
    color: #7c3aed;
    font-size: 13px;
}

/* Modal de descripción por archivo */
.art-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.art-modal[hidden] { display: none; }
.art-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 10, 30, 0.6);
    backdrop-filter: blur(2px);
}
.art-modal-card {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.art-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid #e5e7eb;
}
.art-modal-header h3 {
    margin: 0; font-size: 18px; font-weight: 700; color: #1f1b2e;
}
.art-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}
.art-modal-close:hover { background: #f3f4f6; color: #1f1b2e; }
.art-modal-hint {
    margin: 14px 22px 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
}
.art-modal-files {
    padding: 14px 22px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.art-modal-file {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}
.art-modal-file .art-thumb {
    width: 80px; height: 80px;
}
.art-modal-file-info { flex: 1; min-width: 0; }
.art-modal-file-name { font-weight: 600; color: #1f1b2e; font-size: 14px; word-break: break-all; }
.art-modal-file-size { color: #6b7280; font-size: 12px; margin-top: 2px; }
.art-modal-file-desc-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 10px;
    margin-bottom: 4px;
}
.art-modal-file-desc {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.art-modal-file-desc:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.art-modal-file-measure {
    margin-top: 10px;
}
.art-modal-file-measure-label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}
.art-modal-file-measure-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.art-modal-file-unit {
    padding: 8px 28px 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #ffffff;
    cursor: pointer;
    min-width: 110px;
}
.art-modal-file-qty {
    width: 90px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    text-align: right;
    box-sizing: border-box;
}
.art-modal-file-unit:focus,
.art-modal-file-qty:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.art-modal-file-qty.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.art-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* Lista de N archivos en order-detail */
.design-files-list {
    display: flex; flex-direction: column; gap: 8px;
}
.design-file-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: #ecfdf5;
    border: 1px solid #86efac;
    border-radius: 10px;
}
.design-file-icon {
    width: 48px; height: 48px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #16a34a;
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-radius: 8px;
    flex-shrink: 0;
}
.design-file-info { flex: 1; min-width: 0; }
.design-file-title { font-weight: 600; color: #1f1b2e; font-size: 14px; }
.design-file-meta {
    color: #6b7280;
    font-size: 12px;
    margin-top: 2px;
    word-break: break-all;
    font-family: 'SFMono-Regular', Menlo, monospace;
}
.design-file-measure {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 10px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

/* ============================================================
   Mundo Pritty — Kanban de la cola (hito 7)
   ============================================================ */
.kanban-wrap {
    width: 100%;
    max-width: 1600px;
}
.kanban-header {
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.kanban-summary {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
}
.kanban-summary strong { color: #1f1b2e; }

.kanban-day-filter {
    display: flex; align-items: center; gap: 10px;
}
.kanban-day-filter label {
    font-size: 13px;
    color: #4b5563;
    font-weight: 500;
}
.kanban-day-filter input[type="date"] {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    font-size: 13px;
    background: #ffffff;
    color: #1f1b2e;
    cursor: pointer;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(240px, 1fr));
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}
@media (max-width: 1100px) {
    .kanban-board { grid-template-columns: repeat(5, 260px); }
}

/* Paleta más sobria: columnas con fondo gris muy claro, solo el accent del estado en el borde superior */
.kanban-col {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    display: flex; flex-direction: column;
    min-height: 200px;
    border-top: 3px solid #cbd5e1;
}
.kanban-col-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px 10px;
    border-bottom: 1px solid #e5e7eb;
}
.kanban-col-header h3 {
    margin: 0; font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.7px;
    color: #374151;
}
.kanban-col-count {
    padding: 2px 9px; border-radius: 12px;
    font-size: 11px; font-weight: 700;
    color: #6b7280;
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

/* Accent sutil en el border-top por estado */
.kanban-col-ready    { border-top-color: #06b6d4; }
.kanban-col-progress { border-top-color: #f59e0b; }
.kanban-col-done     { border-top-color: #10b981; }
.kanban-col-urgent {
    border-top-color: #dc2626;
    background: linear-gradient(to bottom, #fef2f2 0%, #ffffff 80px);
}
.kanban-col-urgent .kanban-col-header h3 { color: #b91c1c; }

.kanban-col-body {
    padding: 10px;
    display: flex; flex-direction: column; gap: 10px;
    flex: 1;
}
.kanban-col-empty {
    color: #9ca3af; font-size: 13px; text-align: center;
    padding: 24px 8px;
    font-style: italic;
}

.kanban-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
    color: #1f1b2e;
    box-shadow: 0 1px 3px rgba(20, 10, 45, 0.04);
    transition: box-shadow 0.15s ease, transform 0.05s ease;
}
.kanban-card:hover { box-shadow: 0 4px 12px rgba(20, 10, 45, 0.08); }
.kanban-card.is-express {
    border-left: 4px solid #dc2626;
    background: linear-gradient(to right, #fef2f2 0%, #ffffff 12%);
}
.kanban-card-express {
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 1px;
    align-self: flex-start;
}

.kanban-card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.kanban-card-id {
    font-size: 16px; font-weight: 700;
    color: #1f1b2e;
    letter-spacing: 0.3px;
}

.kanban-card-client {
    display: flex; flex-direction: column; gap: 2px;
    font-size: 13px;
}
.kanban-card-client strong { color: #1f1b2e; font-weight: 600; }
.kanban-card-wa { color: #6b7280; font-size: 12px; }

.kanban-card-times {
    display: flex; justify-content: space-between; gap: 6px;
    font-size: 12px; color: #6b7280;
}
.kanban-card-times strong { color: #1f1b2e; font-weight: 600; }
.kanban-card-promesa { color: #b91c1c; }

.kanban-card-notes {
    font-size: 12px; color: #6b7280; line-height: 1.4;
    background: #fef9c3;
    padding: 6px 10px;
    border-radius: 6px;
    border-left: 3px solid #ca8a04;
}

.kanban-card-actions {
    display: flex; flex-direction: column; gap: 6px;
    margin-top: 4px;
}
.kanban-move-form { display: contents; }

.kanban-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px; font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    min-height: 44px;  /* táctil */
    transition: background 0.15s ease;
    font-family: inherit;
    text-align: center;
}
.kanban-btn-primary {
    background: linear-gradient(135deg, #7c3aed 0%, #c026d3 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.28);
}
.kanban-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(124, 58, 237, 0.34); }
.kanban-btn-primary:active { transform: translateY(0); }

.kanban-btn-ghost {
    background: #f3f4f6;
    color: #374151;
    font-size: 13px;
    min-height: 36px;
}
.kanban-btn-ghost:hover { background: #e5e7eb; }

.kanban-errors {
    margin-top: 28px;
    padding: 16px 18px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 12px;
}
.kanban-errors-list {
    display: flex; flex-direction: column; gap: 10px;
    margin-top: 10px;
}
.kanban-errors-item {
    padding: 12px 14px;
    background: #ffffff;
    border-radius: 10px;
    color: #1f1b2e;
    font-size: 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex; gap: 14px; align-items: center; justify-content: space-between;
    flex-wrap: wrap;
}
.kanban-errors-item-info { flex: 1; min-width: 240px; }
.kanban-errors-item-head {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.kanban-errors-item-head strong { font-size: 15px; }
.kanban-errors-item-reason {
    margin-top: 6px;
    color: #7f1d1d;
    font-style: italic;
    font-size: 13px;
    white-space: pre-wrap;
}
.kanban-errors-item-actions {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.error-mark-block summary::-webkit-details-marker { display: none; }
.error-mark-block summary:hover { background: #fee2e2 !important; }

/* ============================================================
   Panel rojo "Orden con error" + bloque reemplazo + histórico
   ============================================================ */
.order-error-panel {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-left: 4px solid #dc2626;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 20px;
}
.order-error-panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.order-error-panel-title {
    font-weight: 700;
    color: #b91c1c;
    font-size: 15px;
}
.order-error-panel-cat {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.order-error-panel-cat[data-cat="arte"]         { background: #7c3aed; }
.order-error-panel-cat[data-cat="pago"]         { background: #059669; }
.order-error-panel-cat[data-cat="info_cliente"] { background: #2563eb; }
.order-error-panel-cat[data-cat="impresion"]    { background: #dc2626; }
.order-error-panel-cat[data-cat="material"]     { background: #d97706; }
.order-error-panel-cat[data-cat="otro"]         { background: #6b7280; }

.order-error-panel-reason {
    color: #7f1d1d;
    font-size: 14px;
    white-space: pre-wrap;
    margin-bottom: 8px;
}
.order-error-panel-target {
    color: #991b1b;
    font-size: 13px;
}
.order-error-panel-waiting {
    margin-top: 10px;
    color: #7f1d1d;
    font-size: 13px;
    font-style: italic;
}

.order-error-resolve-form {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.order-error-resolve-form input[type="text"] {
    flex: 1;
    min-width: 240px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    font-size: 13px;
    font-family: inherit;
}

.order-error-replace-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed rgba(220, 38, 38, 0.3);
}
.order-error-replace-title {
    font-weight: 700;
    color: #7f1d1d;
    font-size: 13px;
    margin-bottom: 4px;
}
.order-error-replace-hint {
    color: #991b1b;
    font-size: 12px;
    margin: 0 0 10px;
}

.replace-file-block {
    background: #ffffff;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 6px;
}
.replace-file-block summary {
    cursor: pointer;
    padding: 10px 14px;
    font-size: 13px;
    color: #7f1d1d;
    list-style: none;
    word-break: break-word;
}
.replace-file-block summary::-webkit-details-marker { display: none; }
.replace-file-block[open] summary {
    border-bottom: 1px solid #fecaca;
    background: #fef2f2;
}
.replace-file-name {
    font-family: 'SFMono-Regular', Menlo, monospace;
    font-size: 12px;
    color: #4b5563;
}
.replace-file-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 14px;
}
.replace-file-form input[type="file"] {
    flex: 1;
    min-width: 200px;
    font-size: 13px;
}
.replace-file-status {
    width: 100%;
    margin-top: 6px;
    font-size: 12px;
    color: #4b5563;
}
.replace-file-status[data-state="ok"]    { color: #047857; }
.replace-file-status[data-state="error"] { color: #b91c1c; }

/* Sección "Errores anteriores" */
.error-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.error-history-item {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #9ca3af;
    border-radius: 8px;
    padding: 12px 14px;
}
.error-history-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.error-history-cat {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    background: #6b7280;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.error-history-cat[data-cat="arte"]         { background: #7c3aed; }
.error-history-cat[data-cat="pago"]         { background: #059669; }
.error-history-cat[data-cat="info_cliente"] { background: #2563eb; }
.error-history-cat[data-cat="impresion"]    { background: #dc2626; }
.error-history-cat[data-cat="material"]     { background: #d97706; }
.error-history-cat[data-cat="otro"]         { background: #6b7280; }
.error-history-arrow {
    font-size: 12px;
    color: #6b7280;
}
.error-history-reason {
    color: #1f1b2e;
    font-size: 13px;
    margin-bottom: 6px;
    white-space: pre-wrap;
}
.error-history-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
}
.error-history-note {
    margin-top: 6px;
    padding: 6px 10px;
    background: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    color: #4b5563;
}
.error-history-files {
    margin-top: 8px;
    padding: 8px 10px;
    background: #ffffff;
    border-radius: 6px;
}
.error-history-files-title {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 700;
    margin-bottom: 4px;
}
.error-history-files ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 12px;
    color: #4b5563;
}
.error-history-files li {
    font-family: 'SFMono-Regular', Menlo, monospace;
    word-break: break-word;
    padding: 2px 0;
}
.error-history-file-old { color: #dc2626; text-decoration: line-through; opacity: 0.7; }
.error-history-file-new { color: #047857; }

/* ============================================================
   Banner "¿Para hoy o para mañana?" en ventana de corte
   ============================================================ */
.cutoff-banner {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 12px;
    padding: 14px 16px;
    animation: cutoff-pulse-in 0.4s ease-out;
}
.cutoff-banner[hidden] { display: none !important; }
@keyframes cutoff-pulse-in {
    0%   { transform: scale(0.98); opacity: 0; }
    100% { transform: scale(1);    opacity: 1; }
}
.cutoff-banner-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.cutoff-banner-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}
.cutoff-banner-head strong {
    display: block;
    color: #78350f;
    font-size: 15px;
    margin-bottom: 2px;
}
.cutoff-banner-sub {
    color: #92400e;
    font-size: 13px;
}
.cutoff-banner-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.cutoff-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 14px;
    min-height: 90px;
    border-radius: 10px;
    border: 2px solid;
    background: #ffffff;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
    font-family: inherit;
    position: relative;
}
.cutoff-choice:hover    { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,0.08); }
.cutoff-choice:active   { transform: scale(0.98); }
.cutoff-choice-label {
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.cutoff-choice-day {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
}
/* Variantes de color */
.cutoff-choice-today {
    border-color: #10b981;
    color: #047857;
}
.cutoff-choice-today:hover { background: #ecfdf5; }
.cutoff-choice-today.is-selected {
    background: #10b981;
    color: #ffffff;
    border-color: #047857;
}
.cutoff-choice-today.is-selected .cutoff-choice-day { color: rgba(255,255,255,0.85); }

.cutoff-choice-tomorrow {
    border-color: #3b82f6;
    color: #1e40af;
}
.cutoff-choice-tomorrow:hover { background: #eff6ff; }
.cutoff-choice-tomorrow.is-selected {
    background: #3b82f6;
    color: #ffffff;
    border-color: #1e40af;
}
.cutoff-choice-tomorrow.is-selected .cutoff-choice-day { color: rgba(255,255,255,0.85); }

/* Check ✓ en la esquina cuando está seleccionado */
.cutoff-choice.is-selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 14px;
    font-weight: 800;
}

/* Mobile: apilar verticalmente */
@media (max-width: 560px) {
    .cutoff-banner-choices {
        grid-template-columns: 1fr;
    }
    .cutoff-choice {
        min-height: 70px;
        padding: 12px;
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
    }
    .cutoff-choice-label { font-size: 14px; }
}

/* ─────────────────────────────────────────────────────────────
   Type chooser (DTF / UVDTF) — paso 1 obligatorio del form
   ─────────────────────────────────────────────────────────────
   Reemplaza el viejo <select> con DTF preseleccionado. Mientras
   no haya elección, el chooser pulsa para llamar atención y el
   .form-body de abajo queda atenuado. Mismo lenguaje visual que
   .cutoff-banner / .cutoff-choice — solo cambian los colores
   (naranja para DTF, morado para UVDTF). */
.type-chooser {
    background: #fffaf5;
    border: 1px solid #fed7aa;
    border-left: 4px solid #f97316;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 8px;
    transition: box-shadow .25s ease, border-color .25s ease;
}
.type-chooser.is-pending {
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.10);
    animation: typeChooserPulse 1.8s ease-in-out infinite;
}
@keyframes typeChooserPulse {
    0%,100% { box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.10); }
    50%     { box-shadow: 0 0 0 8px rgba(249, 115, 22, 0.18); }
}
.type-chooser-head { margin-bottom: 12px; }
.type-chooser-head strong { font-size: 15px; color: #1f1b2e; }
.type-chooser-head .req-mark { color: #dc2626; }
.type-chooser-sub { font-size: 13px; color: #6b7280; margin-top: 2px; }

.type-chooser-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.type-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 18px 16px;
    border-radius: 12px;
    border: 2px solid transparent;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: all .18s ease;
    min-height: 88px;
}
.type-choice:hover  { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,0.08); }
.type-choice:active { transform: scale(0.98); }
.type-choice-label  { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.type-choice-sub    { font-size: 12px; color: #6b7280; font-weight: 500; text-align: center; }

.type-choice-dtf       { border-color: #fed7aa; color: #c2410c; }
.type-choice-dtf:hover { background: #fff7ed; }
.type-choice-dtf.is-selected {
    background: #f97316;
    color: #fff;
    border-color: #c2410c;
}
.type-choice-dtf.is-selected .type-choice-sub { color: rgba(255,255,255,0.85); }

.type-choice-uvdtf       { border-color: #ddd6fe; color: #6d28d9; }
.type-choice-uvdtf:hover { background: #f5f3ff; }
.type-choice-uvdtf.is-selected {
    background: #7c3aed;
    color: #fff;
    border-color: #5b21b6;
}
.type-choice-uvdtf.is-selected .type-choice-sub { color: rgba(255,255,255,0.85); }

/* Cuerpo del form: atenuado y bloqueado hasta elegir tipo.
   Replica el `display:flex; flex-direction:column; gap:16px` que tenía el
   <form> original — al envolver los hijos en este div, se perdió el gap
   y los bloques (Recibido por, Cutoff banner, Express, Promesa, etc.)
   quedaban pegados unos a otros sin separación visual. */
.form-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: opacity .25s ease, filter .25s ease;
}
.form-body[data-locked="1"] {
    opacity: 0.45;
    filter: saturate(0.5);
    pointer-events: none;   /* fallback para navegadores sin `inert` */
    user-select: none;
}

/* Mobile: botones apilados */
@media (max-width: 520px) {
    .type-chooser-choices { grid-template-columns: 1fr; }
    .type-choice { min-height: 72px; padding: 14px 12px; }
    .type-choice-label { font-size: 19px; }
}

/* ============================================================
   Bloque "Reasignar día operativo" + sección histórico
   ============================================================ */
.day-reassign-block {
    background: #f5f3ff;
    border: 1px solid #c4b5fd;
    border-left: 4px solid #7c3aed;
    border-radius: 10px;
    padding: 0;
    margin-bottom: 20px;
}
.day-reassign-block summary {
    cursor: pointer;
    padding: 12px 18px;
    font-weight: 600;
    color: #5b21b6;
    font-size: 14px;
    list-style: none;
}
.day-reassign-block summary::-webkit-details-marker { display: none; }
.day-reassign-block summary:hover { background: #ede9fe; border-radius: 10px 10px 0 0; }
.day-reassign-block[open] summary {
    border-bottom: 1px solid #c4b5fd;
    background: #ede9fe;
    border-radius: 10px 10px 0 0;
}
.day-reassign-form {
    padding: 14px 18px 16px;
}
.day-reassign-hint {
    margin: 0 0 12px;
    color: #5b21b6;
    font-size: 13px;
    line-height: 1.5;
}
.day-reassign-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}
.day-reassign-fields label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #6b21a8;
    font-weight: 600;
}
.day-reassign-fields label > span { font-size: 12px; }
.day-reassign-fields input[type="date"],
.day-reassign-fields input[type="text"],
.day-reassign-fields select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #c4b5fd;
    background: #ffffff;
    font-size: 14px;
    font-family: inherit;
    color: #1f2937;
    line-height: 1.4;
}
/* Select: quitar look nativo y agregar caret consistente.
   Sin esto se ve out-of-style en el bloque morado de "Cambiar tipo". */
.day-reassign-fields select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%237c3aed' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5 L6 7.5 L9 4.5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    min-width: 160px;
}
.day-reassign-fields input[type="date"]:focus,
.day-reassign-fields input[type="text"]:focus,
.day-reassign-fields select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.day-reassign-fields input[type="text"] { flex: 1; min-width: 200px; }
.day-reassign-fields .btn-primary { padding: 9px 16px; }
.day-reassign-status {
    margin-top: 10px;
    font-size: 12px;
    color: #4b5563;
}
.day-reassign-status[data-state="ok"]    { color: #047857; }
.day-reassign-status[data-state="error"] { color: #b91c1c; }

/* Histórico de cambios de día operativo */
.day-key-changes-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.day-key-change-item {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #7c3aed;
    border-radius: 8px;
    padding: 10px 12px;
}
.day-key-change-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    margin-bottom: 4px;
}
.dkc-from {
    font-family: 'SFMono-Regular', Menlo, monospace;
    font-weight: 700;
    color: #dc2626;
    text-decoration: line-through;
    opacity: 0.75;
}
.dkc-arrow { color: #6b7280; }
.dkc-to {
    font-family: 'SFMono-Regular', Menlo, monospace;
    font-weight: 700;
    color: #047857;
}
.dkc-day {
    font-size: 12px;
    color: #6b7280;
    margin-left: auto;
}
.day-key-change-meta {
    font-size: 11px;
    color: #6b7280;
}
.day-key-change-note {
    margin-top: 6px;
    padding: 6px 10px;
    background: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    color: #4b5563;
}
.day-key-change-drive-errors {
    margin-top: 8px;
    padding: 8px 10px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    font-size: 12px;
    color: #92400e;
}
.day-key-change-drive-errors ul {
    margin: 4px 0 4px 18px;
    padding: 0;
    font-family: 'SFMono-Regular', Menlo, monospace;
    font-size: 11px;
}
.day-key-change-drive-errors small {
    display: block;
    margin-top: 4px;
    color: #78350f;
}

/* En móvil: stack vertical de columnas */
@media (max-width: 720px) {
    .kanban-board {
        display: flex;
        flex-direction: column;
        overflow-x: visible;
    }
    .kanban-col { min-height: auto; }
}

/* ============================================================
   Pills móviles para saltar entre columnas de la cola
   ============================================================ */
.kanban-tabs {
    display: none;
}

@media (max-width: 720px) {
    .kanban-tabs {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 4px 2px 12px;
        margin-bottom: 10px;
        scrollbar-width: none;
        position: sticky;
        top: 0;
        z-index: 30;
        background: linear-gradient(180deg, #f9fafb 70%, rgba(249,250,251,0));
    }
    .kanban-tabs::-webkit-scrollbar { display: none; }

    .kanban-tab {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 9px 14px;
        border-radius: 999px;
        border: 1.5px solid rgba(0, 0, 0, 0.10);
        background: #ffffff;
        color: #1f2937;
        font-size: 13px;
        font-weight: 600;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    }
    .kanban-tab:active { transform: scale(0.97); }

    .kanban-tab-count {
        display: inline-flex;
        min-width: 22px;
        height: 22px;
        padding: 0 7px;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        background: rgba(0, 0, 0, 0.08);
        color: inherit;
        font-size: 12px;
        font-weight: 700;
    }
    .kanban-tab-count[data-empty="1"] { opacity: 0.45; }

    .kanban-tab.is-active {
        background: #4f46e5;
        color: #ffffff;
        border-color: #4f46e5;
    }
    .kanban-tab.is-active .kanban-tab-count {
        background: rgba(255, 255, 255, 0.25);
        color: #ffffff;
    }
    /* Pill de Express: rojo cuando activo, borde rojo cuando inactivo */
    .kanban-tab-urgent {
        border-color: rgba(220, 38, 38, 0.35);
        color: #b91c1c;
    }
    .kanban-tab-urgent.is-active {
        background: #dc2626;
        border-color: #dc2626;
        color: #ffffff;
    }
    .kanban-tab-urgent.is-active .kanban-tab-count {
        background: rgba(255, 255, 255, 0.25);
    }

    /* Filtro: solo se ve la columna marcada como activa */
    .kanban-col[data-col-key]:not(.is-mobile-active) { display: none; }
    .kanban-col.is-mobile-active { display: block; }
}

/* ============================================================
   Mundo Pritty — Editor de plantillas WhatsApp (hito 9)
   ============================================================ */
.wa-template-block {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 14px;
    background: #ffffff;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.wa-template-block.is-highlighted {
    border-color: #7c3aed;
    background: #faf5ff;
}
.wa-template-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 10px;
}
.wa-template-head h4 {
    margin: 0; font-size: 15px; color: #1f1b2e;
    display: flex; align-items: center; gap: 8px;
}
.wa-pill-custom,
.wa-pill-default {
    font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
    padding: 3px 8px; border-radius: 6px;
    text-transform: uppercase;
}
.wa-pill-custom  { background: #ede9fe; color: #5b21b6; }
.wa-pill-default { background: #f3f4f6; color: #6b7280; }

.wa-template-preview {
    background: #ecfdf5;
    border-left: 3px solid #16a34a;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #065f46;
    line-height: 1.5;
    white-space: pre-wrap;
}
.wa-template-preview-label {
    display: block;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: #047857;
    margin-bottom: 4px;
}

/* ============================================================
   Mundo Pritty — Mejoras UX kanban (pulse fresh + drag & drop)
   ============================================================ */

/* Cards "frescas": pulsan suavemente con un halo morado hasta que el operario
   las toca. Visible solo en la columna "Lista para imprimir". */
@keyframes kanban-fresh-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.55), 0 1px 3px rgba(20, 10, 45, 0.04); }
    50%      { box-shadow: 0 0 0 10px rgba(124, 58, 237, 0), 0 1px 3px rgba(20, 10, 45, 0.04); }
}
.kanban-card.is-fresh {
    animation: kanban-fresh-pulse 1.6s ease-in-out infinite;
    border-color: #c4b5fd;
}
.kanban-card.is-fresh::before {
    content: 'NUEVA';
    position: absolute;
    top: -8px; right: 12px;
    background: #7c3aed;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 3px 8px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.4);
}
.kanban-card { position: relative; }  /* para que ::before se ancle */

/* Botón verde para avanzar al siguiente estado (era morado) */
.kanban-btn-primary {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.28);
}
.kanban-btn-primary:hover {
    box-shadow: 0 4px 10px rgba(22, 163, 74, 0.34);
}

/* Drag & drop */
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card[draggable="true"]:active { cursor: grabbing; }
.kanban-card.is-dragging {
    opacity: 0.5;
    transform: scale(0.97);
}
.kanban-col-body.is-drag-over {
    background: #f5f3ff;
    box-shadow: inset 0 0 0 2px #a78bfa;
    border-radius: 0 0 10px 10px;
}
.kanban-col-body {
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

/* ============================================================
   Mundo Pritty — Comentarios + @mentions
   ============================================================ */
.comment-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #1f1b2e;
}
.comment-item.is-mine {
    background: #ede9fe;
    border-color: #c4b5fd;
}
.comment-head {
    display: flex; align-items: baseline; gap: 8px;
    margin-bottom: 4px;
}
.comment-head strong { font-size: 13px; color: #1f1b2e; }
.comment-time {
    font-size: 11px;
    color: #9ca3af;
}
.comment-text {
    line-height: 1.5;
    color: #374151;
    white-space: pre-wrap;
    word-break: break-word;
}
.comment-mention {
    background: #ede9fe;
    color: #5b21b6;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
}
.comment-item.is-mine .comment-mention {
    background: #ddd6fe;
}

.cs-item.is-active {
    background: rgba(124, 58, 237, 0.08);
}

/* ============================================================
   Mundo Pritty — Badges de roles nuevos (atencion + impresiones)
   ============================================================ */
.role-badge.role-atencion {
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
    color: #fff;
}
.role-badge.role-impresiones {
    background: linear-gradient(135deg, #16a34a 0%, #4ade80 100%);
    color: #fff;
}
.role-badge.role-impresiones_dtf {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
}
.role-badge.role-impresiones_uvdtf {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    color: #fff;
}

/* ============================================================
   Mundo Pritty — Audio toggle del kanban + Actividad
   ============================================================ */
.kanban-header-actions {
    display: flex; align-items: center; gap: 14px;
    flex-wrap: wrap;
}
.kanban-audio-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.kanban-audio-toggle:hover { border-color: #c4b5fd; }
.kanban-audio-toggle.is-on {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}
.kanban-audio-toggle.is-off {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #6b7280;
}
.kanban-audio-icon { font-size: 15px; }

/* Buscador del kanban */
.kanban-search-input {
    flex: 0 0 260px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #1f1b2e;
    font-size: 13px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kanban-search-input::placeholder { color: #9ca3af; }
.kanban-search-input:focus {
    outline: none;
    border-color: #c4b5fd;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

/* Toggle "Ver con error" del kanban */
.kanban-errors-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #fca5a5;
    background: #fff;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}
.kanban-errors-toggle:hover { background: #fef2f2; }
.kanban-errors-toggle.is-active {
    background: #b91c1c;
    color: #fff;
    border-color: #b91c1c;
}
.kanban-errors-toggle-count {
    font-weight: 800;
}

/* Cards ocultas por búsqueda */
.kanban-card.is-hidden-search,
.kanban-errors-item.is-hidden-search { display: none !important; }

/* Bloque de errores colapsado por defecto */
.kanban-errors.is-collapsed { display: none; }

/* ============================================================
   Pantalla Actividad
   ============================================================ */
.activity-filters {
    display: flex; gap: 12px; align-items: end; flex-wrap: wrap;
    padding: 14px 16px;
    background: #f9fafb;
    border-radius: 10px;
    margin-bottom: 18px;
}
.activity-filters .input-wrap { flex: 0 0 180px; }
.activity-filter-actions { display: flex; gap: 8px; align-items: center; }

.activity-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 8px;
}
@media (max-width: 720px) { .activity-kpis { grid-template-columns: 1fr; } }
.activity-kpi {
    background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 100%);
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    padding: 16px 18px;
}
.activity-kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #6b21a8;
    font-weight: 700;
}
.activity-kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: #1f1b2e;
    margin-top: 4px;
}
.activity-kpi-sub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.activity-stages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}
.activity-stage {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #7c3aed;
    border-radius: 8px;
    padding: 12px 14px;
}
.activity-stage-name {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    font-weight: 700;
}
.activity-stage-avg {
    font-size: 22px;
    font-weight: 800;
    color: #1f1b2e;
    margin-top: 4px;
}
.activity-stage-meta {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.activity-feed {
    display: flex; flex-direction: column; gap: 4px;
    margin-top: 8px;
}
.activity-row {
    display: grid;
    grid-template-columns: 160px 200px 200px 1fr;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    align-items: center;
}
@media (max-width: 900px) {
    .activity-row { grid-template-columns: 1fr; gap: 4px; padding: 12px 10px; }
}
.activity-row-time { color: #9ca3af; font-family: 'SFMono-Regular', Menlo, monospace; font-size: 12px; }
.activity-row-user { font-weight: 600; }
.activity-row-event { color: #6b21a8; }
.activity-row-target { color: #4b5563; }

/* ============================================================
   Reloj del header
   ============================================================ */
.app-header { gap: 16px; }
.app-header-clock {
    display: flex; flex-direction: column; align-items: flex-end;
    line-height: 1.1; margin-left: auto;
    padding: 0 18px 0 6px;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    user-select: none;
    flex-shrink: 0;
}
.app-header-clock-time {
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 22px; font-weight: 700;
    color: #1f1b2e;
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
}
.app-header-clock-date {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #6b7280;
    margin-top: 2px;
}
/* En móvil queda solo la hora */
@media (max-width: 720px) {
    .app-header-clock { padding: 0 10px 0 4px; }
    .app-header-clock-time { font-size: 18px; }
    .app-header-clock-date { display: none; }
}

/* Tarjetas en listado de órdenes (estilo tipo card por fila) */
.orders-grid {
    display: flex; flex-direction: column; gap: 10px;
    margin-top: 12px;
}

/* Subheader con contadores cliqueables: cada conteo es un link/pill */
.orders-summary {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.orders-summary-link {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    border: 1px solid transparent;
    transition: background 0.12s ease, transform 0.05s ease, border-color 0.12s ease;
}
.orders-summary-link:hover { transform: translateY(-1px); }
.orders-summary-link:active { transform: scale(0.97); }

.orders-summary-total {
    color: #1f1b2e;
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.18);
}
.orders-summary-total:hover {
    background: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.4);
}

.orders-summary-deliver {
    color: #15803d;
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.22);
}
.orders-summary-deliver:hover {
    background: rgba(22, 163, 74, 0.18);
    border-color: rgba(22, 163, 74, 0.55);
}

.orders-summary-pending {
    color: #b45309;
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.28);
}
.orders-summary-pending:hover {
    background: rgba(245, 158, 11, 0.22);
    border-color: rgba(245, 158, 11, 0.6);
}

.orders-summary-error {
    color: #b91c1c;
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.22);
}
.orders-summary-error:hover {
    background: rgba(220, 38, 38, 0.18);
    border-color: rgba(220, 38, 38, 0.55);
}

/* Entregadas ocultas — color discreto verde-grisáceo, no debe robar atención. */
.orders-summary-delivered {
    color: #4b5563;
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.22);
}
.orders-summary-delivered:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.45);
}

/* Pills DTF / UVDTF en el subheader del listado.
 * Usan los mismos colores que las pills .order-type-dtf / .order-type-uvdtf
 * para que el operador asocie visualmente el contador con las cards. */
.orders-summary-dtf {
    color: #5b21b6;
    background: rgba(91, 33, 182, 0.08);
    border-color: rgba(91, 33, 182, 0.25);
}
.orders-summary-dtf:hover {
    background: rgba(91, 33, 182, 0.18);
    border-color: rgba(91, 33, 182, 0.55);
}
.orders-summary-uvdtf {
    color: #9d174d;
    background: rgba(157, 23, 77, 0.08);
    border-color: rgba(157, 23, 77, 0.25);
}
.orders-summary-uvdtf:hover {
    background: rgba(157, 23, 77, 0.18);
    border-color: rgba(157, 23, 77, 0.55);
}

/* ───────────────────────────────────────────────────────────────────
   DASHBOARD (solo super_admin / admin) — mobile-first, tipo app.
   ─────────────────────────────────────────────────────────────────── */
.dashboard-wrap {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* ── Botones de período ── */
.dash-periods {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px;
    background: #f3f4f6;
    border-radius: 14px;
    overflow-x: auto;
    scrollbar-width: none;
}
.dash-periods::-webkit-scrollbar { display: none; }
.dash-period-btn {
    flex: 1 1 auto;
    min-width: 110px;
    padding: 11px 18px;
    text-align: center;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    background: transparent;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, transform 0.06s ease;
    white-space: nowrap;
}
.dash-period-btn:hover { background: #ffffff; color: #1f1b2e; }
.dash-period-btn:active { transform: scale(0.97); }
.dash-period-btn.is-active {
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
.dash-period-btn.is-active:hover { color: #ffffff; background: linear-gradient(135deg, #7c3aed, #ec4899); }

/* ── Cabecera del período ── */
.dash-period-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 4px;
}
.dash-period-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1f1b2e;
}
.dash-period-range {
    font-size: 13px;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

/* ── Grid principal de stats (4 cards) ── */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.dash-card {
    padding: 18px 16px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(20, 10, 45, 0.04);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.dash-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(20, 10, 45, 0.08); }
.dash-card-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #6b7280;
}
.dash-card-value {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.1;
    color: #1f1b2e;
    font-variant-numeric: tabular-nums;
}
.dash-card-sub {
    font-size: 11px;
    color: #9ca3af;
}

/* Acento por tipo de card */
.dash-card-total { background: linear-gradient(135deg, #faf5ff 0%, #ffffff 100%); border-color: #ddd6fe; }
.dash-card-total .dash-card-value { color: #5b21b6; }

.dash-card-dtf { background: linear-gradient(135deg, #ede9fe 0%, #ffffff 100%); border-color: #c4b5fd; }
.dash-card-dtf .dash-card-value { color: #5b21b6; }

.dash-card-uvdtf { background: linear-gradient(135deg, #fce7f3 0%, #ffffff 100%); border-color: #f9a8d4; }
.dash-card-uvdtf .dash-card-value { color: #9d174d; }

.dash-card-express { background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%); border-color: #fecaca; }
.dash-card-express .dash-card-value { color: #b91c1c; }

/* ── Fila de medidas (YARDAS / A3 / A4 / WRAP) ── */
.dash-grid-units {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 12px;
}
.dash-card-yardas { background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%); border-color: #a7f3d0; }
.dash-card-yardas .dash-card-value { color: #047857; }

.dash-card-a3 { background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%); border-color: #bfdbfe; }
.dash-card-a3 .dash-card-value { color: #1d4ed8; }

.dash-card-a4 { background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%); border-color: #fde68a; }
.dash-card-a4 .dash-card-value { color: #b45309; }

.dash-card-wrap { background: linear-gradient(135deg, #fdf2f8 0%, #ffffff 100%); border-color: #f9a8d4; }
.dash-card-wrap .dash-card-value { color: #be185d; }

/* ── Desglose DTF/UVDTF dentro de cada card de medida ── */
.dash-card-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.dash-bd-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px 3px 5px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.04);
    color: #1f1b2e;
    font-variant-numeric: tabular-nums;
}
.dash-bd-tag {
    font-size: 9px;
    letter-spacing: 0.4px;
    padding: 2px 6px;
    border-radius: 999px;
    color: #ffffff;
    background: #6b7280;
}
.dash-bd-dtf .dash-bd-tag { background: #7c3aed; } /* morado DTF */
.dash-bd-uv  .dash-bd-tag { background: #ec4899; } /* rosa UVDTF */

/* ── Form de rango personalizado ── */
.dash-custom-range {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    padding: 14px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    margin-bottom: 10px;
}
.dash-custom-range[hidden] { display: none !important; }
.dash-custom-range label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
}
.dash-custom-range input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #ffffff;
}
.dash-custom-range input[type="date"]:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.dash-custom-range .btn-primary { padding: 10px 18px; }

/* ── Sección de gráficas ── */
.dash-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 12px;
}
.dash-chart-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px 18px 22px;
    box-shadow: 0 2px 6px rgba(20, 10, 45, 0.04);
}
.dash-chart-card-wide { grid-column: 1 / -1; }
.dash-chart-card .dash-section-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: #1f1b2e;
}
.dash-chart-card .dash-section-sub {
    margin: 0 0 12px;
    font-size: 12px;
    color: #6b7280;
}
.dash-chart-canvas-wrap {
    position: relative;
    height: 240px;
}
.dash-chart-canvas-wrap-donut { height: 280px; }
.dash-chart-canvas-wrap canvas { max-width: 100%; }

/* ── Fila de estados ── */
.dash-status-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.dash-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}
.dash-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dash-status-label { font-size: 12px; color: #6b7280; font-weight: 600; }
.dash-status-value { font-size: 22px; font-weight: 700; color: #1f1b2e; line-height: 1; font-variant-numeric: tabular-nums; }
.dash-status-delivered .dash-status-dot { background: #16a34a; }
.dash-status-pending .dash-status-dot   { background: #f59e0b; }
.dash-status-error .dash-status-dot     { background: #dc2626; }

/* ── Sección de tiempos ── */
.dash-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 2px 6px rgba(20, 10, 45, 0.04);
}
.dash-section-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: #1f1b2e;
}
.dash-section-sub {
    margin: 0 0 18px;
    font-size: 13px;
    color: #6b7280;
}
.dash-times-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.dash-time-card {
    padding: 14px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dash-time-label { font-size: 11px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.dash-time-value { font-size: 22px; font-weight: 700; color: #1f1b2e; font-variant-numeric: tabular-nums; }
.dash-time-meta  { font-size: 11px; color: #9ca3af; }
.dash-time-card-cycle {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #eef2ff, #faf5ff);
    border-color: #c7d2fe;
}
.dash-time-card-cycle .dash-time-value { color: #4f46e5; font-size: 26px; }

/* ── Responsive: tablet ── */
@media (max-width: 900px) {
    .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-times-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-time-card-cycle { grid-column: 1 / -1; }
    /* En tablet, 4 medidas en 2x2 — más cómodo de leer que 4 cols apretadas. */
    .dash-grid-units { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* Charts: en tablet bajamos a 1 columna excepto el wide. */
    .dash-charts { grid-template-columns: 1fr; }
    .dash-chart-canvas-wrap { height: 220px; }
}

/* ── Responsive: móvil ── */
@media (max-width: 560px) {
    .dashboard-wrap { gap: 16px; }
    .dash-periods { gap: 4px; padding: 4px; border-radius: 12px; }
    .dash-period-btn { padding: 10px 12px; font-size: 12px; min-width: 80px; }
    .dash-period-title { font-size: 20px; }
    .dash-card { padding: 14px 12px; border-radius: 14px; }
    .dash-card-value { font-size: 30px; }
    /* En móvil chico, las 4 medidas en 2x2 para que los números no se corten. */
    .dash-grid-units { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-grid-units .dash-card { padding: 12px 10px; }
    .dash-grid-units .dash-card-value { font-size: 24px; }
    .dash-grid-units .dash-card-label { font-size: 11px; letter-spacing: 0.3px; }
    .dash-grid-units .dash-card-sub { display: none; }
    /* Breakdown DTF/UVDTF: en móvil chico mantenemos pills pero más compactas. */
    .dash-bd-pill { font-size: 11px; padding: 2px 7px 2px 4px; gap: 4px; }
    .dash-bd-tag { font-size: 8px; padding: 1px 5px; }
    /* Charts: stack vertical, altura un poco menor para que no domine. */
    .dash-chart-card { padding: 14px 14px 18px; border-radius: 14px; }
    .dash-chart-canvas-wrap { height: 200px; }
    .dash-chart-canvas-wrap-donut { height: 240px; }
    /* Form de rango personalizado: stack vertical en móvil. */
    .dash-custom-range { gap: 10px; padding: 12px; }
    .dash-custom-range label { width: 100%; }
    .dash-custom-range input[type="date"] { width: 100%; box-sizing: border-box; }
    .dash-custom-range .btn-primary { width: 100%; }
    .dash-status-row { grid-template-columns: 1fr; gap: 8px; }
    .dash-status { padding: 12px 14px; }
    .dash-section { padding: 16px; border-radius: 14px; }
    .dash-times-grid { grid-template-columns: 1fr; gap: 8px; }
    .dash-time-value { font-size: 20px; }
    .dash-time-card-cycle .dash-time-value { font-size: 22px; }
}
.orders-row {
    display: grid;
    /* ID | check | cliente | tipo | EXPRESS toggle | estado | recibida | promesa | acción
       La columna cliente es 1fr (flexible). Acción reservada en 142px para
       que los botones de "Resolver error" + "Entregar" no se apilen ni
       sobresalgan del card (problema visual reportado 4 jun 2026). */
    grid-template-columns: 88px 36px minmax(140px, 1fr) 56px 150px 110px 78px 78px 142px;
    gap: 8px;
    align-items: center;
    padding: 11px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(20, 10, 45, 0.03);
    transition: box-shadow 0.15s ease, transform 0.05s ease;
    font-size: 13px;
}
.orders-row-verify {
    display: flex;
    align-items: center;
    justify-content: center;
}
.orders-row:hover {
    box-shadow: 0 4px 14px rgba(20, 10, 45, 0.07);
    border-color: #c4b5fd;
}
.orders-row.is-express {
    border-left: 4px solid #dc2626;
    padding-left: 13px;
}
.orders-row-id { font-weight: 700; font-size: 13px; color: #1f1b2e; letter-spacing: 0.2px; }
.orders-row-express-tag {
    font-size: 9px; font-weight: 700; color: #b91c1c;
    letter-spacing: 0.5px; margin-top: 2px;
}
.orders-row-client a {
    color: #1f1b2e; font-weight: 600; font-size: 13px; text-decoration: none;
    text-transform: uppercase;  /* estandariza: aunque se escriba minúscula, se ve en mayúsculas */
    border-bottom: 1px dashed transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.orders-row-client a:hover { color: #6d28d9; border-bottom-color: #c4b5fd; }
.orders-row-client-meta { color: #6b7280; font-size: 11px; margin-top: 1px; word-break: break-all; }
.orders-row-client-line {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* Resumen del arte (medidas + descripción) debajo del nombre del cliente.
   Más prominente que .orders-row-client-meta porque no es contacto — es el
   contenido operativo de la orden (qué tiene que revisar/entregar). El
   tooltip al hacer hover muestra el detalle por archivo. */
.orders-row-client-summary {
    font-size: 12px;
    color: #4338ca;            /* indigo: destacado sin ser agresivo */
    font-weight: 500;
    margin-top: 2px;
    line-height: 1.35;
    position: relative;         /* anchor del tooltip absoluto */
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;    /* trunca con "..." si excede ancho */
    cursor: default;
}

/* Tooltip CSS-only — multi-line via white-space:pre-line + \n en data-tooltip.
   Evita el tooltip nativo del navegador (feo, una sola línea). */
.orders-row-client-summary[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    background: #1f2937;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    white-space: pre-line;
    min-width: 200px;
    max-width: 360px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    pointer-events: none;
}
.orders-row-client-summary[data-tooltip]:hover::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 12px;
    z-index: 51;
    border: 4px solid transparent;
    border-bottom-color: #1f2937;
    pointer-events: none;
}

/* Checkbox inline de verificación de recepción del taller */
.verify-check {
    width: 26px; height: 26px;
    min-width: 26px;
    border-radius: 6px;
    border: 2px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center; justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
    padding: 0;
}
.verify-check:hover { border-color: #d97706; background: #fef3c7; }
.verify-check:active { transform: scale(0.92); }
.verify-check.is-on {
    background: #16a34a;
    border-color: #15803d;
}
.verify-check.is-on:hover {
    background: #15803d;
    border-color: #166534;
}
.verify-check-mark {
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    line-height: 1;
}
.verify-check[disabled] { opacity: 0.5; cursor: wait; }

/* Mobile: target táctil agrandado.
   26×26 era demasiado pequeño para tap con dedo — Apple HIG recomienda
   mínimo 44×44pt, Material 48×48dp. Subimos a 40×40 con tipografía más
   grande para que el ✓ siga centrado y legible. El equipo de atención
   reportaba que el check "no respondía" en móvil — era falta de hit area. */
@media (max-width: 720px) {
    .verify-check {
        width: 40px; height: 40px;
        min-width: 40px;
        border-radius: 8px;
        border-width: 2.5px;
    }
    .verify-check-mark { font-size: 22px; }
    /* La variante chica (.verify-check-sm) usada en kanban cards también
       crece — el espacio en card es generoso en móvil. */
    .verify-check.verify-check-sm {
        width: 34px; height: 34px; min-width: 34px;
    }
    .verify-check.verify-check-sm .verify-check-mark { font-size: 18px; }
}

/* Variante chica del check (para kanban cards) */
.verify-check.verify-check-sm {
    width: 22px; height: 22px; min-width: 22px;
    border-width: 1.5px;
}
.verify-check.verify-check-sm .verify-check-mark {
    font-size: 13px;
}

/* Card kanban verificada: borde verde + fondo sutil */
.kanban-card.is-verified {
    background: #f0fdf4;
    border-color: #86efac;
}


/* Sección verificación en order-detail.php */
.verify-detail-box {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
    background: #fafaf9;
}
.verify-detail-box.is-on {
    background: #f0fdf4;
    border-color: #86efac;
}
.verify-detail-box.is-off {
    background: #fffbeb;
    border-color: #fde68a;
}
.verify-detail-icon {
    font-size: 28px;
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #16a34a;
    color: #fff;
    border-radius: 50%;
    font-weight: 800;
    flex-shrink: 0;
}
.verify-detail-title {
    font-size: 15px; font-weight: 700; color: #1f1b2e;
    margin-bottom: 4px;
}
.verify-detail-meta {
    font-size: 13px; color: #6b7280;
}
.verify-detail-note {
    margin-top: 6px;
    font-size: 13px;
    color: #4b5563;
    background: rgba(255, 255, 255, 0.6);
    padding: 6px 10px;
    border-radius: 6px;
    font-style: italic;
}
.verify-detail-box > div { flex: 1; }
.verify-detail-box .verify-check { flex-shrink: 0; }

/* Tag verde "Recibida HH:MM · Quién" */
.verify-tag {
    display: inline-flex; align-items: center; gap: 6px;
    color: #15803d;
    font-size: 12px;
    font-weight: 600;
}
.verify-tag-meta {
    color: #6b7280;
    font-weight: 400;
    font-size: 11px;
}

/* La fila completa cuando está verificada se ve sutilmente verde */
.orders-row.is-verified {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.orders-row-time { font-size: 12px; color: #4b5563; font-variant-numeric: tabular-nums; }
.orders-row-time-meta { font-size: 10px; color: #9ca3af; margin-top: 1px; text-transform: uppercase; letter-spacing: 0.4px; }
.orders-row-action {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.orders-row-deliver-form { margin: 0; display: flex; }
.btn-deliver {
    background: #16a34a;
    color: #fff;
    border: none;
    padding: 9px 22px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
    letter-spacing: 0.2px;
}
.btn-deliver:hover { background: #15803d; box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35); }
.btn-deliver:active { transform: scale(0.97); }

/* Botón "Resolver" para órdenes en error — naranja para diferenciarlo del verde de Entregar */
.btn-resolve {
    background: #f59e0b;
    color: #fff;
    border: none;
    padding: 9px 22px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
    letter-spacing: 0.2px;
}
.btn-resolve:hover { background: #d97706; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35); }
.btn-resolve:active { transform: scale(0.97); }
.orders-row .btn-resolve {
    padding: 7px 18px;
    font-size: 12px;
}

/* Toggle Express ↔ Normal en el listado de órdenes (solo en lista_imprimir).
 * Columna propia para evitar confusión visual con la pill de tipo (DTF/UVDTF).
 * Botón GRANDE y CLARO: rojo cuando va a convertir a express, gris cuando
 * va a quitar la marca express. Texto siempre completo, sin abreviaciones
 * tipo "Express..." que podrían leerse como "es express ya".
 */
.orders-row-express-form { margin: 0; display: block; width: 100%; }
.orders-row-express-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Estilo "outlined" elegante: fondo blanco con borde y texto del color de la
 * acción, hover invierte a sólido. Es el patrón estándar de botones secundarios
 * en interfaces modernas (Stripe, Vercel, Linear). Ni pesado ni gritón. */
.btn-convert-express {
    width: 100%;
    background: #ffffff;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.3px;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.05);
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease,
                box-shadow 0.18s ease, transform 0.08s ease;
}
.btn-convert-express:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
    transform: translateY(-1px);
}
.btn-convert-express:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(220, 38, 38, 0.15); }

.btn-convert-express.is-express {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #6b7280;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn-convert-express.is-express:hover {
    background: #4b5563;
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
/* Texto estático cuando NO se puede tocar (orden ya pasó de "lista_imprimir") */
.orders-row-express-static {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #b91c1c;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.2);
    padding: 6px 12px;
    border-radius: 999px;
    text-align: center;
    margin: 0 auto;
    letter-spacing: 0.4px;
}
.orders-row-express-static-muted {
    color: #d1d5db;
    font-size: 16px;
    font-weight: 300;
    text-align: center;
    width: 100%;
}

/* Bloque dedicado al toggle Express en /order-detail.php — versión grande
 * con info contextual. Card sutil que NO compite con el contenido principal. */
.order-detail-express-block {
    margin: 16px 0 24px;
    padding: 14px 18px;
    background: #fafafa;
    border: 1px solid #eef0f3;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.order-detail-express-info {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}
.order-detail-express-info strong:first-child {
    color: #1f1b2e;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.order-detail-express-form { margin: 0; flex-shrink: 0; }
.btn-convert-express-lg {
    width: auto;
    min-width: 200px;
    padding: 9px 18px;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-radius: 9px;
}
@media (max-width: 560px) {
    .order-detail-express-block { flex-direction: column; align-items: stretch; padding: 14px; }
    .btn-convert-express-lg { min-width: 0; width: 100%; }
}

/* Header sorteable de orders — debe coincidir EXACTO con .orders-row */
.orders-header {
    display: grid;
    grid-template-columns: 88px 36px minmax(140px, 1fr) 56px 150px 110px 78px 78px 142px;
    gap: 8px;
    padding: 8px 12px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.55px;
    color: #6b7280;
    font-weight: 700;
    border-bottom: 1px solid #e5e7eb;
}

/* Pills más compactas dentro del listado de órdenes (no afecta otras pantallas). */
.orders-row .order-type-pill,
.orders-row .order-state-pill {
    font-size: 10px;
    padding: 3px 8px;
    letter-spacing: 0.3px;
}
.orders-row .btn-deliver {
    padding: 7px 18px;
    font-size: 12px;
}
.orders-row .verify-tag { font-size: 11px; }
.orders-row .verify-tag-meta { font-size: 10px; }
.orders-header a {
    color: inherit; text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px;
}
.orders-header a:hover { color: #6d28d9; }
.orders-header .sort-arrow { font-size: 10px; opacity: 0.7; }

/* Etiqueta solo visible en móvil dentro de cada celda de tiempo */
.orders-row-mobile-label { display: none; }

/* Tabla de equipo: tabla en desktop, cards en móvil */
.team-table-wrap { overflow-x: auto; }
.team-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.team-table thead tr {
    text-align: left;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}
.team-table th { padding: 10px 12px; }
.team-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.team-table tbody tr.is-disabled { opacity: 0.55; }
.team-table td { padding: 12px; vertical-align: middle; }
.team-table td.team-muted { color: #6b7280; }
.team-table td.team-last-login { font-size: 13px; }
.team-table td.team-actions { text-align: right; white-space: nowrap; }
.team-self-tag {
    display: inline-block; margin-left: 6px;
    padding: 2px 8px; background: #eef2ff; color: #4338ca;
    border-radius: 10px; font-size: 11px; font-weight: 600;
}
.team-status-on  { color: #16a34a; font-weight: 600; }
.team-status-off { color: #dc2626; font-weight: 600; }
.team-sep { color: #d1d5db; }
.team-btn-suspend    { color: #dc2626; }
.team-btn-reactivate { color: #16a34a; }

@media (max-width: 720px) {
    .team-table-wrap { overflow-x: visible; }
    .team-table, .team-table thead, .team-table tbody, .team-table tr, .team-table td {
        display: block;
        width: 100%;
    }
    .team-table thead { display: none; }
    .team-table tbody tr {
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 12px 14px;
        margin-bottom: 10px;
        box-shadow: 0 1px 3px rgba(20, 10, 45, 0.03);
    }
    .team-table td {
        padding: 6px 0;
        border: none;
        display: grid;
        grid-template-columns: 110px 1fr;
        gap: 8px;
        align-items: center;
        font-size: 14px;
    }
    .team-table td::before {
        content: attr(data-label);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #9ca3af;
        font-weight: 700;
    }
    .team-table td.team-actions {
        white-space: normal;
        border-top: 1px solid #f3f4f6;
        margin-top: 6px;
        padding-top: 10px;
        text-align: left;
    }
    .team-table td.team-last-login { font-size: 13px; }
}

/* Pantalla de detalle: grilla principal y subgrillas key-value */
.order-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 20px;
}
.order-detail-kv {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
}
@media (max-width: 720px) {
    .order-detail-grid {
        grid-template-columns: 1fr;
    }
    .order-detail-kv {
        grid-template-columns: 110px 1fr;
        gap: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 720px) {
    .orders-header { display: none; }
    .orders-row {
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "verify  id        type"
            "verify  client    client"
            "express express   express"
            "state   state     state"
            "received received  promised"
            "action  action    action";
        gap: 10px 12px;
        padding: 14px;
        align-items: center;
    }
    .orders-row > .orders-row-verify   { grid-area: verify; align-self: center; justify-self: center; }
    .orders-row > .orders-row-id       { grid-area: id; font-size: 16px; align-self: end; }
    .orders-row > .orders-row-type     { grid-area: type; justify-self: end; align-self: end; }
    .orders-row > .orders-row-client   { grid-area: client; align-self: start; }
    .orders-row > .orders-row-express-toggle { grid-area: express; }
    .orders-row > .orders-row-state    { grid-area: state; }
    .orders-row > .orders-row-received { grid-area: received; display: flex; flex-direction: column; }
    .orders-row > .orders-row-promised { grid-area: promised; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
    .orders-row > .orders-row-action {
        grid-area: action;
        border-top: 1px solid #f3f4f6;
        padding-top: 8px;
        margin-top: 4px;
        text-align: right;
    }
    /* Si la orden NO tiene botón de verificación (no es por_entregar),
       colapsamos la columna verify para no dejar un hueco vacío. */
    .orders-row:not(:has(.verify-check)) {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "id        type"
            "client    client"
            "express   express"
            "state     state"
            "received  promised"
            "action    action";
    }
    .orders-row:not(:has(.verify-check)) > .orders-row-verify { display: none; }
    .btn-convert-express { padding: 11px 12px; font-size: 12px; }
    .orders-row-mobile-label {
        display: block;
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 0.6px;
        color: #9ca3af;
        font-weight: 700;
        margin-bottom: 2px;
    }
    .orders-row-time-meta { margin-top: 0; }
    .orders-row-client a { font-size: 15px; }
}

/* ============================================================
   Pantalla Roles y permisos
   ============================================================ */
.roles-list {
    display: flex; flex-direction: column; gap: 12px;
}
.role-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.role-card:hover { border-color: #c4b5fd; }
.role-card.is-highlighted {
    border-color: #7c3aed;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.18);
}
.role-card-summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    gap: 12px;
}
.role-card-summary::-webkit-details-marker { display: none; }
.role-card-summary > div:first-child {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.role-card-counts {
    color: #6b7280;
    font-size: 13px;
}
.role-card-chev {
    color: #9ca3af;
    transition: transform 0.15s ease;
    font-size: 14px;
}
.role-card[open] .role-card-chev { transform: rotate(180deg); }
.role-card-body {
    padding: 18px 22px 22px;
    border-top: 1px solid #f3f4f6;
}

.role-form { margin: 0; }
.role-perm-group {
    margin-bottom: 16px;
    padding: 12px 14px;
    background: #f9fafb;
    border-radius: 8px;
}
.role-perm-group h4 {
    margin: 0 0 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #6b7280;
    font-weight: 700;
}

.role-perm-row {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    cursor: pointer;
}
.role-perm-row:last-child { border-bottom: none; }
.role-perm-row.is-locked { opacity: 0.55; cursor: not-allowed; }
.role-perm-row input { width: 18px; height: 18px; cursor: inherit; }
.role-perm-label { font-size: 14px; color: #1f1b2e; }
.role-perm-key {
    font-size: 11px;
    color: #9ca3af;
    background: rgba(0, 0, 0, 0.04);
    padding: 2px 7px;
    border-radius: 5px;
    font-family: 'SFMono-Regular', Menlo, monospace;
    white-space: nowrap;
}

.role-notif-row {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 12px;
    align-items: start;
    padding: 10px 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    cursor: pointer;
}
.role-notif-row:last-child { border-bottom: none; }
.role-notif-row input { width: 18px; height: 18px; margin-top: 2px; cursor: pointer; }
.role-notif-title { font-weight: 600; color: #1f1b2e; font-size: 14px; }
.role-notif-desc  { color: #6b7280; font-size: 12px; margin-top: 3px; line-height: 1.4; }

/* Órdenes entregadas: aspecto desaturado tipo "archivado" */
.orders-row.is-delivered {
    background: #f3f4f6;
    border-color: #e5e7eb;
    opacity: 0.78;
}
.orders-row.is-delivered:hover {
    opacity: 1;
    background: #f9fafb;
}
.orders-row.is-delivered .orders-row-id,
.orders-row.is-delivered .orders-row-client a {
    color: #6b7280;
}

/* ──────────────────────────────────────────── Manual de usuario */
.manual-wrap h2 {
    margin-top: 32px;
    margin-bottom: 12px;
    font-size: 22px;
    color: #1f1b2e;
    border-bottom: 2px solid rgba(124, 58, 237, 0.18);
    padding-bottom: 8px;
}
.manual-wrap h3 {
    margin-top: 24px;
    margin-bottom: 8px;
    font-size: 16px;
    color: #4c1d95;
}
.manual-wrap p { line-height: 1.6; color: #1f1b2e; }
.manual-wrap code {
    background: rgba(124, 58, 237, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #4c1d95;
}
.manual-toc {
    background: rgba(124, 58, 237, 0.06);
    border: 1px solid rgba(124, 58, 237, 0.18);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 20px 0 28px;
}
.manual-toc strong {
    display: block;
    margin-bottom: 8px;
    color: #4c1d95;
}
.manual-toc ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.9;
}
.manual-toc a {
    color: #4c1d95;
    text-decoration: none;
}
.manual-toc a:hover { text-decoration: underline; }
.manual-section { scroll-margin-top: 80px; }
.manual-figure {
    margin: 16px 0 24px;
    padding: 14px;
    background: #faf9fc;
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 12px;
}
.manual-figure img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.manual-figure figcaption {
    margin-top: 10px;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
    font-style: italic;
}
.manual-wrap details {
    margin: 12px 0;
    background: #faf9fc;
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 10px;
    padding: 10px 16px;
}
.manual-wrap details summary {
    cursor: pointer;
    font-weight: 600;
    color: #4c1d95;
    padding: 4px 0;
}
.manual-wrap details[open] summary {
    border-bottom: 1px solid rgba(124, 58, 237, 0.12);
    margin-bottom: 8px;
    padding-bottom: 8px;
}
.manual-wrap ul, .manual-wrap ol { line-height: 1.7; color: #1f1b2e; }
.manual-wrap li { margin-bottom: 4px; }

/* ─────────────────────────────────────────────────────────────────────────
 * Descarte de órdenes (solo admin): banner si está descartada, bloque
 * "Descartar" dentro del panel rojo de error, tag visual en listados,
 * panel de diagnóstico en dashboard.
 * ───────────────────────────────────────────────────────────────────── */

/* Banner gris arriba del detalle cuando la orden está descartada */
.order-discarded-banner {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-left: 4px solid #6b7280;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 18px;
    color: #374151;
}
.order-discarded-banner-head {
    display: flex; align-items: center; gap: 10px;
    font-size: 16px;
    margin-bottom: 6px;
}
.order-discarded-banner-icon { font-size: 20px; }
.order-discarded-banner-meta {
    font-size: 13px; color: #6b7280;
    margin-bottom: 6px;
}
.order-discarded-banner-reason {
    font-size: 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px 0;
}
.order-discarded-banner-note {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
    margin-top: 8px;
}
.order-discarded-banner-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}
.order-discarded-banner-form input[type="text"] {
    flex: 1; min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit; font-size: 13px;
}
.order-discarded-banner-status {
    width: 100%;
    margin-top: 6px;
    font-size: 12px;
    color: #4b5563;
}
.order-discarded-banner-status[data-state="error"] { color: #b91c1c; }
.order-discarded-banner-status[data-state="ok"]    { color: #047857; }

/* Bloque "Descartar" dentro del panel rojo de error */
.order-error-discard-block {
    margin-top: 14px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-radius: 8px;
    padding: 0;
}
.order-error-discard-block summary {
    cursor: pointer;
    padding: 10px 14px;
    font-weight: 700;
    color: #9a3412;
    list-style: none;
}
.order-error-discard-block summary::-webkit-details-marker { display: none; }
.order-error-discard-block summary::marker { display: none; }
.order-error-discard-block[open] summary {
    border-bottom: 1px solid #fdba74;
}
.order-error-discard-form {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.order-error-discard-hint {
    margin: 0;
    font-size: 13px;
    color: #7c2d12;
    line-height: 1.5;
}
.order-error-discard-form label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 12px; color: #7c2d12; font-weight: 600;
}
.order-error-discard-form input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #fdba74;
    border-radius: 8px;
    font-family: inherit; font-size: 14px;
    background: #fff;
}
.order-error-discard-form input[type="text"]:focus {
    outline: none;
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}
.order-error-discard-form .btn-danger {
    align-self: flex-start;
    padding: 8px 16px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}
.order-error-discard-form .btn-danger:hover { background: #b91c1c; }
.order-error-discard-status {
    font-size: 12px; color: #4b5563;
}
.order-error-discard-status[data-state="error"] { color: #b91c1c; }
.order-error-discard-status[data-state="ok"]    { color: #047857; }

/* Toggle "Mostrar descartadas" en la barra de filtros de /orders.php.
   Alineado con los botones Filtrar/Limpiar (mismo height, baseline al fondo). */
.orders-discarded-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    white-space: nowrap;
    padding: 0 12px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    height: 38px;
    flex: 0 0 auto;
    align-self: flex-end;
    font-weight: 600;
}
.orders-discarded-toggle input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* Wrapper de botones Filtrar + Limpiar: ambos a 38px exactos, line-height
   reseteado para evitar offsets verticales heredados del .btn-link global. */
.orders-filter-actions {
    display: inline-flex;
    align-items: stretch;
    gap: 8px;
    align-self: flex-end;
    height: 38px;
}
.orders-filter-actions .btn-primary,
.orders-filter-actions .btn-link {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin: 0;
    box-sizing: border-box;
    vertical-align: middle;
}
.orders-filter-actions .btn-primary { padding: 0 18px; }
.orders-filter-actions .btn-link {
    padding: 0 14px;
    text-decoration: none;
}

/* Tag visual de "DESCARTADA" en filas del listado */
.orders-row.is-discarded {
    opacity: 0.6;
    background: #f9fafb !important;
}
.orders-row-discarded-tag {
    display: inline-block;
    background: #4b5563;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
}

/* Tarjeta de status "Descartadas" en dashboard */
.dash-status-discarded { border-left: 3px solid #6b7280; }
.dash-status-discarded .dash-status-dot { background: #6b7280; }
.dash-status-sub {
    font-size: 11px;
    color: #6b7280;
    font-style: italic;
    margin-top: 2px;
}

/* Panel de diagnóstico operativo en dashboard */
.dash-diagnostic {
    margin-top: 24px;
}
.dash-diag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 12px;
}
.dash-diag-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.dash-diag-card-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dash-diag-card-value {
    font-size: 32px;
    font-weight: 800;
    color: #1f2937;
    margin: 8px 0 4px;
    line-height: 1;
}
.dash-diag-card-value-text {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 8px 0 4px;
    line-height: 1.3;
}
.dash-diag-card-meta {
    font-size: 12px;
    color: #6b7280;
}
.dash-diag-card-extra {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
    font-size: 12px;
    color: #4b5563;
}
.dash-diag-reasons,
.dash-diag-corrections {
    list-style: none;
    padding: 0; margin: 4px 0 0;
}
.dash-diag-reasons li,
.dash-diag-corrections li {
    padding: 2px 0;
    font-size: 12px;
}
.dash-diag-reasons li strong { color: #4338ca; }
.dash-diag-corrections li strong { color: #4338ca; }

/* ─────────────────────────────────────────────────────────────────────────
 * Buscador del manual + TOC dinámico anidado + highlight de matches
 * ───────────────────────────────────────────────────────────────────── */

/* Caja de búsqueda sticky */
.manual-search-wrap {
    position: sticky;
    top: 12px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    padding: 14px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    margin-bottom: 18px;
}
.manual-search-box {
    position: relative;
    display: flex;
    align-items: center;
}
.manual-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #6b7280;
    pointer-events: none;
}
.manual-search-input {
    width: 100%;
    padding: 10px 40px 10px 38px;
    font-size: 15px;
    font-family: inherit;
    color: #1f2937;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    box-sizing: border-box;
}
.manual-search-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.manual-search-input::-webkit-search-cancel-button { display: none; }
.manual-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    color: #6b7280;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.manual-search-clear:hover { background: #e5e7eb; color: #1f2937; }
.manual-search-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: baseline;
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
}
.manual-search-count { font-weight: 600; color: #4338ca; }
.manual-search-tip { flex: 1; min-width: 200px; }
.manual-search-tip code {
    background: #f3f4f6;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
    color: #4338ca;
}

/* TOC dinámico anidado */
.manual-toc-dyn .toc-list {
    list-style: none;
    padding-left: 0;
    margin: 8px 0 0;
}
.manual-toc-dyn .toc-section {
    margin: 10px 0;
}
.manual-toc-dyn .toc-section > a {
    font-weight: 700;
    color: #4338ca;
    text-decoration: none;
    font-size: 14px;
}
.manual-toc-dyn .toc-section > a:hover { text-decoration: underline; }
.manual-toc-dyn .toc-sub {
    list-style: none;
    padding-left: 14px;
    margin: 4px 0 8px;
    border-left: 2px solid #ede9fe;
}
.manual-toc-dyn .toc-sub li { margin: 2px 0; }
.manual-toc-dyn .toc-sub a {
    color: #6b21a8;
    text-decoration: none;
    font-size: 13px;
    display: block;
    padding: 3px 0;
    line-height: 1.4;
}
.manual-toc-dyn .toc-sub a:hover {
    text-decoration: underline;
    color: #4c1d95;
}

/* Resaltado de matches en el body */
mark.search-hl {
    background: #fef08a;
    color: #1f2937;
    padding: 0 3px;
    border-radius: 3px;
    font-weight: 600;
}

/* Panel "sin resultados" */
.manual-no-results {
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 16px 18px;
    margin: 18px 0;
    color: #92400e;
    font-size: 14px;
}
.manual-no-results p { margin: 0; }
.manual-no-results-q { font-weight: 700; }

/* Mobile: el search wrap mantiene el sticky pero el meta se compacta */
@media (max-width: 640px) {
    .manual-search-tip { font-size: 11px; }
    .manual-toc-dyn .toc-sub a { font-size: 12px; }
}

/* ──────────────────────────────────────────────────────────────────────────
 * Modal de "Reportar error" (support ticket — Fase A)
 * ────────────────────────────────────────────────────────────────────── */
.support-ticket-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9998;
    animation: supportTicketFadeIn 0.15s ease-out;
}
.support-ticket-modal {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    padding: 16px;
    animation: supportTicketSlideIn 0.2s ease-out;
}
/* HTML `hidden` attribute debe ganar sobre `display: flex` de los modales
   y bloques preview que usan flex/grid. Sin esto, el modal estaría visible
   al cargar la página y el preview de captura mostraría "archivo.png 0 KB"
   antes de subir nada. */
.support-ticket-modal-backdrop[hidden],
.support-ticket-modal[hidden],
.support-ticket-dropzone-preview[hidden],
.support-ticket-dropzone-prompt[hidden],
.support-ticket-status[hidden] { display: none !important; }
@keyframes supportTicketFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes supportTicketSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.support-ticket-modal-card {
    background: #ffffff;
    border-radius: 14px;
    max-width: 560px;
    width: 100%;
    max-height: calc(100vh - 32px);
    display: flex; flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    overflow: hidden;
}
.support-ticket-modal-head {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
}
.support-ticket-modal-icon {
    font-size: 28px; line-height: 1;
    width: 44px; height: 44px;
    background: #ffffff;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.support-ticket-modal-titles { flex: 1; min-width: 0; }
.support-ticket-modal-title {
    margin: 0;
    font-size: 17px; font-weight: 700;
    color: #7c2d12;
}
.support-ticket-modal-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: #92400e;
    line-height: 1.45;
}
.support-ticket-modal-close {
    background: transparent;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: #92400e;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.15s;
    flex-shrink: 0;
}
.support-ticket-modal-close:hover { background: rgba(0,0,0,0.06); }

.support-ticket-form {
    padding: 18px 20px 20px;
    overflow-y: auto;
    display: flex; flex-direction: column;
    gap: 14px;
}
.support-ticket-field {
    display: flex; flex-direction: column;
    gap: 6px;
}
.support-ticket-field-label {
    font-size: 13px; font-weight: 600;
    color: #1f2937;
}
.support-ticket-field-req { color: #dc2626; }
.support-ticket-field-help {
    display: flex; justify-content: flex-end;
    font-size: 11px; color: #6b7280;
}
.support-ticket-form textarea,
.support-ticket-form input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #1f2937;
    resize: vertical;
    box-sizing: border-box;
}
.support-ticket-form textarea:focus,
.support-ticket-form input[type="text"]:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
.support-ticket-form textarea { min-height: 96px; }

/* Dropzone para captura */
.support-ticket-dropzone {
    position: relative;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    transition: border-color 0.15s, background 0.15s;
    overflow: hidden;
}
.support-ticket-dropzone.is-dragover {
    border-color: #f59e0b;
    background: #fffbeb;
}
.support-ticket-file-input {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.support-ticket-dropzone-prompt {
    padding: 22px 16px;
    display: flex; align-items: center; gap: 14px;
    color: #4b5563;
    font-size: 13px;
    text-align: left;
}
.support-ticket-dropzone-icon {
    font-size: 28px; line-height: 1;
    flex-shrink: 0;
}
.support-ticket-dropzone-hint {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}
.support-ticket-dropzone-preview {
    padding: 12px;
    display: flex; align-items: center; gap: 12px;
    background: #fff;
}
.support-ticket-dropzone-preview img {
    width: 80px; height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.support-ticket-dropzone-preview-meta {
    flex: 1; min-width: 0;
    font-size: 13px;
    color: #1f2937;
    overflow: hidden;
}
.support-ticket-dropzone-preview-meta > div:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}
.support-ticket-dropzone-remove {
    margin-top: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #dc2626;
    background: transparent;
    border: 1px solid #fecaca;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    z-index: 3;
}
.support-ticket-dropzone-remove:hover { background: #fef2f2; }

.support-ticket-status {
    padding: 10px 12px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 13px;
}
.support-ticket-status[data-state="ok"]    { background: #d1fae5; color: #065f46; }
.support-ticket-status[data-state="error"] { background: #fee2e2; color: #991b1b; }

.support-ticket-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    margin-top: 4px;
}
.support-ticket-actions .btn-primary,
.support-ticket-actions .btn-link {
    height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 0 18px;
    box-sizing: border-box;
    line-height: 1;
}
.support-ticket-actions .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile */
@media (max-width: 520px) {
    .support-ticket-modal { padding: 0; align-items: flex-end; }
    .support-ticket-modal-card { max-height: 92vh; border-radius: 14px 14px 0 0; }
    .support-ticket-modal-head { padding: 14px 16px; }
    .support-ticket-form { padding: 14px 16px 16px; }
}

/* ════════════════════════════════════════════════════════════════════════
 * Admin de tickets — vista Zendesk-style (Fase B)
 * Layout 3 columnas en desktop, stacked en móvil.
 * ══════════════════════════════════════════════════════════════════════ */
.zen-tickets-layout {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 14px;
    height: calc(100vh - 180px);
    min-height: 500px;
}

/* ── COLUMNA 1: LISTA ── */
.zen-col-list {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.zen-list-head {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    background: #fafafa;
    flex-shrink: 0;
}
.zen-list-search { margin-bottom: 10px; }
.zen-list-search input {
    width: 100%; box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
}
.zen-list-search input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.zen-list-tabs {
    display: flex; flex-wrap: wrap; gap: 4px;
}
.zen-list-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.zen-list-tab:hover { background: #f3f4f6; color: #1f2937; }
.zen-list-tab.is-active {
    background: #ede9fe;
    color: #5b21b6;
    border-color: #ddd6fe;
}
.zen-list-tab-count {
    background: rgba(0,0,0,0.06);
    padding: 1px 7px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
}
.zen-list-tab.is-active .zen-list-tab-count { background: rgba(124, 58, 237, 0.2); color: #5b21b6; }

.zen-list-items {
    flex: 1;
    overflow-y: auto;
}
.zen-list-empty {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}
.zen-list-empty-icon { font-size: 36px; margin-bottom: 8px; }
.zen-list-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}
.zen-list-item:hover { background: #fafafa; }
.zen-list-item.is-active { background: #f5f3ff; border-left: 3px solid #7c3aed; padding-left: 11px; }

.zen-priority-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}
.zen-priority-dot.is-low    { background: #d1d5db; }
.zen-priority-dot.is-normal { background: #3b82f6; }
.zen-priority-dot.is-high   { background: #f59e0b; }
.zen-priority-dot.is-urgent { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }

.zen-list-item-body { flex: 1; min-width: 0; }
.zen-list-item-subject {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}
.zen-list-item-meta {
    display: flex; justify-content: space-between; gap: 8px;
    font-size: 11px;
    color: #6b7280;
}
.zen-list-item-req {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}
.zen-list-item-age { flex-shrink: 0; }

/* ── Status badges (compartido lista + header thread) ── */
.zen-status-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    flex-shrink: 0;
}
.zen-status-badge.is-open    { background: #dbeafe; color: #1e40af; }
.zen-status-badge.is-pending { background: #fef3c7; color: #92400e; }
.zen-status-badge.is-solved  { background: #d1fae5; color: #065f46; }
.zen-status-badge.is-closed  { background: #e5e7eb; color: #4b5563; }

/* ── COLUMNA 2: THREAD ── */
.zen-col-thread {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.zen-empty-state {
    margin: auto;
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}
.zen-empty-icon { font-size: 48px; margin-bottom: 12px; }
.zen-empty-state h2 { margin: 0 0 4px; font-size: 18px; color: #4b5563; }
.zen-empty-state p { margin: 0; font-size: 13px; }

.zen-thread-head {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
    flex-shrink: 0;
}
.zen-thread-head-title h2 {
    margin: 0 0 4px;
    font-size: 18px;
    color: #1f2937;
}
.zen-thread-head-id {
    font-size: 11px;
    color: #9ca3af;
    font-family: ui-monospace, SFMono-Regular, monospace;
}

/* ── Conversación: bubbles ── */
.zen-thread {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    background: #f9fafb;
}
.zen-msg { margin-bottom: 14px; }
.zen-msg-public {
    display: flex; gap: 10px;
}
.zen-msg-public.is-requester { flex-direction: row; }
.zen-msg-public.is-admin     { flex-direction: row-reverse; }
.zen-msg-public.is-internal  { flex-direction: row-reverse; }

.zen-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.zen-avatar-lg { width: 56px; height: 56px; font-size: 18px; }

.zen-msg-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
}
.zen-msg-public.is-requester .zen-msg-bubble {
    border-bottom-left-radius: 2px;
}
.zen-msg-public.is-admin .zen-msg-bubble {
    background: #ede9fe;
    border-color: #ddd6fe;
    border-bottom-right-radius: 2px;
}
.zen-msg-public.is-internal .zen-msg-bubble {
    background: #fef3c7;
    border-color: #fde68a;
    border-bottom-right-radius: 2px;
}
.zen-msg-head {
    display: flex; align-items: baseline; gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
}
.zen-msg-name { color: #1f2937; font-size: 13px; }
.zen-msg-label {
    background: #f59e0b;
    color: #fff;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.zen-msg-time { color: #9ca3af; margin-left: auto; }
.zen-msg-body {
    color: #1f2937;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}
.zen-msg-attachments {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 8px;
}
.zen-attachment-thumb {
    display: inline-flex; flex-direction: column; align-items: center;
    text-decoration: none;
    color: #4b5563;
    font-size: 11px;
    max-width: 120px;
}
.zen-attachment-thumb img {
    width: 100px; height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    transition: border-color 0.15s, transform 0.15s;
}
.zen-attachment-thumb:hover img { border-color: #7c3aed; transform: scale(1.02); }
.zen-attachment-name {
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* System messages: línea muted centrada */
.zen-msg-system {
    text-align: center;
    margin: 10px 0;
}
.zen-msg-system-line {
    display: inline-block;
    padding: 4px 12px;
    background: #f3f4f6;
    border-radius: 9999px;
    font-size: 11px;
    color: #6b7280;
    font-style: italic;
}

/* ── Reply box ── */
.zen-reply-box {
    border-top: 1px solid #e5e7eb;
    background: #fff;
    padding: 12px 16px 14px;
    flex-shrink: 0;
}
.zen-reply-box.is-internal-mode { background: #fffbeb; border-top-color: #fde68a; }
.zen-reply-tabs {
    display: flex; gap: 6px;
    margin-bottom: 8px;
}
.zen-reply-tab {
    padding: 5px 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    font-family: inherit;
}
.zen-reply-tab.is-active {
    background: #1f2937;
    color: #fff;
    border-color: #1f2937;
}
.zen-reply-box.is-internal-mode .zen-reply-tab.is-active {
    background: #f59e0b;
    border-color: #f59e0b;
}
.zen-reply-box textarea {
    width: 100%; box-sizing: border-box;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    resize: vertical;
    min-height: 72px;
}
.zen-reply-box textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.zen-reply-actions {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 10px;
    gap: 10px;
    flex-wrap: wrap;
}
.zen-reply-actions-left, .zen-reply-actions-right {
    display: flex; align-items: center; gap: 8px;
}
.zen-reply-attach-btn {
    cursor: pointer;
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    line-height: 1;
}
.zen-reply-attach-btn:hover { background: #f9fafb; }
.zen-reply-file { display: none; }
.zen-reply-filename {
    font-size: 11px;
    color: #6b7280;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.zen-macro-select, .zen-reply-status-select {
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    background: #fff;
    color: #4b5563;
    cursor: pointer;
}
.zen-reply-actions .btn-primary {
    height: 32px;
    padding: 0 16px;
    display: inline-flex; align-items: center;
    line-height: 1;
}
.zen-reply-status-msg {
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    background: #f3f4f6;
    color: #4b5563;
}
.zen-reply-status-msg[data-state="ok"]    { background: #d1fae5; color: #065f46; }
.zen-reply-status-msg[data-state="error"] { background: #fee2e2; color: #991b1b; }

/* ── COLUMNA 3: SIDEBAR ── */
.zen-col-sidebar {
    display: flex; flex-direction: column; gap: 12px;
    overflow-y: auto;
}
.zen-sidebar-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
}
.zen-sidebar-card h4 {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
}
.zen-sidebar-card h4:not(:first-child) { margin-top: 14px; }
.zen-sidebar-requester {
    display: flex; align-items: center; gap: 12px;
}
.zen-sidebar-req-info {
    display: flex; flex-direction: column; gap: 2px;
    font-size: 13px;
}
.zen-sidebar-req-info strong { color: #1f2937; font-size: 14px; }
.zen-sidebar-req-role { color: #6b7280; font-size: 11px; }
.zen-sidebar-req-email { color: #4b5563; font-size: 11px; font-family: ui-monospace, monospace; }
.zen-sidebar-control {
    width: 100%; box-sizing: border-box;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
}
.zen-sidebar-order-link {
    display: inline-block;
    color: #7c3aed;
    font-weight: 600;
    text-decoration: none;
    font-family: ui-monospace, monospace;
}
.zen-sidebar-order-link:hover { text-decoration: underline; }
.zen-sidebar-context > div, .zen-sidebar-timestamps > div {
    font-size: 12px;
    color: #4b5563;
    margin-bottom: 4px;
    word-wrap: break-word;
}
.zen-sidebar-label { color: #9ca3af; font-size: 11px; }
.zen-sidebar-context code {
    font-size: 11px;
    background: #f3f4f6;
    padding: 1px 5px;
    border-radius: 4px;
    word-break: break-all;
}
.zen-sidebar-ua { font-size: 10px !important; line-height: 1.4; }

/* ── Mobile: stacked ── */
@media (max-width: 1024px) {
    .zen-tickets-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .zen-col-list, .zen-col-thread, .zen-col-sidebar { max-height: none; }
    .zen-msg-bubble { max-width: 88%; }
}

/* ─────────────────────────────────────────────────────────────
   /orders.php — responsive layout (desktop + mobile)
   ───────────────────────────────────────────────────────────── */

/* Panel principal: 94% del ancho en desktop (subido de 90% el 4 jun
   para dar espacio a la columna Acción y que los botones Entregar/
   Resolver error no sobresalgan del card). En mobile pasa a 100% con
   padding lateral de 15px (override del padding default 32px que se
   siente apretado en celular). */
.orders-page-panel { width: 94%; }
@media (max-width: 720px) {
    .orders-page-panel {
        width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Separadores "·" entre los chips del summary (445 ordenes · 314 DTF · …).
   En desktop visibles y discretos; en mobile se ocultan para que los
   chips queden alineados como pills sin "puntos flotantes" raros. */
.orders-summary-sep {
    color: #d1d5db;
    user-select: none;
    font-weight: 400;
}
@media (max-width: 720px) {
    .orders-summary-sep { display: none; }
    /* En mobile los chips se ven como pills uniformes con gap consistente.
       Todos los .orders-summary-link y el <strong> de "Todas"/fecha tienen
       el mismo aspecto visual: misma altura, mismo padding, mismo border. */
    .orders-summary {
        gap: 10px 8px;
        align-items: stretch;
    }
    .orders-summary > strong {
        display: inline-flex;
        align-items: center;
        padding: 4px 10px;
        border-radius: 999px;
        background: #f3f4f6;
        color: #1f1b2e;
        font-weight: 700;
        font-size: 13px;
        border: 1px solid #e5e7eb;
    }
    .orders-summary-link {
        font-size: 13px;
        padding: 4px 10px;  /* iguala el padding del <strong> */
    }
}

/* Form de filtros: en desktop sigue siendo flex wrap (como antes,
   solo se mueven los estilos inline al CSS). En mobile pasa a grid
   de 2 columnas para que los selects ocupen menos alto vertical.
   El campo "Buscar" lleva data-fullrow y ocupa ambas columnas; lo
   mismo el toggle de descartadas y los botones Filtrar/Limpiar. */
.orders-filter-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: end;
    margin-bottom: 18px;
    padding: 14px 16px;
    background: #f9fafb;
    border-radius: 10px;
}
@media (max-width: 720px) {
    .orders-filter-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        align-items: end;
    }
    /* Resetear flex-basis fijo de los .input-wrap que viene de inline styles */
    .orders-filter-form .input-wrap {
        flex: none;
        min-width: 0;
        width: 100%;
    }
    .orders-filter-form .input-wrap[data-fullrow],
    .orders-filter-form .orders-discarded-toggle,
    .orders-filter-form .orders-filter-actions {
        grid-column: 1 / -1;
    }
    /* Normalizar altura del <input type="date"> para que iguale a los
       <select>. Sin esto el browser le da una altura natural distinta
       por sus controles internos (icono calendario), y el campo Día
       sobresale visualmente del resto de la grid. */
    .orders-filter-form .input-wrap input[type="date"],
    .orders-filter-form .input-wrap select {
        box-sizing: border-box;
        height: 44px;
        padding: 10px 12px;
        font-size: 14px;
        line-height: 1.4;
    }
    /* En iOS Safari el input date sin valor se ve vacío. Le ayudamos
       con un mínimo de contenido visible mostrando "dd/mm/aaaa". */
    .orders-filter-form .input-wrap input[type="date"]::-webkit-datetime-edit {
        line-height: 1.4;
    }

    /* Separación entre órdenes: 20px en mobile para que las cards no se
       vean pegadas (en desktop se mantienen los 10px del .orders-grid). */
    .orders-grid { gap: 20px; }
}
