/* ============================================
   FEDEF WhatsApp Campaigns — Minimalista
   Colores FEDEF como acentos, no como fondos
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* FEDEF acentos (usados con moderacion) */
    --fedef-green: #379810;
    --fedef-purple: #43007A;
    --fedef-orange: #E15A2A;
    --fedef-yellow: #FFE415;

    /* Paleta neutra principal */
    --color-primary: #379810;
    --color-primary-dark: #2e800d;
    --color-primary-light: #edf7e8;
    --color-danger: #dc3545;
    --color-danger-light: #fef2f2;
    --color-warning: #f59e0b;
    --color-warning-light: #fffbeb;
    --color-success: #379810;
    --color-success-light: #edf7e8;
    --color-info: #6366f1;
    --color-info-light: #eef2ff;
    --color-secondary: #6b7280;

    /* Fondos — limpios y claros */
    --bg-body: #f9fafb;
    --bg-white: #ffffff;
    --bg-sidebar: #111827;
    --bg-sidebar-hover: #1f2937;

    /* Texto */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --text-white: #ffffff;
    --text-sidebar: #9ca3af;

    /* UI */
    --border-color: #e5e7eb;
    --border-radius: 8px;
    --border-radius-sm: 6px;
    --sidebar-width: 240px;
    --sidebar-collapsed: 60px;
    --navbar-height: 56px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
    --transition: all 0.15s ease;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }

/* ---- Iconos SVG (Lucide-style) ---- */
.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    stroke-width: 2;
}
.icon-muted { color: var(--text-secondary); opacity: 0.7; }
.btn .icon { vertical-align: -0.15em; }
body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout ---- */
html, body { overflow-x: hidden; max-width: 100%; }
.app-body { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100; transition: var(--transition);
    overflow-y: auto;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); overflow-x: hidden; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .logo-img,
.sidebar.collapsed .sidebar-logo { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .sidebar-toggle { margin: 0; }

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
}
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none;
    min-width: 0; flex: 1; overflow: hidden;
}
.logo-img {
    height: 30px; width: auto; flex-shrink: 0;
    max-width: 100%;
    background: #fff;
    padding: 3px 6px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    object-fit: contain;
}
.logo-text {
    font-size: 12px; font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.4px; text-transform: uppercase;
    white-space: nowrap;
}

.sidebar-toggle {
    background: none; border: none; color: #6b7280;
    cursor: pointer; font-size: 16px; padding: 4px;
}
.sidebar-toggle:hover { color: #fff; }

.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav ul { list-style: none; }

.nav-section {
    font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px;
    color: #4b5563; padding: 20px 16px 6px; font-weight: 600;
}

.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px; color: var(--text-sidebar);
    transition: var(--transition); border-left: 2px solid transparent;
    text-decoration: none; font-size: 13px; font-weight: 500;
}
.nav-link:hover { background: var(--bg-sidebar-hover); color: #d1d5db; text-decoration: none; }
.nav-link.active {
    background: rgba(55,152,16,0.08);
    color: #4ade80;
    border-left-color: var(--fedef-green);
}
.nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-support-link {
    /* Enlace de soporte arriba del badge de rol. Margenes negativos para
       "absorber" el padding del .sidebar-footer y que el hover se vea
       full-width como los nav-link de arriba. */
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px;
    margin: -12px -16px 10px -16px;
    color: var(--text-sidebar);
    transition: var(--transition);
    text-decoration: none;
    font-size: 12px;
    opacity: 0.75;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-support-link:hover {
    background: var(--bg-sidebar-hover);
    color: #d1d5db;
    opacity: 1;
    text-decoration: none;
}
.sidebar.collapsed .sidebar-support-link {
    /* Cuando el sidebar esta colapsado, centrar solo el icono. */
    justify-content: center;
    padding: 9px 0;
}
.user-role-badge {
    font-size: 10px; background: rgba(255,255,255,0.08);
    color: #9ca3af; padding: 3px 8px; border-radius: 10px; font-weight: 500;
}

/* ====================================================================
 * Modal de aviso de timeout de sesion.
 * Independiente del modal generico (.modal-overlay / .modal-container)
 * para evitar choques de z-index y handlers de cierre. Tiene su propio
 * overlay y se cierra solo via los botones (no clic afuera ni Escape —
 * la accion debe ser explicita).
 * ==================================================================== */
.session-timeout-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;  /* arriba de cualquier otro modal */
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    animation: session-fade-in 0.15s ease-out;
}
.session-timeout-overlay.hidden { display: none; }

.session-timeout-box {
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    max-width: 440px; width: 100%;
    overflow: hidden;
    border-top: 4px solid #f59e0b;  /* amarillo de advertencia */
}

.session-timeout-header {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 22px 12px;
}
.session-timeout-header h3 {
    margin: 0; font-size: 16px; color: #1f2937;
}
.session-timeout-icon {
    color: #f59e0b; display: inline-flex;
}

.session-timeout-body {
    padding: 8px 22px 18px;
    color: #374151;
    font-size: 14px;
}
.session-timeout-countdown {
    font-size: 38px;
    font-weight: bold;
    color: var(--fedef-green);
    font-family: "Courier New", Consolas, monospace;
    margin: 4px 0 14px;
    text-align: center;
    letter-spacing: 2px;
}
.session-timeout-help {
    color: #6b7280;
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}

.session-timeout-footer {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 14px 22px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

@keyframes session-fade-in {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

.app-main {
    flex: 1; margin-left: var(--sidebar-width);
    transition: var(--transition);
    display: flex; flex-direction: column; min-height: 100vh;
    min-width: 0; /* Critico: evita que hijos flex grandes empujen el layout */
}
.sidebar.collapsed ~ .app-main { margin-left: var(--sidebar-collapsed); }

.navbar {
    height: var(--navbar-height);
    background: #fff; border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.navbar-left { display: flex; align-items: center; gap: 12px; }
.navbar-toggle {
    display: none; background: none; border: none;
    font-size: 18px; cursor: pointer; color: var(--text-primary);
}
.navbar-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }

.navbar-right { display: flex; align-items: center; gap: 14px; }
.navbar-user { text-align: right; }
.user-name { display: block; font-weight: 600; font-size: 13px; }
.user-email { display: block; font-size: 11px; color: var(--text-secondary); }

.app-content {
    flex: 1; padding: 24px;
    max-width: 1200px; width: 100%; min-width: 0;
}

/* ---- Tipografia ---- */
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.page-header p { color: var(--text-secondary); font-size: 13px; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

/* ---- Botones ---- */
.btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 14px; border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: var(--transition); text-decoration: none;
    line-height: 1.4; white-space: nowrap; font-family: var(--font-family);
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--fedef-green); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-success { background: var(--fedef-green); color: #fff; }
.btn-success:hover { background: var(--color-primary-dark); }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--color-warning); color: #fff; }
.btn-warning:hover { background: #d97706; }

.btn-outline { background: #fff; color: var(--text-primary); border-color: var(--border-color); }
.btn-outline:hover { background: var(--bg-body); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ---- Badges ---- */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 500; letter-spacing: 0.2px;
}
.badge-primary { background: var(--color-info-light); color: var(--color-info); }
.badge-success { background: var(--color-success-light); color: var(--color-success); }
.badge-danger { background: var(--color-danger-light); color: var(--color-danger); }
.badge-warning { background: var(--color-warning-light); color: #92400e; }
.badge-info { background: var(--color-info-light); color: var(--color-info); }
.badge-secondary { background: #f3f4f6; color: #6b7280; }
.badge-muted { background: #f3f4f6; color: #9ca3af; }
.badge-draft { background: #f3f4f6; color: #6b7280; border: 1px dashed #d1d5db; }
.badge-sending { background: var(--color-warning-light); color: #92400e; animation: pulse-bg 1.5s ease infinite; }
@keyframes pulse-bg { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

/* ---- Cards ---- */
.card {
    background: #fff; border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden; /* Preserva las esquinas redondeadas cuando el body tiene scroll */
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border-color);
    gap: 10px; flex-wrap: wrap;
}
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-body { padding: 18px; overflow-x: auto; }

/* ---- Tablas ---- */
/* Con overflow-x:auto en .card-body, las tablas que no caben scrollean
   DENTRO del card sin empujar el layout de la pagina. */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 10px 12px; text-align: left;
    border-bottom: 1px solid var(--border-color); font-size: 13px;
}
.table th { white-space: nowrap; }
.table td a { word-break: break-word; }
.table th {
    font-weight: 600; color: var(--text-secondary); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.4px; background: #fafafa;
}
.table tbody tr:hover { background: #fafafa; }
.table td a { font-weight: 500; }
.table-actions { display: flex; gap: 6px; }

/* Empty */
.empty-state { text-align: center; padding: 44px 20px; color: var(--text-secondary); }
.empty-state-icon { font-size: 36px; margin-bottom: 10px; opacity: 0.25; }
.empty-state p { margin-bottom: 8px; }
.empty-state p:last-of-type { margin-bottom: 14px; }
.empty-state .btn { margin-top: 4px; }

/* ---- Formularios ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 13px; }
.form-hint { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm); font-size: 13px;
    font-family: var(--font-family); transition: var(--transition);
    background: #fff; color: var(--text-primary);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--fedef-green);
    box-shadow: 0 0 0 3px rgba(55,152,16,0.08);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; }
.form-error { font-size: 12px; color: var(--color-danger); margin-top: 4px; }
.form-input.input-error, .form-select.input-error {
    border-color: var(--color-danger); box-shadow: 0 0 0 3px rgba(220,53,69,0.06);
}
.form-required::after { content: " *"; color: var(--color-danger); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-color); }

/* ---- Alertas ---- */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: var(--border-radius-sm);
    margin-bottom: 14px; font-size: 13px;
}
.alert-success { background: var(--color-success-light); color: #166534; }
.alert-danger { background: var(--color-danger-light); color: #991b1b; }
.alert-warning { background: var(--color-warning-light); color: #92400e; }
.alert-info { background: var(--color-info-light); color: #3730a3; }
.alert-icon { font-size: 15px; flex-shrink: 0; }
.alert-close { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 16px; opacity: 0.4; }
.alert-close:hover { opacity: 1; }

/* ---- Paginacion ---- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 0; }
.pagination-link { padding: 5px 12px; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); font-size: 13px; }
.pagination-link:hover { background: #fafafa; text-decoration: none; }
.pagination-link.disabled { opacity: 0.35; pointer-events: none; }
.pagination-info { font-size: 12px; color: var(--text-secondary); }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 200; }
.modal-container { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 201; pointer-events: none; }
.modal { background: #fff; border-radius: var(--border-radius); box-shadow: var(--shadow-lg); padding: 24px; min-width: 340px; max-width: 480px; pointer-events: auto; }
.modal-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.modal-body { color: var(--text-secondary); margin-bottom: 18px; font-size: 13px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.hidden { display: none !important; }

/* ---- Info tip (tooltip contextual de ayuda) ---- */
.info-tip-wrapper {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 4px;
}
.info-tip {
    background: none; border: none;
    padding: 2px; cursor: pointer;
    color: #9ca3af;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: color 0.15s ease, background 0.15s ease;
    line-height: 1;
}
.info-tip:hover,
.info-tip-wrapper.is-open .info-tip {
    color: var(--fedef-green);
    background: rgba(55, 152, 16, 0.08);
}
.info-tip:focus-visible {
    outline: 2px solid var(--fedef-green);
    outline-offset: 2px;
}
.info-tip-popup {
    /* Posicion exacta la pone el JS. Fixed evita que el overflow de cards
       clippee el popup. Se muestra con opacity + visibility para animar. */
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    max-width: calc(100vw - 20px);
    background: #1f2937;
    color: #f9fafb;
    padding: 10px 13px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    pointer-events: none;
    white-space: normal;
}
.info-tip-popup strong { color: #fff; font-weight: 600; }
.info-tip-popup em { color: #d1d5db; font-style: italic; }
.info-tip-popup a {
    color: #86efac;
    text-decoration: underline;
}
/* Flecha del popup — apunta hacia abajo cuando el popup está arriba del icono */
.info-tip-popup::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: var(--tip-arrow-x, 50%);
    transform: translateX(-50%);
    width: 0; height: 0;
    border: 6px solid transparent;
    border-top-color: #1f2937;
    border-bottom: 0;
}
.info-tip-popup.info-tip-popup-below::after {
    bottom: auto;
    top: -6px;
    border-top: 0;
    border-bottom: 6px solid #1f2937;
}

/* Show on hover (desktop) Y on .is-open (click/keyboard) */
.info-tip-wrapper:hover .info-tip-popup,
.info-tip-wrapper.is-open .info-tip-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
    .info-tip-popup { transition: none; transform: none; }
}

/* ---- Alerta enriquecida (con pasos y escalacion) ---- */
.alert-rich {
    border: 1px solid;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 18px;
    background: #fff;
}
.alert-rich-danger  { border-color: #fecaca; background: #fef2f2; }
.alert-rich-warning { border-color: #fcd34d; background: #fffbeb; }
.alert-rich-info    { border-color: #c7d2fe; background: #eef2ff; }

.alert-rich-header {
    display: flex; gap: 12px; align-items: flex-start;
    margin-bottom: 12px;
}
.alert-rich-icon { flex-shrink: 0; margin-top: 1px; }
.alert-rich-danger  .alert-rich-icon { color: var(--color-danger); }
.alert-rich-warning .alert-rich-icon { color: var(--color-warning); }
.alert-rich-info    .alert-rich-icon { color: var(--color-info); }

.alert-rich-headline { flex: 1; min-width: 0; }
.alert-rich-title {
    display: block;
    font-size: 14px;
    color: #1a1a2e;
    margin-bottom: 2px;
}
.alert-rich-desc {
    font-size: 13px;
    color: #444;
    line-height: 1.5;
    margin: 2px 0 0;
}

.alert-rich-section {
    background: rgba(255, 255, 255, 0.65);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
}
.alert-rich-section-title {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 6px;
}
.alert-rich-steps {
    margin: 0;
    padding-left: 20px;
    font-size: 12.5px;
    color: #333;
    line-height: 1.7;
}

.alert-rich-footer {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 10px 14px;
    padding-top: 10px;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
    font-size: 11.5px;
    color: #555;
}
.alert-rich-support-text { flex: 1; min-width: 180px; }
.alert-rich-code code {
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 2px 7px;
    border-radius: 4px;
    font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
    color: #333;
    user-select: all;
}
.alert-rich-link {
    display: inline-flex; align-items: center; gap: 4px;
    color: var(--fedef-green);
    text-decoration: none;
    font-weight: 600;
}
.alert-rich-link:hover { text-decoration: underline; }

/* ---- Page loader (operaciones largas) ---- */
.page-loader {
    position: fixed; inset: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(2px);
    z-index: 300;
    display: flex; align-items: center; justify-content: center;
}
.page-loader-box {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 24px 32px;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    min-width: 220px;
}
.page-loader-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--color-info-light);
    border-top-color: var(--fedef-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.page-loader-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    text-align: center;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .page-loader-spinner { animation-duration: 2s; }
}

/* ---- Stats ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
    background: #fff; border: 1px solid var(--border-color);
    border-radius: var(--border-radius); padding: 18px;
    display: flex; align-items: center; gap: 14px;
}
.stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.stat-icon-blue { background: var(--color-info-light); color: var(--color-info); }
.stat-icon-green { background: var(--color-success-light); color: var(--color-success); }
.stat-icon-purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon-orange { background: #fff7ed; color: #ea580c; }
.stat-value { display: block; font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-label { display: block; font-size: 12px; color: var(--text-secondary); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-link {
    display: flex; align-items: center; gap: 8px;
    padding: 11px; border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: var(--transition); font-size: 13px;
    color: var(--text-primary); font-weight: 500;
}
.quick-link:hover { background: #fafafa; text-decoration: none; border-color: #d1d5db; }
.quick-link-icon { font-size: 16px; }

.breadcrumb { display: flex; gap: 6px; font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; }
.breadcrumb a { color: var(--color-primary); }
.breadcrumb span { opacity: 0.4; }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.toolbar-search { display: flex; gap: 6px; align-items: center; }
.toolbar-search label { display: flex; align-items: center; font-size: 13px; cursor: pointer; }
.toolbar-search input[type="checkbox"] { margin-right: 4px; }
.toolbar-actions { display: flex; gap: 6px; }

.detail-table th { background: transparent; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text-secondary); font-weight: 500; vertical-align: top; }
.detail-table td { font-size: 13px; }

/* Template preview */
.template-preview { background: #ece5dd; border-radius: var(--border-radius); padding: 14px; max-width: 360px; }
.preview-header { background: #fff; border-radius: 8px 8px 0 0; padding: 10px 12px; font-size: 13px; }
.preview-body { background: #fff; padding: 10px 12px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.preview-header + .preview-body { border-radius: 0; }
.preview-body:first-child { border-radius: 8px 8px 0 0; }
.preview-footer { background: #fff; padding: 6px 12px 10px; font-size: 11px; color: var(--text-secondary); border-radius: 0 0 8px 8px; }
.preview-body:last-child { border-radius: 0 0 8px 8px; }
.preview-body:only-child { border-radius: 8px; }
.preview-buttons { margin-top: 4px; display: flex; flex-direction: column; gap: 4px; }
.preview-media { display: block; text-align: center; padding: 18px; color: var(--text-secondary); font-size: 13px; }
.preview-btn { display: block; text-align: center; padding: 8px; background: #fff; border-radius: 8px; font-size: 13px; color: var(--color-info); font-weight: 500; }

input[type="file"].form-input { padding: 6px 12px; cursor: pointer; }

.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.status-dot-success { background: var(--color-success); }
.status-dot-danger { background: var(--color-danger); }
.status-dot-warning { background: var(--color-warning); }
.status-dot-info { background: var(--color-info); }
.status-dot-muted { background: #d1d5db; }

.section-divider { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border-color); }

.opt-status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 16px; font-size: 12px; font-weight: 500; }
.opt-status-active { background: var(--color-success-light); color: var(--color-success); }
.opt-status-inactive { background: var(--color-danger-light); color: var(--color-danger); }

.table tbody tr.row-error td { background: #fef2f2; }

.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}

@media(max-width:1024px){
    .grid-2{grid-template-columns:1fr}
}

@media(max-width:768px){
    .sidebar{transform:translateX(-100%);width:var(--sidebar-width)}
    .sidebar.mobile-open{transform:translateX(0)}
    .app-main{margin-left:0}
    .sidebar.collapsed ~ .app-main{margin-left:0}
    .navbar-toggle{display:block}
    .form-row{grid-template-columns:1fr}
    .stats-grid{grid-template-columns:1fr 1fr}
    .quick-links{grid-template-columns:1fr}

    /* Toolbar apilada verticalmente en movil */
    .toolbar{flex-direction:column;align-items:stretch}
    .toolbar-search{flex-wrap:wrap;width:100%}
    .toolbar-search .form-input{flex:1;min-width:0;width:auto !important}
    .toolbar-actions{flex-wrap:wrap;justify-content:flex-end}

    /* Page header sin romper */
    .page-header h2{font-size:18px}

    /* Breadcrumb mas compacto */
    .breadcrumb{flex-wrap:wrap;font-size:11px}
}

@media(max-width:480px){
    .stats-grid{grid-template-columns:1fr}
    .app-content{padding:14px}
    .navbar{padding:0 12px}
    .navbar-user{display:none}
    .navbar-title{font-size:14px}

    /* Cards sin borde redondeado al borde para aprovechar ancho */
    .app-content .card{margin-left:-2px;margin-right:-2px}

    /* Botones con texto mas corto si se puede */
    .btn{padding:7px 10px;font-size:12px}
    .btn-sm{padding:4px 8px;font-size:11px}

    /* Tabla mas compacta */
    .table th,.table td{padding:8px 10px;font-size:12px}
}

/* ============================================================
   Params dinámicos en formulario de crear/editar campaña
   ============================================================ */
.form-divider{
    border-top:1px solid #e5e7eb;
    margin:1.5rem 0 1.25rem;
}
.form-section-title{
    font-size:15px;
    font-weight:600;
    margin:0 0 0.25rem;
    color:#1f2937;
}
.param-block{
    background:#f9fafb;
    border:1px solid #e5e7eb;
    border-radius:8px;
    padding:14px 16px;
    margin-bottom:14px;
}
.param-block-header{
    margin-bottom:10px;
}
.param-block-header strong{
    display:block;
    font-size:13px;
    color:#374151;
    text-transform:uppercase;
    letter-spacing:0.03em;
}
.param-preview{
    margin-top:4px;
    font-style:italic;
    color:#6b7280;
    font-size:12px;
    white-space:pre-wrap;
}
.param-row{
    margin-bottom:10px;
    padding-bottom:10px;
    border-bottom:1px dashed #e5e7eb;
}
.param-row:last-child{
    border-bottom:none;
    margin-bottom:0;
    padding-bottom:0;
}
.param-row .form-label{
    font-weight:600;
    margin-bottom:4px;
}
.param-row-controls{
    display:flex;
    gap:14px;
    margin-bottom:6px;
}
.param-radio{
    display:inline-flex;
    align-items:center;
    gap:4px;
    font-size:12px;
    color:#4b5563;
    cursor:pointer;
}
.param-radio input{
    margin:0;
}

/* Helper de alineación a la derecha — usado en tablas de costos */
.text-right { text-align: right; }
