/* ══════════════════════════════════════════════════════════
   MarketingOS — Estilos principales
   ══════════════════════════════════════════════════════════ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-bg: #eef2ff;
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --info: #3b82f6;
    --info-bg: #dbeafe;

    --sidebar-bg: #1e1b4b;
    --sidebar-hover: #312e81;
    --sidebar-active: #4338ca;
    --sidebar-text: #c7d2fe;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;

    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 0.95rem; }

/* ══════════════════════════════════════════════════════════
   LOGIN / REGISTRO
   ══════════════════════════════════════════════════════════ */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    padding: 2rem;
}
.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}
.auth-card .logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-card .logo h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.5px;
}
.auth-card .logo h1 span { color: var(--primary-light); }
.auth-card .logo p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}
.auth-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

/* ══════════════════════════════════════════════════════════
   FORMULARIOS
   ══════════════════════════════════════════════════════════ */
.form-group {
    margin-bottom: 1.15rem;
}
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a3b8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; }

/* ── Botones ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition);
    text-decoration: none !important;
    white-space: nowrap;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-bg); }
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

.btn-icon {
    width: 36px; height: 36px;
    padding: 0; display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════════
   LAYOUT SPA
   ══════════════════════════════════════════════════════════ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}
.sidebar-header h1 span { color: var(--primary-light); }
.sidebar-header .agency-name {
    font-size: 0.75rem;
    color: var(--sidebar-text);
    margin-top: 0.2rem;
    opacity: 0.7;
}
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}
.nav-section {
    padding: 0 0.75rem;
    margin-bottom: 0.75rem;
}
.nav-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(199,210,254,0.4);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none !important;
}
.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer .nav-item { color: rgba(199,210,254,0.6); }

/* ── Main Content ────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.top-bar h2 {
    font-size: 1.15rem;
    font-weight: 700;
}
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.page-content {
    padding: 2rem;
}

/* ══════════════════════════════════════════════════════════
   TARJETAS / CARDS
   ══════════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.card-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Stats Cards ─────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon.primary { background: var(--primary-bg); color: var(--primary); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.info { background: var(--info-bg); color: var(--info); }
.stat-icon svg { width: 24px; height: 24px; }
.stat-info h4 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}
.stat-info p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* ══════════════════════════════════════════════════════════
   TABLAS
   ══════════════════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
}
thead th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child { border-bottom: none; }

/* ══════════════════════════════════════════════════════════
   BADGES / TAGS
   ══════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-success { background: var(--success-bg); color: #065f46; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-danger { background: var(--danger-bg); color: #991b1b; }
.badge-info { background: var(--info-bg); color: #1e40af; }
.badge-primary { background: var(--primary-bg); color: #3730a3; }
.badge-muted { background: #f1f5f9; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s ease;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.5rem; line-height: 1; padding: 0;
    cursor: pointer; transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ══════════════════════════════════════════════════════════
   PIPELINE
   ══════════════════════════════════════════════════════════ */
.pipeline-stepper {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1rem 0.5rem;
}
.pipeline-step {
    flex: 1;
    min-width: 120px;
    position: relative;
    text-align: center;
    padding: 0 0.25rem;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.pipeline-step:hover { transform: translateY(-2px); }
.pipeline-step::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border);
    transition: background 0.3s;
}
.pipeline-step:last-child::after { display: none; }
.step-circle {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.4rem;
    position: relative;
    z-index: 2;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}
.pipeline-step.completed .step-circle {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.pipeline-step.completed::after { background: var(--success); }
.pipeline-step.active .step-circle {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.pipeline-step.active::after { background: linear-gradient(90deg, var(--primary), var(--border)); }
.pipeline-step.validated .step-circle {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.pipeline-step.validated::after { background: var(--success); }
.pipeline-step.locked .step-circle {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #cbd5e1;
}
.step-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
}
.pipeline-step.locked .step-label { color: var(--text-muted); }

/* ── Phase Cards (compact) ───────────────────────────────── */
.phase-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, border-color 0.2s;
}
.phase-card:hover { box-shadow: var(--shadow-md); }
.phase-card.phase-active { border-left: 3px solid var(--primary); }
.phase-card.phase-completed { border-left: 3px solid var(--success); }
.phase-card.phase-validated { border-left: 3px solid var(--success); }
.phase-card.phase-locked { opacity: 0.65; }
.phase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
}
.phase-header h4 { font-size: 0.92rem; font-weight: 600; margin: 0; }
.phase-header .phase-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }

/* Phase summary (compact preview) */
.phase-summary {
    padding: 0 1rem 0.75rem;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
}
.phase-summary:hover { color: var(--text); }

/* Phase action bar (compact) */
.phase-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--border);
    align-items: center;
    flex-wrap: wrap;
    background: #fafbfc;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Phase output in modal (full content) */
.phase-output-full {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text);
}
.phase-output-full h3 { margin: 1rem 0 0.5rem; color: var(--primary-dark); font-size: 1.05rem; }
.phase-output-full h4 { margin: 0.8rem 0 0.4rem; color: var(--primary); font-size: 0.95rem; }
.phase-output-full h5 { margin: 0.6rem 0 0.3rem; color: var(--primary); font-size: 0.88rem; }
.phase-output-full li { margin-left: 1.2rem; margin-bottom: 0.2rem; }
.phase-output-full strong { color: var(--text); }
.phase-output-full pre.code-block {
    background: #1e293b;
    color: #e6edf3;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.5;
    margin: 0.5rem 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.phase-output-full code.inline-code {
    background: rgba(99,102,241,0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;
    color: var(--primary-dark);
}
.phase-output-meta {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.phase-output-meta span { display: inline-flex; align-items: center; gap: 0.25rem; }

/* Phase user inputs section */
.phase-user-inputs {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

/* Phase modal extra wide */
.modal.modal-phase { max-width: 820px; }

/* PDF download button */
.btn-pdf {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-pdf:hover { background: #b91c1c; }

/* ══════════════════════════════════════════════════════════
   API KEY CARDS
   ══════════════════════════════════════════════════════════ */
.provider-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}
.provider-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    position: relative;
    transition: all var(--transition);
}
.provider-card:hover { box-shadow: var(--shadow-md); }
.provider-card .provider-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.provider-card .provider-logo .icon-circle {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}
.provider-openai .icon-circle { background: #10a37f; }
.provider-anthropic .icon-circle { background: #d97706; }
.provider-google .icon-circle { background: #4285f4; }
.provider-card .provider-name { font-weight: 700; font-size: 1.05rem; }
.provider-card .provider-desc { font-size: 0.82rem; color: var(--text-secondary); }
.provider-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
}
.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid;
    min-width: 300px;
    max-width: 420px;
    animation: toastIn 0.3s ease;
    font-size: 0.88rem;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
.toast.warning { border-left-color: var(--warning); }
.toast-exit { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ══════════════════════════════════════════════════════════
   SPINNER
   ══════════════════════════════════════════════════════════ */
.spinner {
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
.spinner-dark {
    border-color: rgba(0,0,0,0.1);
    border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    gap: 1rem;
}

/* ══════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h4 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.88rem; margin-bottom: 1.5rem; }

/* ══════════════════════════════════════════════════════════
   BRAND DNA EDITOR
   ══════════════════════════════════════════════════════════ */
.dna-fields {
    display: grid;
    gap: 1rem;
}
.dna-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}
.tag-input-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.4rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    min-height: 40px;
    cursor: text;
    transition: border-color var(--transition);
}
.tag-input-wrap:focus-within { border-color: var(--primary); }
.tag-input-wrap .tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--primary-bg);
    color: var(--primary-dark);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}
.tag-input-wrap .tag button {
    background: none; border: none; color: inherit;
    font-size: 1rem; line-height: 1; cursor: pointer; opacity: 0.6;
}
.tag-input-wrap .tag button:hover { opacity: 1; }
.tag-input-wrap input {
    border: none; outline: none; flex: 1; min-width: 80px;
    padding: 0.2rem; font-size: 0.88rem;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    padding: 0.25rem;
    cursor: pointer;
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: block; }
    .page-content { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .pipeline-stepper { flex-direction: column; }
    .pipeline-step::after { display: none; }
}

/* ══════════════════════════════════════════════════════════
   UTILIDADES
   ══════════════════════════════════════════════════════════ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }
