:root {
    /* CEMI Identity palette (crimson ancestral + gold + earth tones).
       Matches STYLE_PRESETS.cemi in js/sections.js. Users can still switch
       to the legacy XtrategIA Classic preset from Configurar Estilo. */
    --primary: #a70000;
    --primary-light: #d43f3f;
    --accent: #D9A441;
    --accent-light: #e8c06a;
    --success: #4B775A;
    --success-light: #6b9a7a;
    --warning: #A67F5B;
    --warning-light: #c4a47e;
    --danger: #8b0000;
    --purple: #2F4F6F;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'Inter', monospace;
    --gray-50: #f7fafc;
    --gray-100: #edf2f7;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e0;
    --gray-400: #a0aec0;
    --gray-500: #718096;
    --gray-600: #4a5568;
    --gray-700: #2d3748;
    --gray-800: #1a202c;
    --gray-900: #171923;
    /* Theme-specific variables (dark mode default) */
    --bg-primary: linear-gradient(135deg, var(--gray-900) 0%, var(--primary) 50%, var(--gray-800) 100%);
    --bg-card: rgba(255,255,255,0.05);
    --bg-card-hover: rgba(255,255,255,0.08);
    --bg-sidebar: rgba(0,0,0,0.3);
    --bg-input: rgba(0,0,0,0.3);
    --border-color: rgba(255,255,255,0.1);
    --border-accent: rgba(217,164,65,0.3);  /* CEMI gold at 30% */
    --text-primary: var(--gray-100);
    --text-secondary: var(--gray-400);
    --text-muted: var(--gray-500);
    --shadow-color: rgba(0,0,0,0.3);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 50%, #f7fafc 100%);
    --bg-card: rgba(255,255,255,0.9);
    --bg-card-hover: rgba(255,255,255,1);
    --bg-sidebar: rgba(255,255,255,0.95);
    --bg-input: rgba(255,255,255,0.9);
    --border-color: rgba(0,0,0,0.12);
    --border-accent: rgba(217,164,65,0.5);  /* CEMI gold at 50% */
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --shadow-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .hero { background: linear-gradient(135deg, rgba(217,164,65,0.1), rgba(167,0,0,0.1)); border-color: rgba(217,164,65,0.3); }
[data-theme="light"] .hero-title { background: linear-gradient(135deg, #1a202c, var(--primary)); -webkit-background-clip: text; background-clip: text; }
[data-theme="light"] .hero-label { color: var(--success) !important; font-weight: 600; }
[data-theme="light"] .hero-subtitle { color: #2d3748 !important; }
[data-theme="light"] span[style*="background: rgba(255,255,255,0.1)"] { background: linear-gradient(135deg, rgba(0,52,115,0.15), rgba(132,189,0,0.1)) !important; border: 1px solid rgba(0,52,115,0.2); color: #1a202c !important; }
[data-theme="light"] a[style*="background: rgba(255,255,255,0.05)"] { background: linear-gradient(135deg, rgba(132,189,0,0.12), rgba(0,52,115,0.08)) !important; border: 1px solid rgba(132,189,0,0.25); }
[data-theme="light"] a[style*="background: rgba(56,178,172"] { background: linear-gradient(135deg, rgba(56,178,172,0.2), rgba(0,52,115,0.1)) !important; border: 1px solid rgba(56,178,172,0.3); }
[data-theme="light"] .metric-card { background: linear-gradient(135deg, rgba(132,189,0,0.15), rgba(0,52,115,0.1)); }
[data-theme="light"] .sidebar-footer-card { background: linear-gradient(135deg, rgba(132,189,0,0.2), rgba(56,178,172,0.15)); }
[data-theme="light"] .sidebar-footer-label { color: var(--primary) !important; }
[data-theme="light"] .sidebar-footer-change { color: #2d3748 !important; }
[data-theme="light"] .mobile-nav-footer .text-gray-400 { color: var(--primary) !important; }
[data-theme="light"] .mobile-nav-footer div[style*="color: var(--gray-300)"] { color: #2d3748 !important; }
[data-theme="light"] .nav-item { color: #4a5568; }
[data-theme="light"] .nav-item:hover { background: rgba(132,189,0,0.15); }
[data-theme="light"] .nav-item.active { background: linear-gradient(90deg, rgba(132,189,0,0.2), transparent); color: var(--success); }
[data-theme="light"] .login-input { background: rgba(255,255,255,0.9); border-color: #cbd5e0; color: #1a202c; }
[data-theme="light"] .login-input::placeholder { color: #a0aec0; }
[data-theme="light"] .phase-card { box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
[data-theme="light"] .mobile-header { background: rgba(255,255,255,0.95); }
[data-theme="light"] .mobile-nav { background: rgba(255,255,255,0.98); }
[data-theme="light"] .hamburger span { background: #1a202c; }
[data-theme="light"] table { color: #1a202c; }
[data-theme="light"] th { background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important; color: white !important; font-weight: 600; }
[data-theme="light"] td { border-color: #e2e8f0 !important; background: rgba(255,255,255,0.7); }
[data-theme="light"] .badge { background: rgba(132,189,0,0.15); color: var(--success); }
[data-theme="light"] .text-gray-300 { color: #2d3748 !important; }
[data-theme="light"] .text-gray-400 { color: #4a5568 !important; }
[data-theme="light"] .text-gray-500 { color: #718096 !important; }
[data-theme="light"] h4[style*="color: var(--gray-400)"] { color: var(--primary) !important; }
[data-theme="light"] p[style*="color: var(--gray-400)"] { color: #2d3748 !important; }
[data-theme="light"] .text-xs.text-gray-400 { color: #2d3748 !important; }
[data-theme="light"] a[style*="background: rgba"] p { color: #2d3748 !important; }
[data-theme="light"] div[style*="background: rgba(39,103,73"] p:last-child { color: #1a202c !important; }
[data-theme="light"] div[style*="background: rgba(128,90,213"] p:last-child { color: #1a202c !important; }
[data-theme="light"] div[style*="background: rgba(26,54,93"] p:last-child { color: #1a202c !important; }
[data-theme="light"] .card { color: #1a202c; }
[data-theme="light"] .card h3, [data-theme="light"] .card h4 { color: #1a202c; }
[data-theme="light"] .card p, [data-theme="light"] .card li, [data-theme="light"] .card span { color: #2d3748; }
[data-theme="light"] .task-list li { color: #2d3748; }
[data-theme="light"] .chevron { color: var(--warning); }
[data-theme="light"] .export-bar { background: linear-gradient(135deg, rgba(132,189,0,0.08), rgba(0,52,115,0.08)); border: 1px solid rgba(0,52,115,0.15); }
[data-theme="light"] .export-bar-label { color: var(--primary); }
/* Light mode: Tasks table and form fields */
[data-theme="light"] .input-field { background: rgba(255,255,255,0.95); border-color: #cbd5e0; color: #1a202c; }
[data-theme="light"] .input-field::placeholder { color: #a0aec0; }
[data-theme="light"] .select-field { background: rgba(255,255,255,0.95); border-color: #cbd5e0; color: #1a202c; }
[data-theme="light"] #tasks-table tr { background: rgba(255,255,255,0.8); }
[data-theme="light"] #tasks-table tr:hover { background: rgba(255,255,255,0.95); }
[data-theme="light"] #tasks-table td { color: #1a202c; }
[data-theme="light"] #tasks-table .drag-handle { color: #718096 !important; }
[data-theme="light"] .status-select[data-status="completada"] { background: rgba(107, 138, 0, 0.2) !important; color: #1a202c !important; }
[data-theme="light"] .status-select[data-status="en_progreso"] { background: rgba(132, 189, 0, 0.2) !important; color: #1a202c !important; }
[data-theme="light"] .status-select[data-status="pendiente"] { background: rgba(192, 86, 33, 0.2) !important; color: #1a202c !important; }
/* Light mode: Proyectos Especiales boxes (incluye Alianzas Estratégicas) */
[data-theme="light"] #section-projects div[style*="background: rgba(0,0,0"] { background: linear-gradient(135deg, rgba(132,189,0,0.12), rgba(0,82,180,0.08)) !important; border: 1px solid rgba(132,189,0,0.25); }
[data-theme="light"] #section-projects .text-gray-500 { color: var(--primary) !important; font-weight: 600; }
[data-theme="light"] #section-projects .text-accent { color: var(--success) !important; }
[data-theme="light"] #section-projects .text-gray-400 { color: #2d3748 !important; }
[data-theme="light"] #section-projects .font-bold { color: #1a202c; }
[data-theme="light"] #section-projects .font-bold[style*="color: #68d391"] { color: #276749 !important; }
[data-theme="light"] #section-projects .font-bold[style*="color: #63b3ed"] { color: #2b6cb0 !important; }
/* Light mode: Pipeline - Leads a Explorar por Sector */
[data-theme="light"] #explore-leads-container div[style*="background: rgba(0,0,0"] { background: rgba(255,255,255,0.85) !important; border: 1px solid rgba(0,52,115,0.15); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
/* Light mode: Propuesta de Valor - Xperto MediaMax box */
[data-theme="light"] div[style*="background: rgba(26,54,93"] { background: linear-gradient(135deg, rgba(0,52,115,0.08), rgba(132,189,0,0.12)) !important; border: 1px solid rgba(0,52,115,0.2); }
[data-theme="light"] div[style*="background: rgba(26,54,93"] h3[style*="color: var(--accent)"] { color: var(--success) !important; }
[data-theme="light"] div[style*="background: rgba(26,54,93"] strong[style*="color: var(--accent)"] { color: var(--success) !important; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; transition: background 0.3s ease, color 0.3s ease; }

/* Strategy Selector */
.strategy-selector { display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-bottom: 1px solid var(--border-color); }
.strategy-selector select { flex: 1; background: var(--gray-800); border: 1px solid var(--border-color); border-radius: 6px; padding: 8px 12px; color: var(--text-primary); font-size: 13px; font-family: inherit; cursor: pointer; 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' fill='%239ca3af'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 28px; }
.strategy-selector select:hover { border-color: var(--accent); }
.mobile-strategy-selector { padding: 12px 16px; margin-bottom: 8px; }
.strategy-selector select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2); }
/* Light mode: select needs a light background and dark text + dark caret arrow for contrast. */
[data-theme="light"] .strategy-selector select { background-color: rgba(255,255,255,0.95); color: #1a202c; border-color: #cbd5e0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%234a5568'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); }
[data-theme="light"] .strategy-selector select option { color: #1a202c; background: #ffffff; }
/* Native <option> lists never inherit a coloured/muted select text legibly — the OS
   popup is white in light theme and dark in dark theme, so a grey or accent-coloured
   select text turns illegible there. Force full-contrast option text app-wide. */
select option { color: #e2e8f0; background: #1a202c; }
[data-theme="light"] select option { color: #1a202c; background: #ffffff; }
[data-theme="light"] select option:checked { background: #e2e8f0; }
.strategy-settings-btn { background: var(--gray-700); border: 1px solid var(--border-color); border-radius: 6px; padding: 8px; cursor: pointer; color: var(--gray-400); transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.strategy-settings-btn:hover { background: var(--gray-600); color: var(--text-primary); border-color: var(--accent); }

/* Strategy Manager */
.strategy-list { display: flex; flex-direction: column; gap: 8px; }
.strategy-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--gray-800); border-radius: 8px; border: 1px solid var(--border-color); transition: all 0.2s; }
.strategy-item:hover { border-color: var(--gray-600); }
.strategy-item-active { border-color: var(--accent); background: rgba(102, 126, 234, 0.1); }
.strategy-item-content { flex: 1; min-width: 0; }
.strategy-item-meta { display: flex; gap: 12px; margin-top: 4px; }
.strategy-item-actions { display: flex; gap: 8px; margin-left: 12px; }

/* Theme Toggle Switch */
.theme-toggle { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 24px; border-bottom: 1px solid var(--border-color); margin-bottom: 16px; }
.theme-toggle-label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }
.theme-switch { position: relative; width: 50px; height: 26px; }
.theme-switch input { opacity: 0; width: 0; height: 0; }
.theme-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--gray-700); border-radius: 26px; transition: 0.3s; }
.theme-slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
.theme-switch input:checked + .theme-slider { background: var(--accent); }
.theme-switch input:checked + .theme-slider:before { transform: translateX(24px); }
.theme-icons { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.theme-icon { opacity: 0.5; transition: opacity 0.3s; }
.theme-icon.active { opacity: 1; }
/* Theme Toggle in Navigation */
.theme-toggle-nav { padding: 12px 16px; margin-top: 8px; border-top: 1px solid var(--border-color); }
.theme-toggle-nav .theme-toggle { padding: 8px 12px; margin-bottom: 0; border-bottom: none; background: var(--bg-card); border-radius: 8px; }

/* Loading Overlay */
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10010; }
.loading-spinner { width: 50px; height: 50px; border: 4px solid var(--gray-700); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.login-spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--gray-500); border-top-color: var(--text-primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 16px; color: var(--gray-300); font-size: 14px; }

/* Data Management Buttons */
.data-management-buttons { display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-bottom: 1px solid var(--border-color); margin-bottom: 16px; }
.data-btn { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: all 0.2s; }
.data-btn:hover { background: var(--hover-bg); color: var(--text-primary); border-color: var(--accent); }
.data-btn svg { flex-shrink: 0; }
.data-btn-export:hover { color: var(--success); border-color: var(--success); }
.data-btn-import:hover { color: var(--info); border-color: var(--info); }

/* Data Notification Toast */
.data-notification { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: 8px; display: flex; align-items: center; gap: 12px; z-index: 10001; box-shadow: 0 4px 12px rgba(0,0,0,0.3); animation: slideIn 0.3s ease; }
.data-notification-success { background: var(--success); color: white; }
.data-notification-error { background: var(--danger); color: white; }
.data-notification-info { background: var(--info); color: white; }
.data-notification button { background: none; border: none; color: inherit; font-size: 18px; cursor: pointer; padding: 0; margin-left: 8px; opacity: 0.8; }
.data-notification button:hover { opacity: 1; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Login Screen */
.login-screen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, var(--gray-900) 0%, var(--primary) 50%, var(--gray-800) 100%); display: flex; align-items: center; justify-content: center; z-index: 9999; }
/* Landing-page refactor gave #login-screen a higher-specificity display:block
   rule (line ~3933) that was overriding this utility. !important keeps the
   hidden state sticky without reshuffling the cascade. */
.login-screen.hidden { display: none !important; }
.login-box { background: rgba(255,255,255,0.05); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; padding: 48px; width: 100%; max-width: 420px; margin: 20px; text-align: center; }
.login-logo { width: 80px; height: 80px; background: transparent; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 32px; color: white; margin: 0 auto 24px; }
.login-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.login-subtitle { color: var(--gray-400); margin-bottom: 32px; font-size: 14px; }
.login-field { margin-bottom: 16px; text-align: left; }
.login-label { display: block; font-size: 12px; color: var(--gray-400); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; }
.login-input { width: 100%; padding: 14px 16px; background: rgba(0,0,0,0.3); border: 1px solid var(--gray-600); border-radius: 12px; color: white; font-size: 16px; font-family: inherit; transition: all 0.2s; }
.login-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(132,189,0,0.2); }
.login-input::placeholder { color: var(--gray-500); }
.login-btn { width: 100%; padding: 14px 24px; background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: var(--gray-900); border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; margin-top: 8px; }
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(132,189,0,0.4); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.login-error { color: #fc8181; font-size: 13px; margin-top: 16px; display: none; }
.login-error.show { display: block; animation: shake 0.5s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.login-success { color: #68d391; font-size: 13px; margin-top: 12px; padding: 10px 14px; background: rgba(104,211,145,0.1); border: 1px solid rgba(104,211,145,0.3); border-radius: 8px; }
.forgot-password-link { display: block; text-align: center; margin-top: 12px; font-size: 13px; color: var(--accent); text-decoration: none; cursor: pointer; }
.forgot-password-link:hover { text-decoration: underline; }
.login-footer { margin-top: 32px; font-size: 12px; color: var(--gray-500); }
.login-divider { display: flex; align-items: center; margin: 20px 0; color: var(--gray-500); font-size: 13px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color); }
.login-divider span { padding: 0 12px; }
.google-login-btn { width: 100%; padding: 12px 24px; background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 12px; font-size: 15px; font-weight: 500; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 10px; }
.google-login-btn:hover { background: var(--bg-hover); border-color: var(--gray-500); transform: translateY(-1px); }
.google-login-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.google-login-btn svg { flex-shrink: 0; }

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 280px; background: var(--bg-sidebar); backdrop-filter: blur(20px); border-right: 1px solid var(--border-color); padding: 24px 0; display: flex; flex-direction: column; position: fixed; height: 100vh; overflow-y: auto; transition: background 0.3s ease; }
.logo { padding: 0 24px; margin-bottom: 32px; display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 48px; height: 48px; background: linear-gradient(135deg, var(--accent), var(--success)); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: white; overflow: hidden; }
/* When showing an image logo, drop the gradient backdrop so the image appears on a transparent canvas. */
.logo-icon.has-image { background: transparent; }

/* UI language toggle (5.45.0+) — toggles the platform UI language (independent of strategy content language) */
.ui-lang-toggle button { transition: all 0.15s; }
.ui-lang-toggle button:hover { color: var(--text-primary); border-color: var(--accent); }
.ui-lang-toggle button.active { background: rgba(132,189,0,0.18); color: var(--accent); border-color: var(--accent); }

/* ========== WORKSPACE SWITCHER (5.47.0+) ========== */
/* 5.107.0: the pills became one compact control (.nav-switch, styled in «CALM UI — navigation» at the end). */

/* Workspace filtering: hide nav-groups whose data-workspaces doesn't include the active workspace.
 * Default body class is 'workspace-todo' — shows ALL groups (back-compat). */
body.workspace-estrategia .nav-group:not([data-workspaces*="estrategia"]) { display: none; }
body.workspace-operacion  .nav-group:not([data-workspaces*="operacion"])  { display: none; }
body.workspace-comercial  .nav-group:not([data-workspaces*="comercial"])  { display: none; }
body.workspace-config     .nav-group:not([data-workspaces*="config"])     { display: none; }
/* todo (default) shows everything — no rule needed */
.logo-icon img { width: 100%; height: 100%; object-fit: contain; }
.logo-icon .logo-svg { width: 28px; height: 28px; stroke: white; stroke-width: 2; fill: none; }
.logo-initials { font-weight: 800; font-size: 18px; color: white; }
.logo-text { font-weight: 700; font-size: 18px; }
.logo-subtitle { font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: 1px; }
.nav-group { margin-top: 16px; }
.nav-group-header { padding: 8px 24px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gray-500); font-weight: 600; display: flex; align-items: center; justify-content: space-between; cursor: pointer; transition: color 0.2s; }
.nav-group-header:hover { color: var(--gray-300); }
.nav-group-chevron { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; transition: transform 0.3s ease; }
.nav-group.collapsed .nav-group-chevron { transform: rotate(-90deg); }
.nav-group-items { overflow: hidden; transition: max-height 0.3s ease, opacity 0.2s ease; max-height: 500px; opacity: 1; }
.nav-group.collapsed .nav-group-items { max-height: 0; opacity: 0; }
.nav-item { padding: 12px 24px; display: flex; align-items: center; gap: 12px; color: var(--gray-400); cursor: pointer; transition: all 0.3s; border-left: 3px solid transparent; }
.nav-group .nav-item, .nav-group-items .nav-item { padding-left: 32px; }
.nav-item:hover { background: rgba(132,189,0,0.2); transform: translateX(4px); }
.nav-item.active { background: linear-gradient(90deg, rgba(132,189,0,0.3), transparent); border-left-color: var(--accent); color: var(--accent); }
.nav-item svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; fill: none; }

/* Sidebar User Section */
.sidebar-user-section { padding: 12px 20px; border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sidebar-user-info { display: flex; align-items: center; gap: 8px; color: var(--gray-300); font-size: 13px; min-width: 0; flex: 1; }
.sidebar-user-icon { flex-shrink: 0; color: var(--gray-400); }
.sidebar-user-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout-btn { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); border-radius: 6px; color: #ef4444; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; flex-shrink: 0; }
.sidebar-logout-btn:hover { background: rgba(239,68,68,0.25); border-color: rgba(239,68,68,0.5); transform: translateY(-1px); }
.sidebar-logout-btn svg { flex-shrink: 0; }
[data-theme="light"] .sidebar-user-section { border-top-color: #e2e8f0; }
[data-theme="light"] .sidebar-user-info { color: #4a5568; }
[data-theme="light"] .sidebar-user-icon { color: #718096; }

.sidebar-footer { margin-top: auto; padding: 20px; }
.sidebar-footer-card { background: linear-gradient(135deg, rgba(132,189,0,0.15), rgba(56,178,172,0.1)); border: 1px solid rgba(132,189,0,0.3); border-radius: 12px; padding: 20px; text-align: center; }
.sidebar-footer-label { font-size: 11px; color: var(--gray-400); margin-bottom: 8px; letter-spacing: 1px; text-transform: uppercase; }
.sidebar-footer-value { font-size: 36px; font-weight: 800; font-family: var(--font-mono); color: var(--accent); }
.sidebar-footer-change { font-size: 14px; color: var(--gray-300); margin-top: 6px; font-weight: 500; }

/* Main */
.main { flex: 1; margin-left: 280px; padding: 32px; overflow-y: auto; }
.section { display: none; animation: fadeIn 0.5s ease; }
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Cards */
.card { background: var(--bg-card); backdrop-filter: blur(20px); border: 1px solid var(--border-color); border-radius: 16px; margin-bottom: 24px; transition: all 0.3s; }
.card:hover { border-color: var(--border-accent); transform: translateY(-2px); box-shadow: 0 20px 40px var(--shadow-color); }
.card-body { padding: 24px; }
.metric-card { background: linear-gradient(135deg, rgba(132,189,0,0.1), rgba(0,52,115,0.2)); border: 1px solid rgba(132,189,0,0.2); }

/* Document Sections */
.doc-section { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 32px; margin-bottom: 32px; }
.doc-section h2 { margin-top: 0; }

/* Hero */
.hero { text-align: center; margin-bottom: 48px; padding: 60px 40px; background: linear-gradient(135deg, rgba(56,178,172,0.1), rgba(26,54,93,0.2)); border-radius: 24px; border: 1px solid rgba(56,178,172,0.2); }
.hero-label { font-size: 14px; color: var(--accent); text-transform: uppercase; letter-spacing: 3px; margin-bottom: 16px; }
.hero-title { font-size: 48px; font-weight: 800; margin-bottom: 16px; background: linear-gradient(135deg, white, var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-subtitle { font-size: 18px; color: var(--gray-400); max-width: 600px; margin: 0 auto; line-height: 1.7; }

/* Grid */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-5 { grid-template-columns: repeat(3, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .grid-5 { grid-template-columns: repeat(2, 1fr); } }

/* Mobile Menu */
.mobile-header { display: none; position: fixed; top: 0; left: 0; right: 0; height: 64px; background: rgba(0,0,0,0.9); backdrop-filter: blur(20px); z-index: 1000; padding: 0 16px; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.1); }
.hamburger { width: 40px; height: 40px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; cursor: pointer; background: none; border: none; padding: 8px; }
.hamburger span { display: block; width: 24px; height: 2px; background: white; transition: all 0.3s; }
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); }
.mobile-header-actions { display: flex; align-items: center; gap: 8px; }
.mobile-data-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; color: var(--text-secondary); cursor: pointer; transition: all 0.2s; }
.mobile-data-btn:hover { background: rgba(255,255,255,0.2); color: var(--accent); border-color: var(--accent); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }
.mobile-logo { display: flex; align-items: center; gap: 10px; }
.mobile-logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent), var(--primary)); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; }
.mobile-logo-text { font-weight: 700; font-size: 16px; }
.mobile-nav-overlay { display: none; position: fixed; top: 64px; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.95); backdrop-filter: blur(20px); z-index: 999; padding: 24px; overflow-y: auto; }
.mobile-nav-overlay.active { display: block; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.mobile-nav-group { margin-top: 16px; }
.mobile-nav-group-header { padding: 8px 20px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--gray-500); font-weight: 600; }
.mobile-nav-item { padding: 14px 20px; display: flex; align-items: center; gap: 16px; color: var(--gray-300); font-size: 15px; border-radius: 12px; margin-bottom: 4px; transition: all 0.2s; }
.mobile-nav-group .mobile-nav-item { padding-left: 28px; }
.mobile-nav-item:hover, .mobile-nav-item.active { background: rgba(56,178,172,0.2); color: var(--accent); }
.mobile-nav-item svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; }
.mobile-nav-footer { margin-top: 24px; padding: 20px; background: rgba(255,255,255,0.05); border-radius: 16px; text-align: center; }
.mobile-download-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px 20px; background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: var(--gray-900); border-radius: 12px; font-weight: 600; text-decoration: none; margin-top: 16px; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; padding-top: 88px; }
    .mobile-header { display: flex; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .hero-title { font-size: 32px; }
    .hero { padding: 40px 24px; }
    /* Export bar - centered with download icon */
    .export-bar { flex-wrap: wrap; gap: 6px; justify-content: center; }
    .export-bar-label { display: none; }
    .export-bar::before { content: ''; display: block; width: 20px; height: 20px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E"); background-size: contain; background-repeat: no-repeat; margin-right: 4px; }
    /* Export buttons - icon only on mobile */
    .export-btn { padding: 10px; gap: 0; min-width: 38px; min-height: 38px; justify-content: center; }
    .export-btn .btn-text { display: none; }
    .export-btn svg { width: 16px; height: 16px; }
}

/* Typography */
h1 { font-size: 36px; font-weight: 800; margin-bottom: 8px; }
h2 { font-size: 24px; font-weight: 700; margin-bottom: 20px; }
h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
/* The global `* { margin: 0 }` reset (line ~123) strips the browser's default
   heading top margin, so a heading that follows a table or paragraph sat flush
   against it. Restore rhythm: space above every heading except the first in
   its container; components that set their own margins (modal headers, section
   heads, doc sections) keep them via their more specific rules. */
h2 { margin-top: 32px; }
h3 { margin-top: 24px; }
h2:first-child, h3:first-child, h1 + h2, h2 + h3 { margin-top: 0; }
.subtitle { color: var(--gray-400); margin-bottom: 40px; font-size: 16px; }

/* Metrics */
.metric-value { font-size: 28px; font-weight: 700; font-family: var(--font-mono); }
.metric-label { font-size: 13px; color: var(--gray-500); margin-top: 4px; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; display: inline-block; }
.badge-success { background: rgba(39,103,73,0.3); color: #68d391; }
.badge-warning { background: rgba(192,86,33,0.3); color: #f6ad55; }
.badge-danger { background: rgba(197,48,48,0.3); color: #fc8181; }
.badge-neutral { background: rgba(255,255,255,0.1); color: var(--gray-400); }
.badge-accent { background: var(--accent); color: var(--gray-900); }

/* Fuente Cards */
.fuente-card { border-top: 4px solid; }
.fuente-card.card-1 { border-top-color: var(--primary); }
.fuente-card.card-2 { border-top-color: var(--accent); }
.fuente-card.card-3 { border-top-color: var(--success); }
.fuente-card.card-4 { border-top-color: #805ad5; }
.fuente-card.card-5 { border-top-color: var(--warning); }
.fuente-card.card-6 { border-top-color: #e53e3e; }
.fuente-card.card-7 { border-top-color: #38b2ac; }
.fuente-card.card-8 { border-top-color: #ed8936; }
.fuente-card.card-9 { border-top-color: #667eea; }
.fuente-card.card-10 { border-top-color: #48bb78; }
.fuente-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.fuente-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.fuente-icon.card-1 { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }
.fuente-icon.card-2 { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: var(--gray-900); }
.fuente-icon.card-3 { background: linear-gradient(135deg, var(--success), var(--success-light)); color: white; }
.fuente-icon.card-4 { background: linear-gradient(135deg, #805ad5, #553c9a); color: white; }
.fuente-icon.card-5 { background: linear-gradient(135deg, var(--warning), var(--warning-light)); color: var(--gray-900); }
.fuente-icon.card-6 { background: linear-gradient(135deg, #e53e3e, #c53030); color: white; }
.fuente-icon.card-7 { background: linear-gradient(135deg, #38b2ac, #2c7a7b); color: white; }
.fuente-icon.card-8 { background: linear-gradient(135deg, #ed8936, #dd6b20); color: white; }
.fuente-icon.card-9 { background: linear-gradient(135deg, #667eea, #5a67d8); color: white; }
.fuente-icon.card-10 { background: linear-gradient(135deg, #48bb78, #38a169); color: white; }
.progress-bar { height: 8px; background: var(--gray-700); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress-fill.card-1 { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.progress-fill.card-2 { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.progress-fill.card-3 { background: linear-gradient(90deg, var(--success), var(--success-light)); }
.progress-fill.card-4 { background: linear-gradient(90deg, #805ad5, #553c9a); }
.progress-fill.card-5 { background: linear-gradient(90deg, var(--warning), var(--warning-light)); }
.progress-fill.card-6 { background: linear-gradient(90deg, #e53e3e, #c53030); }
.progress-fill.card-7 { background: linear-gradient(90deg, #38b2ac, #2c7a7b); }
.progress-fill.card-8 { background: linear-gradient(90deg, #ed8936, #dd6b20); }
.progress-fill.card-9 { background: linear-gradient(90deg, #667eea, #5a67d8); }
.progress-fill.card-10 { background: linear-gradient(90deg, #48bb78, #38a169); }

/* Forms */
.slider { -webkit-appearance: none; width: 100%; height: 6px; border-radius: 3px; background: var(--gray-700); outline: none; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: 0 2px 8px rgba(56,178,172,0.5); }

/* Simulator Sliders */
.sim-slider { -webkit-appearance: none; width: 100%; height: 4px; border-radius: 2px; background: var(--gray-700); outline: none; cursor: pointer; }
.sim-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: 0 2px 6px rgba(56,178,172,0.4); transition: transform 0.2s, box-shadow 0.2s; }
.sim-slider::-webkit-slider-thumb:hover { transform: scale(1.2); box-shadow: 0 2px 10px rgba(56,178,172,0.6); }
.sim-slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; box-shadow: 0 2px 6px rgba(56,178,172,0.4); }
.sim-slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--gray-700); }
[data-theme="light"] .sim-slider { background: #e2e8f0; }
[data-theme="light"] .sim-slider::-webkit-slider-thumb { background: var(--accent); box-shadow: 0 2px 6px rgba(56,178,172,0.5); }

.input-field { background: rgba(0,0,0,0.3); border: 1px solid var(--gray-600); border-radius: 8px; padding: 8px 12px; color: white; font-family: var(--font-mono); transition: all 0.2s; width: 100%; }
.input-field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,178,172,0.2); }
.select-field { background: rgba(0,0,0,0.3); border: 1px solid var(--gray-600); border-radius: 8px; padding: 6px 10px; color: white; font-size: 12px; cursor: pointer; }
.select-field:focus { outline: none; border-color: var(--accent); }
.control-group { margin-bottom: 20px; }
.control-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.control-label { color: var(--gray-400); font-size: 13px; }
.control-value { font-family: var(--font-mono); color: var(--accent); }

/* Buttons */
.btn { padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.2s; border: none; font-family: inherit; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: var(--gray-900); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(56,178,172,0.4); }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.2); }
.btn-secondary:hover { background: rgba(255,255,255,0.2); }
[data-theme="light"] .btn-secondary { background: rgba(0,0,0,0.06); color: #1a202c; border-color: rgba(0,0,0,0.15); }
[data-theme="light"] .btn-secondary:hover { background: rgba(0,0,0,0.12); }
.btn-danger { background: rgba(229,62,62,0.2); color: #fc8181; border: 1px solid rgba(229,62,62,0.3); }
.btn-danger:hover { background: rgba(229,62,62,0.4); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 8px; color: var(--gray-400); font-size: 12px; text-transform: uppercase; border-bottom: 2px solid var(--gray-700); }
td { padding: 16px 8px; border-bottom: 1px solid var(--gray-800); }
th.sortable { cursor: pointer; user-select: none; transition: all 0.2s; }
th.sortable:hover { color: var(--accent); background: rgba(132,189,0,0.1); }
th.sortable.sorted { color: var(--accent); }
th.sortable .sort-icon { margin-left: 4px; font-size: 10px; opacity: 0.6; transition: opacity 0.2s; }
th.sortable:hover .sort-icon, th.sortable.sorted .sort-icon { opacity: 1; }

/* Drag and Drop */
tr[draggable="true"] { transition: background 0.2s, opacity 0.2s, transform 0.2s; }
tr[draggable="true"]:hover .drag-handle { color: var(--accent); }
tr.dragging { opacity: 0.5; background: rgba(132,189,0,0.1); }
tr.drag-over { background: rgba(132,189,0,0.2); box-shadow: inset 0 -2px 0 var(--accent); }
.drag-handle { cursor: grab; font-size: 14px; letter-spacing: -2px; }
.drag-handle:active { cursor: grabbing; }

/* Tasks table */
.sortable-task { cursor: pointer; user-select: none; transition: all 0.2s; }
.sortable-task:hover { color: var(--accent); background: rgba(132,189,0,0.1); }
.sortable-task.sorted { color: var(--accent); }
.sortable-task .sort-icon { margin-left: 4px; font-size: 10px; opacity: 0.6; transition: opacity 0.2s; }
.sortable-task:hover .sort-icon, .sortable-task.sorted .sort-icon { opacity: 1; }
tr.task-completed { opacity: 0.6; }
tr.task-completed td { text-decoration: line-through; color: var(--gray-500); }
tr.task-completed .drag-handle, tr.task-completed .btn { text-decoration: none; }
tr.task-completed input, tr.task-completed select { text-decoration: line-through; }

/* Scenario Tabs */
.scenario-tabs { display: flex; gap: 8px; margin-bottom: 24px; background: rgba(0,0,0,0.2); padding: 8px; border-radius: 12px; }
.scenario-tab { flex: 1; padding: 12px 20px; border-radius: 8px; text-align: center; cursor: pointer; transition: all 0.3s; font-weight: 600; }
.scenario-tab:hover { background: rgba(255,255,255,0.1); }
.scenario-tab.active.optimista { background: linear-gradient(135deg, var(--success), var(--success-light)); color: var(--gray-900); }
.scenario-tab.active.conservador { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }
.scenario-tab.active.pesimista { background: linear-gradient(135deg, var(--danger), #fc8181); color: white; }

/* Propuesta de Valor tabs */
.propuesta-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.propuesta-tab { padding: 10px 20px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.3s; background: rgba(0,0,0,0.3); border: 1px solid transparent; color: var(--gray-400); }
.propuesta-tab:hover { background: rgba(255,255,255,0.1); color: var(--gray-200); }
.propuesta-tab.active { background: linear-gradient(135deg, var(--accent), var(--success)); color: var(--gray-900); border-color: transparent; }

/* Export buttons */
.export-bar { display: flex; gap: 10px; margin-bottom: 24px; padding: 16px 20px; background: linear-gradient(135deg, rgba(132,189,0,0.1), rgba(0,52,115,0.15)); border-radius: 12px; align-items: center; border: 1px solid rgba(132,189,0,0.2); }
.export-bar-label { font-size: 13px; color: var(--accent); margin-right: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.export-bar-hint { margin-left: auto; font-size: 11px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; cursor: help; max-width: 360px; line-height: 1.35; }
.export-bar-hint svg { flex-shrink: 0; opacity: 0.7; }
@media (max-width: 768px) { .export-bar-hint { margin-left: 0; flex-basis: 100%; justify-content: center; text-align: center; } }
.export-btn { padding: 10px 18px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; color: white; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.export-btn:nth-child(2) { background: linear-gradient(135deg, #e53e3e, #fc8181); } /* PDF - Red */
.export-btn:nth-child(3) { background: linear-gradient(135deg, #3182ce, #63b3ed); } /* Word - Blue */
.export-btn:nth-child(4) { background: linear-gradient(135deg, #38a169, #68d391); } /* Excel - Green */
.export-btn:nth-child(5) { background: linear-gradient(135deg, #805ad5, #b794f4); } /* HTML - Purple */
.export-btn:nth-child(6) { background: linear-gradient(135deg, #dd6b20, #f6ad55); } /* Markdown - Orange */
.export-btn:nth-child(7) { background: linear-gradient(135deg, #319795, #4fd1c5); } /* PNG - Teal */
.export-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.4); filter: brightness(1.1); }
.export-btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }

/* Charts */
.chart-bar { display: flex; align-items: flex-end; justify-content: space-around; height: 250px; padding: 0 20px; }
.bar-group { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bar { width: 60px; border-radius: 4px 4px 0 0; transition: height 0.5s ease; position: relative; }
.bar-label { font-size: 12px; color: var(--gray-400); text-align: center; }
.bar-value { font-size: 11px; font-family: var(--font-mono); color: white; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); white-space: nowrap; }

/* Line Chart */
.line-chart-container { position: relative; height: 280px; padding: 20px 0; }
.line-chart-svg { width: 100%; height: 100%; overflow: visible; }
.line-chart-path { fill: none; stroke: url(#lineGradient); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(132,189,0,0.3)); }
.line-chart-area { fill: url(#areaGradient); opacity: 0.4; }
.line-chart-dot { fill: var(--accent); stroke: var(--bg-card); stroke-width: 3; filter: drop-shadow(0 2px 8px rgba(132,189,0,0.5)); transition: r 0.2s ease, filter 0.2s ease; cursor: pointer; }
.line-chart-dot:hover { filter: drop-shadow(0 4px 12px rgba(132,189,0,0.8)); }
.line-chart-label { font-size: 12px; fill: var(--text-secondary); text-anchor: middle; }
.line-chart-value { font-size: 13px; font-family: var(--font-mono); fill: var(--text-primary); text-anchor: middle; font-weight: 600; }
.line-chart-grid { stroke: var(--border-color); stroke-width: 1; stroke-dasharray: 4 4; }
.line-chart-milestone { display: flex; flex-direction: column; align-items: center; position: absolute; transform: translateX(-50%); }
.line-chart-milestone-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg-card); box-shadow: 0 2px 8px rgba(132,189,0,0.5); }
.line-chart-milestone-label { margin-top: 8px; font-size: 11px; color: var(--text-secondary); }
.line-chart-milestone-value { font-size: 14px; font-weight: 700; font-family: var(--font-mono); color: var(--accent); }
[data-theme="light"] .line-chart-dot { stroke: white; }
[data-theme="light"] .line-chart-milestone-dot { border-color: white; }

/* Pie */
.pie-container { display: flex; align-items: center; gap: 40px; }
.pie-chart { width: 200px; height: 200px; border-radius: 50%; position: relative; display: flex; align-items: center; justify-content: center; }
.pie-center { position: absolute; width: 120px; height: 120px; background: var(--bg-card); backdrop-filter: blur(10px); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; box-shadow: 0 4px 20px var(--shadow-color); }
.pie-center-label { font-size: 10px; color: #cbd5e1; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; font-weight: 600; }
.pie-center-value { font-size: 22px; font-weight: 800; font-family: var(--font-mono); color: #a8d94e; text-shadow: 0 0 10px rgba(132,189,0,0.3); }
[data-theme="light"] .pie-center { background: rgba(255,255,255,0.95); }
[data-theme="light"] .pie-center-label { color: var(--primary); }
[data-theme="light"] .pie-center-value { color: var(--success); }
.pie-legend { flex: 1; }
.legend-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--gray-700); }
.legend-item:last-child { border-bottom: none; }
.legend-color { width: 12px; height: 12px; border-radius: 3px; margin-right: 12px; }
.legend-name { display: flex; align-items: center; }
.legend-amount { font-weight: 700; font-family: var(--font-mono); }
.legend-percent { font-size: 12px; color: var(--gray-500); }

/* Timeline */
.phase-card { border-left: 4px solid; }
.phase-card.phase-1 { border-left-color: var(--accent); }
.phase-card.phase-2 { border-left-color: var(--primary); }
.phase-card.phase-3 { border-left-color: var(--success); }
.phase-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.phase-number { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; }
.phase-number.phase-1 { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: var(--gray-900); }
.phase-number.phase-2 { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }
.phase-number.phase-3 { background: linear-gradient(135deg, var(--success), var(--success-light)); }
.phase-title { font-weight: 700; font-size: 24px; margin: 0; }
.phase-subtitle { color: var(--gray-400); font-size: 14px; }
.phase-content { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.task-list li { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--gray-300); font-size: 14px; }
.task-list .chevron { color: var(--accent); }
.task-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.task-section-title.phase-1 { color: var(--accent); }
.task-section-title.phase-2 { color: var(--primary-light); }
.task-section-title.phase-3 { color: var(--success-light); }

/* Actions */
.action-card { background: rgba(56,178,172,0.1); border-color: rgba(56,178,172,0.3); }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.action-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: rgba(0,0,0,0.2); border-radius: 8px; }
.action-day { flex-shrink: 0; }
.action-text { font-weight: 500; margin-bottom: 4px; }
.action-owner { font-size: 12px; color: var(--gray-500); }

/* Summary */
.summary-card { text-align: center; }
.summary-label { font-size: 14px; color: var(--gray-400); margin-bottom: 8px; }
.summary-value { font-size: 56px; font-weight: 800; font-family: var(--font-mono); background: linear-gradient(135deg, var(--accent), white); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.summary-status { font-size: 14px; margin-top: 8px; }
.summary-status.success { color: var(--success-light); }
.summary-status.warning { color: var(--warning); }
.summary-status.danger { color: #fc8181; }

/* Utilities */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mb-32 { margin-bottom: 32px; }
.mb-24 { margin-bottom: 24px; }
.mb-20 { margin-bottom: 20px; }
.mb-16 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 8px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent); }
.text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); }
.font-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }

/* Pie Chart Layout */
.pie-chart-layout { display: flex; align-items: center; gap: 40px; width: 100%; }
.pie-chart-circle { width: 200px; height: 200px; border-radius: 50%; box-shadow: 0 4px 20px rgba(0,0,0,0.3); flex-shrink: 0; }
.pie-chart-legend { flex: 1; min-width: 0; }

/* Simulator Pie Chart */
.sim-pie-container { margin-top: 24px; display: flex; align-items: center; gap: 24px; }
#sim-pie-chart { width: 140px; height: 140px; border-radius: 50%; background: conic-gradient(var(--gray-700) 0% 100%); flex-shrink: 0; transition: background 0.3s; }
#sim-pie-legend { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12px; }

/* Task Filters */
.task-filters-container { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.task-filters-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-filter-select { min-width: 110px; }

/* Document Table of Contents */
.doc-toc { margin-bottom: 48px; padding: 24px; background: rgba(0,0,0,0.2); border-radius: 8px; }
.doc-toc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }

/* Document Section */
.doc-section { overflow-x: auto; }
.doc-section table { min-width: 500px; }
.table-responsive { overflow-x: auto; margin: 16px 0; }

@media (max-width: 1024px) { .phase-content, .action-grid { grid-template-columns: 1fr; } .pie-container { flex-direction: column; } }
@media (max-width: 768px) {
    .pie-chart-layout { flex-direction: column; gap: 24px; }
    .pie-chart-circle { width: 180px; height: 180px; margin: 0 auto; }
    .pie-chart-legend { width: 100%; }
    #chart-fuentes-projection { height: auto !important; min-height: 0 !important; }
    /* Responsive tables */
    .card-body { overflow-x: auto; }
    table { min-width: 400px; font-size: 13px; }
    table th, table td { padding: 8px 10px; }
    /* Simulator pie chart responsive */
    .sim-pie-container { flex-direction: column; }
    #sim-pie-chart { margin: 0 auto; }
    #sim-pie-legend { grid-template-columns: 1fr 1fr; justify-items: start; }
    /* Task filters responsive */
    .task-filters-container { width: 100%; justify-content: flex-start; gap: 10px; }
    .task-filters-group { width: 100%; gap: 6px; }
    .task-filters-group > label { display: none; }
    .task-filter-select { min-width: 0; flex: 1; font-size: 12px; padding: 8px 6px; }
    #task-clear-filters { flex-shrink: 0; }
    /* Document TOC responsive */
    .doc-toc { padding: 16px; margin-bottom: 32px; }
    .doc-toc-grid { grid-template-columns: 1fr; gap: 24px; }
    /* Document section tables responsive */
    .doc-section table { font-size: 13px; min-width: 500px; }
    .doc-section table td { padding: 6px 8px !important; }
    .doc-section > div { overflow-x: auto; }
}

/* Special Projects Card */
.special-project { background: linear-gradient(135deg, rgba(85,60,154,0.2), rgba(56,178,172,0.1)); border-color: rgba(85,60,154,0.3); }

/* Pipeline priority colors */
.priority-alta { color: #fc8181; }
.priority-media { color: var(--warning-light); }
.priority-baja { color: var(--gray-400); }
.probability-high { color: var(--success-light); }
.probability-medium { color: var(--warning-light); }
.probability-low { color: #fc8181; }

/* ==================== PROSPECCION STYLES ==================== */

/* Prospeccion Tabs */
.prospeccion-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.prospeccion-tab {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
}

.prospeccion-tab:hover {
    background: rgba(132,189,0,0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.prospeccion-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--success));
    color: white;
    border-color: transparent;
    font-weight: 600;
}

/* Actividades Sub-Sub-Tabs */
.actividades-subtabs {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    width: fit-content;
}

.actividades-subtab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.2s;
}

.actividades-subtab:hover {
    background: rgba(132,189,0,0.1);
    color: var(--accent);
}

.actividades-subtab.active {
    background: var(--bg-card);
    color: var(--accent);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.actividades-subtab svg {
    width: 16px;
    height: 16px;
}

/* Prospect Card */
.prospect-card {
    transition: all 0.2s;
}

.prospect-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    background: rgba(0,0,0,0.3) !important;
}

/* Activity Card */
.activity-card {
    transition: all 0.2s;
}

.activity-card:hover {
    background: rgba(0,0,0,0.3) !important;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    /* Modal body styles if needed */
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Toast Notification */
.toast-notification {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Light theme adjustments for Prospeccion */
[data-theme="light"] .prospeccion-tabs {
    background: rgba(255,255,255,0.9);
}

[data-theme="light"] .prospeccion-tab {
    color: #4a5568;
}

[data-theme="light"] .prospeccion-tab:hover {
    color: var(--accent);
}

[data-theme="light"] .prospeccion-tab.active {
    color: white;
}

[data-theme="light"] .actividades-subtabs {
    background: rgba(0,0,0,0.05);
}

[data-theme="light"] .actividades-subtab {
    color: #4a5568;
}

[data-theme="light"] .actividades-subtab.active {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

[data-theme="light"] .prospect-card,
[data-theme="light"] .activity-card {
    background: rgba(0,0,0,0.05) !important;
}

[data-theme="light"] .prospect-card:hover,
[data-theme="light"] .activity-card:hover {
    background: rgba(0,0,0,0.08) !important;
}

[data-theme="light"] .modal-overlay {
    background: rgba(0,0,0,0.7);
}

[data-theme="light"] .modal-content {
    background: white;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

/* Responsive Prospeccion */
@media (max-width: 768px) {
    .prospeccion-tabs {
        padding: 8px;
        gap: 6px;
    }

    .prospeccion-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .actividades-subtabs {
        padding: 6px;
        gap: 4px;
    }

    .actividades-subtab {
        padding: 6px 12px;
        font-size: 12px;
    }

    .modal-content {
        padding: 16px;
        margin: 10px;
    }
}

/* ==================== ROLE-BASED RESTRICTIONS ==================== */

/* Disabled permission style - shows button as disabled with reduced opacity */
.disabled-permission {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Restricted mode (applies to viewers and guests who can't edit current strategy) */
body.restricted-mode .add-btn:not(.export-btn),
body.restricted-mode .edit-btn:not(.export-btn),
body.restricted-mode .delete-btn,
body.restricted-mode .remove-btn,
body.restricted-mode .save-btn,
body.restricted-mode .btn-add,
body.restricted-mode .btn-edit,
body.restricted-mode .btn-delete {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Disable drag handles in restricted mode */
body.restricted-mode .drag-handle,
body.restricted-mode [draggable="true"] {
    cursor: default !important;
    pointer-events: none;
}

/* Disable inline edit icons in restricted mode */
body.restricted-mode .inline-edit,
body.restricted-mode .edit-icon,
body.restricted-mode .delete-icon {
    opacity: 0.4;
    pointer-events: none;
}

/* Disable editable elements in restricted mode */
body.restricted-mode input:not([type="text"]#login-user):not([type="password"]#login-pass):not(#strategy-dropdown),
body.restricted-mode textarea,
body.restricted-mode select:not(#strategy-dropdown):not(.filter-select) {
    pointer-events: none;
    opacity: 0.7;
}

/* Keep login fields enabled */
body.restricted-mode #login-user,
body.restricted-mode #login-pass,
body.restricted-mode #login-btn {
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Keep strategy dropdown and filters enabled */
body.restricted-mode #strategy-dropdown,
body.restricted-mode .filter-select {
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Hide config/settings actions in restricted mode */
body.restricted-mode .config-actions,
body.restricted-mode .edit-actions {
    opacity: 0.4;
    pointer-events: none;
}

/* Guest-specific: Also disable exports (guests can't export) */
body.guest-mode .export-bar button,
body.guest-mode .export-btn,
body.guest-mode [onclick*="export"],
body.guest-mode [onclick*="Export"],
body.guest-mode button[onclick*="download"],
body.guest-mode button[onclick*="Download"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Guest-specific: Also disable import */
body.guest-mode [onclick*="import"],
body.guest-mode [onclick*="Import"],
body.guest-mode .import-btn {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Viewer-specific styles (can export, but can't edit) */
body.viewer-mode .export-bar button,
body.viewer-mode .export-btn {
    opacity: 1 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Hide "Nueva Estrategia" button for viewers and guests */
body.viewer-mode [onclick*="openNewStrategyWizard"],
body.guest-mode [onclick*="openNewStrategyWizard"] {
    opacity: 0.4;
    pointer-events: none;
}

/* Admin-only elements: hidden by default, shown via JS for admins */
.admin-only {
    display: none;
}

/* Role badge styling */
#role-badge {
    animation: pulse-role 3s infinite;
    transition: all 0.3s ease;
}

@keyframes pulse-role {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Legacy guest-badge support */
#guest-badge {
    animation: pulse-role 2s infinite;
}

/* ==================== ADMIN PANEL STYLES ==================== */
.admin-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.admin-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.admin-panel-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.permissions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.permissions-table th,
.permissions-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.permissions-table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-secondary);
}

.permissions-table tr:hover {
    background: var(--bg-hover);
}

.permission-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.permission-badge.admin {
    background: rgba(159,122,234,0.2);
    color: #9f7aea;
}

.permission-badge.owner {
    background: rgba(66,153,225,0.2);
    color: #4299e1;
}

.permission-badge.editor {
    background: rgba(56,178,172,0.2);
    color: #38b2ac;
}

.permission-badge.viewer {
    background: rgba(72,187,120,0.2);
    color: #48bb78;
}

.permission-badge.guest {
    background: rgba(237,137,54,0.2);
    color: #ed8936;
}

.permission-badge.public {
    background: rgba(160,174,192,0.2);
    color: #a0aec0;
}

/* User assignment dropdown */
.user-assignment-select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 13px;
    min-width: 120px;
}

/* Toggle switch for public/private */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-600);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-light);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ========================================
   GLOBAL SEARCH MODAL
   ======================================== */

.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    animation: fadeIn 0.15s ease-out;
}

.search-modal-content {
    width: 600px;
    max-width: 90vw;
    max-height: 70vh;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.search-input-wrapper .search-icon {
    width: 20px;
    height: 20px;
    stroke: var(--gray-400);
    flex-shrink: 0;
}

#global-search-input {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-color);
    outline: none;
}

#global-search-input::placeholder {
    color: var(--gray-500);
}

.search-shortcut {
    font-size: 12px;
    color: var(--gray-500);
    background: var(--gray-800);
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.search-results {
    max-height: calc(70vh - 70px);
    overflow-y: auto;
}

.search-results-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--gray-500);
}

.search-results-empty svg {
    width: 48px;
    height: 48px;
    stroke: var(--gray-600);
    margin-bottom: 12px;
}

.search-category {
    padding: 8px 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-category:last-child {
    border-bottom: none;
}

.search-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-category-header svg {
    width: 14px;
    height: 14px;
    stroke: var(--gray-500);
}

.search-result-item {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 8px;
    margin: 2px 0;
    transition: background 0.15s ease;
}

.search-result-item:hover {
    background: var(--gray-800);
}

.search-result-item svg {
    width: 16px;
    height: 16px;
    stroke: var(--gray-400);
    flex-shrink: 0;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 14px;
    color: var(--text-color);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--primary-light);
    color: white;
    flex-shrink: 0;
}

/* ========================================
   FLOATING ACTION BUTTON (FAB)
   ======================================== */

.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
}

.fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-light);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.fab-main:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    background: var(--accent-light);
}

.fab-main .fab-icon {
    stroke: white;
    transition: transform 0.3s ease;
}

.fab-container.open .fab-main .fab-icon {
    transform: rotate(45deg);
}

.fab-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.fab-container.open .fab-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.15s ease, transform 0.15s ease;
    font-size: 14px;
    color: var(--text-color);
}

.fab-item:hover {
    background: var(--gray-800);
    transform: translateX(-4px);
}

.fab-item svg {
    width: 18px;
    height: 18px;
    stroke: var(--primary-light);
    flex-shrink: 0;
}

.fab-item span {
    font-weight: 500;
}

.fab-item .shortcut {
    font-size: 11px;
    color: var(--gray-500);
    background: var(--gray-800);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

/* Hide FAB on small screens */
@media (max-width: 768px) {
    .fab-container {
        display: none;
    }
}

/* ========================================
   KANBAN BOARD
   ======================================== */

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--gray-800);
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--gray-400);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.view-btn:hover {
    color: var(--text-color);
    background: var(--gray-700);
}

.view-btn.active {
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.view-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 8px 4px 16px;
    min-height: 500px;
}

.kanban-column {
    min-width: 280px;
    max-width: 280px;
    background: var(--gray-900);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: background 0.2s ease;
}

.kanban-column.drag-over {
    background: rgba(132, 189, 0, 0.1);
    box-shadow: inset 0 0 0 2px var(--primary-light);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.kanban-column-header .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kanban-column-header .status-dot.prospecto { background: var(--gray-400); }
.kanban-column-header .status-dot.contacto { background: #4299e1; }
.kanban-column-header .status-dot.propuesta { background: #9f7aea; }
.kanban-column-header .status-dot.negociacion { background: #ed8936; }
.kanban-column-header .status-dot.ganado { background: #48bb78; }
.kanban-column-header .status-dot.perdido { background: #f56565; }

.kanban-column-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    flex: 1;
}

.kanban-column-count {
    font-size: 12px;
    color: var(--gray-500);
    background: var(--gray-800);
    padding: 2px 8px;
    border-radius: 10px;
}

.kanban-column-value {
    font-size: 12px;
    color: var(--primary-light);
    font-weight: 600;
}

.kanban-cards {
    flex: 1;
    min-height: 100px;
    overflow-y: auto;
}

.kanban-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: grab;
    border-left: 3px solid var(--primary-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
}

.kanban-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.kanban-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.3;
}

.kanban-card-priority {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    flex-shrink: 0;
}

.kanban-card-priority.alta {
    background: rgba(245, 101, 101, 0.2);
    color: #f56565;
}

.kanban-card-priority.media {
    background: rgba(237, 137, 54, 0.2);
    color: #ed8936;
}

.kanban-card-priority.baja {
    background: rgba(72, 187, 120, 0.2);
    color: #48bb78;
}

.kanban-card-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 8px;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--gray-500);
}

.kanban-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.kanban-card-meta svg {
    width: 12px;
    height: 12px;
    stroke: var(--gray-500);
}

.kanban-card-sector {
    font-size: 11px;
    color: var(--gray-400);
    background: var(--gray-800);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 8px;
    display: inline-block;
}

/* Quick Activity Modal */
.quick-activity-modal {
    padding: 20px;
}

.quick-activity-modal h3 {
    margin-bottom: 16px;
    font-size: 18px;
}

.quick-activity-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quick-activity-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-activity-form label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-400);
}

.quick-activity-form select,
.quick-activity-form input,
.quick-activity-form textarea {
    padding: 10px 12px;
    background: var(--gray-800);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 14px;
}

.quick-activity-form textarea {
    min-height: 80px;
    resize: vertical;
}

.quick-activity-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

/* Keyboard shortcut hints */
.keyboard-hint {
    position: fixed;
    bottom: 100px;
    right: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-size: 13px;
    color: var(--text-color);
    z-index: 99;
    animation: fadeIn 0.3s ease-out;
}

.keyboard-hint kbd {
    background: var(--gray-700);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    margin: 0 2px;
}

/* ==================== ANALYTICS SECTION ==================== */

/* Analytics Tabs */
.analytics-tabs {
    display: flex;
    gap: 4px;
    background: var(--gray-800);
    padding: 4px;
    border-radius: 8px;
    width: fit-content;
}

.analytics-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.analytics-tab:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.analytics-tab.active {
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Date Filter */
.analytics-date-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.analytics-date-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--gray-400);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.analytics-date-btn:hover {
    border-color: var(--primary-light);
    color: var(--text-color);
}

.analytics-date-btn.active {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

/* Goal Progress Ring */
.analytics-goal-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--primary-light) var(--progress, 0%), var(--gray-700) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.5s ease;
}

.analytics-goal-center {
    width: 90px;
    height: 90px;
    background: #1a202c;
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

[data-theme="light"] .analytics-goal-center { background: #ffffff; }

.analytics-goal-percentage {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-light);
}

.analytics-goal-label {
    font-size: 11px;
    color: var(--gray-400);
    text-transform: uppercase;
}

/* Pace Indicator */
.analytics-pace {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.analytics-pace.ahead {
    background: rgba(72, 187, 120, 0.2);
    color: #48bb78;
}

.analytics-pace.on-track {
    background: rgba(66, 153, 225, 0.2);
    color: #4299e1;
}

.analytics-pace.behind {
    background: rgba(245, 101, 101, 0.2);
    color: #f56565;
}

/* Heatmap */
.analytics-heatmap {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.analytics-heatmap-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--gray-800);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--gray-500);
    transition: background 0.2s ease;
}

.analytics-heatmap-cell.level-1 {
    background: rgba(132, 189, 0, 0.2);
    color: var(--accent);
}

.analytics-heatmap-cell.level-2 {
    background: rgba(132, 189, 0, 0.4);
    color: var(--accent);
}

.analytics-heatmap-cell.level-3 {
    background: rgba(132, 189, 0, 0.6);
    color: white;
}

.analytics-heatmap-cell.level-4 {
    background: rgba(132, 189, 0, 0.8);
    color: white;
}

/* Engagement Score */
.analytics-engagement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-800);
    border-radius: 8px;
    margin-bottom: 8px;
}

.analytics-engagement-score {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.analytics-engagement-score.high {
    background: rgba(72, 187, 120, 0.2);
    color: #48bb78;
}

.analytics-engagement-score.medium {
    background: rgba(237, 137, 54, 0.2);
    color: #ed8936;
}

.analytics-engagement-score.low {
    background: rgba(245, 101, 101, 0.2);
    color: #f56565;
}

.analytics-engagement-info {
    flex: 1;
    min-width: 0;
}

.analytics-engagement-name {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 2px;
}

.analytics-engagement-details {
    font-size: 12px;
    color: var(--gray-400);
}

/* Recommendations */
.analytics-recommendation {
    padding: 12px 16px;
    background: var(--gray-800);
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid var(--gray-600);
}

.analytics-recommendation.urgent {
    border-left-color: #f56565;
}

.analytics-recommendation.high {
    border-left-color: #ed8936;
}

.analytics-recommendation.normal {
    border-left-color: #4299e1;
}

.analytics-recommendation-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.analytics-recommendation-priority {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
}

.analytics-recommendation.urgent .analytics-recommendation-priority {
    background: rgba(245, 101, 101, 0.2);
    color: #f56565;
}

.analytics-recommendation.high .analytics-recommendation-priority {
    background: rgba(237, 137, 54, 0.2);
    color: #ed8936;
}

.analytics-recommendation.normal .analytics-recommendation-priority {
    background: rgba(66, 153, 225, 0.2);
    color: #4299e1;
}

.analytics-recommendation-lead {
    font-weight: 600;
    color: var(--text-color);
}

.analytics-recommendation-action {
    font-size: 13px;
    color: var(--gray-400);
}

/* Analytics Charts */
.analytics-chart-container {
    min-height: 200px;
    position: relative;
}

.analytics-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.analytics-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.analytics-bar-label {
    width: 100px;
    font-size: 13px;
    color: var(--gray-400);
    text-align: right;
    flex-shrink: 0;
}

.analytics-bar-track {
    flex: 1;
    height: 24px;
    background: var(--gray-800);
    border-radius: 4px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.analytics-bar-value {
    width: 60px;
    font-size: 13px;
    color: var(--text-color);
    text-align: right;
    flex-shrink: 0;
}

/* Trend Line Chart */
.analytics-trend-chart {
    position: relative;
    height: 200px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 20px 0;
}

.analytics-trend-bar {
    flex: 1;
    background: var(--primary-light);
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
    position: relative;
    min-height: 4px;
}

.analytics-trend-bar:hover {
    opacity: 0.8;
}

.analytics-trend-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--gray-400);
    white-space: nowrap;
}

/* Milestones Timeline */
.analytics-milestones {
    position: relative;
    padding: 20px 0;
}

.analytics-milestone-track {
    height: 4px;
    background: var(--gray-700);
    border-radius: 2px;
    position: relative;
    margin: 30px 0;
}

.analytics-milestone-progress {
    height: 100%;
    background: var(--primary-light);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.analytics-milestone-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gray-700);
    border: 2px solid var(--gray-600);
}

.analytics-milestone-marker.completed {
    background: var(--accent);
    border-color: var(--accent);
}

.analytics-milestone-marker.current {
    background: var(--primary-light);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.3);
}

.analytics-milestone-label {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--gray-400);
    white-space: nowrap;
}

/* Funnel Analytics */
.analytics-funnel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-funnel-stage {
    display: flex;
    align-items: center;
    gap: 16px;
}

.analytics-funnel-bar {
    height: 36px;
    background: var(--primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    transition: width 0.5s ease;
    min-width: 80px;
}

.analytics-funnel-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.analytics-funnel-label {
    font-size: 13px;
    color: var(--text-color);
    min-width: 140px;
}

.analytics-funnel-rate {
    font-size: 12px;
    color: var(--gray-400);
}

.analytics-funnel-arrow {
    color: var(--gray-500);
    font-size: 18px;
    padding-left: 12px;
}

/* Dashboard Goal Progress Card */
.dashboard-goal-card {
    display: flex;
    gap: 32px;
    align-items: center;
    padding: 24px;
}

.dashboard-goal-ring-container {
    flex-shrink: 0;
}

.dashboard-goal-info {
    flex: 1;
}

.dashboard-goal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.dashboard-goal-subtitle {
    font-size: 14px;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.dashboard-goal-stats {
    display: flex;
    gap: 24px;
}

.dashboard-goal-stat {
    text-align: center;
}

.dashboard-goal-stat-value {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.dashboard-goal-stat-label {
    font-size: 12px;
    color: var(--gray-400);
    text-transform: uppercase;
}

/* Granularity Toggle */
.analytics-granularity {
    display: flex;
    gap: 4px;
    background: var(--gray-800);
    padding: 4px;
    border-radius: 6px;
    width: fit-content;
}

.analytics-granularity-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.analytics-granularity-btn.active {
    background: var(--card-bg);
    color: var(--text-color);
}

/* Responsive */
@media (max-width: 768px) {
    .analytics-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .analytics-tab {
        padding: 8px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .dashboard-goal-card {
        flex-direction: column;
        text-align: center;
    }

    .dashboard-goal-stats {
        justify-content: center;
    }

    .analytics-bar-label {
        width: 80px;
        font-size: 12px;
    }
}

/* ==================== AUTOMATION & WORKFLOW (Phase 3) ==================== */

/* Follow-up Reminders */
.reminders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.reminders-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.reminders-summary {
    display: flex;
    gap: 8px;
}

.reminder-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.reminder-badge.urgent {
    background: rgba(245, 101, 101, 0.2);
    color: #f56565;
}

.reminder-badge.high {
    background: rgba(237, 137, 54, 0.2);
    color: #ed8936;
}

.reminder-badge.normal {
    background: rgba(66, 153, 225, 0.2);
    color: #4299e1;
}

.reminders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reminder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-800);
    border-radius: 8px;
    border-left: 3px solid var(--gray-600);
}

.reminder-item.urgent {
    border-left-color: #f56565;
}

.reminder-item.high {
    border-left-color: #ed8936;
}

.reminder-item.normal {
    border-left-color: #4299e1;
}

.reminder-priority-indicator {
    display: none;
}

.reminder-content {
    flex: 1;
    min-width: 0;
}

.reminder-lead-name {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 2px;
}

.reminder-details {
    font-size: 12px;
    color: var(--gray-400);
    display: flex;
    gap: 8px;
}

.reminder-actions {
    display: flex;
    gap: 8px;
}

.reminders-footer {
    margin-top: 12px;
    text-align: center;
}

.reminders-footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-size: 14px;
}

.reminders-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--gray-400);
}

.reminders-empty p {
    margin: 12px 0 4px 0;
    font-size: 16px;
    color: var(--text-color);
}

.reminders-empty span {
    font-size: 13px;
}

/* Email Templates */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.template-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-category {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--primary-light);
    background: rgba(66, 153, 225, 0.15);
    padding: 4px 8px;
    border-radius: 4px;
}

.template-actions {
    display: flex;
    gap: 4px;
}

.template-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.template-subject {
    font-size: 13px;
    color: var(--gray-400);
}

.template-preview {
    font-size: 13px;
    color: var(--gray-400);
    line-height: 1.5;
    max-height: 60px;
    overflow: hidden;
}

.template-footer {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.template-full-content {
    background: var(--gray-800);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.template-full-subject {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.template-full-body {
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    margin: 0;
    color: var(--text-color);
}

.placeholders-help {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.placeholders-help h4 {
    margin: 0 0 16px 0;
}

.placeholders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.placeholder-item {
    font-size: 13px;
    color: var(--gray-400);
}

.placeholder-item code {
    background: var(--gray-800);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
    margin-right: 8px;
}

/* Activity Type Buttons */
.activity-type-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.activity-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--gray-800);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--gray-400);
    cursor: pointer;
    transition: all 0.2s ease;
}

.activity-type-btn:hover {
    border-color: var(--border-color);
    color: var(--text-color);
}

.activity-type-btn.active {
    border-color: var(--primary-light);
    background: rgba(66, 153, 225, 0.1);
    color: var(--primary-light);
}

.activity-type-btn svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Scheduled Activities */
.scheduled-activities-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scheduled-activity-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    align-items: center;
}

.scheduled-activity-item.today {
    border-color: var(--primary-light);
    background: rgba(66, 153, 225, 0.05);
}

.scheduled-activity-item.past {
    opacity: 0.6;
}

.scheduled-date {
    text-align: center;
    min-width: 60px;
}

.scheduled-day {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    font-family: var(--font-mono);
}

.scheduled-month {
    font-size: 12px;
    color: var(--gray-400);
    text-transform: uppercase;
}

.today-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--primary-light);
    margin-top: 4px;
}

.scheduled-content {
    flex: 1;
    min-width: 0;
}

.scheduled-type {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-light);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.scheduled-lead {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.scheduled-notes {
    font-size: 13px;
    color: var(--gray-400);
    margin-top: 4px;
}

.scheduled-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Bulk Action Bar */
.bulk-action-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.bulk-action-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
    font-size: 14px;
}

.bulk-count {
    font-weight: 700;
    color: var(--primary-light);
    font-size: 18px;
}

.bulk-action-buttons {
    display: flex;
    gap: 8px;
}

.bulk-action-buttons .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bulk-action-buttons .btn svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.bulk-action-close {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 24px;
    cursor: pointer;
    padding: 0 0 0 12px;
    border-left: 1px solid var(--border-color);
    margin-left: 8px;
}

.bulk-action-close:hover {
    color: var(--text-color);
}

/* Bulk checkbox styling */
.bulk-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#bulk-select-all {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .templates-grid {
        grid-template-columns: 1fr;
    }

    .activity-type-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .bulk-action-bar {
        left: 16px;
        right: 16px;
        transform: none;
        flex-wrap: wrap;
        justify-content: center;
    }

    .bulk-action-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .scheduled-activity-item {
        flex-wrap: wrap;
    }

    .placeholders-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== COLLABORATION (Phase 4) ==================== */

/* Notifications Button */
.notification-btn {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Notifications Panel */
.notifications-panel {
    position: fixed;
    top: 60px;
    right: 16px;
    width: 360px;
    max-height: 480px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.notifications-panel.show {
    display: flex;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.notifications-header h3 {
    margin: 0;
    font-size: 16px;
}

.notifications-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.notification-item:hover {
    background: rgba(132, 189, 0, 0.1);
}

.notification-item.unread {
    background: rgba(132, 189, 0, 0.05);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
}

.notification-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-message {
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 4px;
}

.notification-time {
    font-size: 12px;
    color: var(--gray-400);
}

.notification-dismiss {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s;
}

.notification-item:hover .notification-dismiss {
    opacity: 1;
}

.notification-dismiss:hover {
    color: var(--danger);
}

.notifications-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--gray-400);
}

/* Activity Feed */
.activity-feed {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.activity-feed-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.activity-feed-header h3 {
    margin: 0;
    font-size: 16px;
}

.activity-feed-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.activity-feed-item:last-child {
    border-bottom: none;
}

.activity-feed-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.activity-feed-content {
    flex: 1;
    min-width: 0;
}

.activity-feed-text {
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 4px;
}

.activity-feed-text em {
    color: var(--accent);
    font-style: normal;
}

.activity-feed-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--gray-400);
}

.activity-feed-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--gray-400);
}

/* Audit Trail */
.audit-trail {
    padding: 24px;
}

.audit-trail-header {
    margin-bottom: 24px;
}

.audit-trail-header h2 {
    margin: 0 0 8px 0;
}

.audit-trail-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.audit-trail-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.audit-trail-date-group {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.audit-trail-date {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-300);
}

.audit-trail-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.audit-trail-item:last-child {
    border-bottom: none;
}

.audit-trail-time {
    font-size: 12px;
    color: var(--gray-400);
    min-width: 50px;
    flex-shrink: 0;
}

.audit-trail-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.audit-trail-content {
    flex: 1;
    min-width: 0;
}

.audit-trail-action {
    font-size: 14px;
    color: var(--text-color);
}

.audit-trail-action em {
    color: var(--accent);
    font-style: normal;
}

.audit-trail-changes {
    margin-top: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audit-old-value {
    color: var(--danger);
    text-decoration: line-through;
}

.audit-arrow {
    color: var(--gray-400);
}

.audit-new-value {
    color: var(--success-light);
}

.audit-trail-empty {
    padding: 60px 24px;
    text-align: center;
    color: var(--gray-400);
}

/* Lead Comments */
.lead-comments {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.lead-comments-header {
    margin-bottom: 16px;
}

.lead-comments-header h4 {
    margin: 0;
    font-size: 16px;
}

.lead-comments-input {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-end;
}

.lead-comments-input textarea {
    flex: 1;
}

.lead-comments-input .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lead-comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lead-comment {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
}

.lead-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.lead-comment-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--accent);
}

.lead-comment-time {
    font-size: 12px;
    color: var(--gray-400);
}

.lead-comment-text {
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.lead-comment-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.btn-link:hover {
    color: var(--accent);
}

.btn-link.text-danger:hover {
    color: var(--danger);
}

.lead-comments-empty {
    padding: 24px;
    text-align: center;
    color: var(--gray-400);
    font-size: 14px;
}

/* Light Theme */
[data-theme="light"] .notifications-panel {
    background: white;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .notification-item.unread {
    background: rgba(132, 189, 0, 0.08);
}

[data-theme="light"] .activity-feed,
[data-theme="light"] .audit-trail-date-group {
    background: white;
}

[data-theme="light"] .audit-trail-date {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .lead-comment {
    background: rgba(0, 0, 0, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .notifications-panel {
        right: 8px;
        left: 8px;
        width: auto;
        top: 56px;
    }

    .audit-trail {
        padding: 16px;
    }

    .audit-trail-filters {
        flex-direction: column;
    }

    .audit-trail-item {
        flex-wrap: wrap;
    }

    .audit-trail-time {
        width: 100%;
        margin-bottom: 4px;
    }

    .lead-comments-input {
        flex-direction: column;
        align-items: stretch;
    }

    .lead-comments-input .btn {
        align-self: flex-end;
    }
}

/* ==================== KANBAN TOUCH SUPPORT ==================== */

/* Touch-friendly Kanban cards */
@media (pointer: coarse) {
    .kanban-card {
        padding: 16px;
        min-height: 80px;
        touch-action: pan-y;
        -webkit-user-select: none;
        user-select: none;
    }

    .kanban-card-header {
        gap: 12px;
    }

    .kanban-card-actions .btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }

    .kanban-column {
        min-width: 280px;
        padding: 12px;
    }

    .kanban-column-header {
        padding: 12px;
    }
}

/* Dragging states for touch */
.kanban-card-dragging {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 2px solid var(--primary-light);
    opacity: 0.95;
}

.kanban-card-placeholder {
    opacity: 0.3;
    border: 2px dashed var(--gray-600);
}

.kanban-column-drag-over {
    background: rgba(132, 189, 0, 0.1);
    border: 2px dashed var(--primary-light);
}

/* Kanban responsive improvements */
@media (max-width: 1024px) {
    .kanban-board {
        gap: 12px;
        padding: 12px;
    }

    .kanban-column {
        min-width: 260px;
        flex: 0 0 260px;
    }
}

@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
        overflow-x: visible;
    }

    .kanban-column {
        width: 100%;
        min-width: 100%;
        flex: 0 0 auto;
    }

    .kanban-column-cards {
        max-height: 300px;
        overflow-y: auto;
    }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    .mobile-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .sidebar {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .fab {
        bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
    }
}

/* Header actions container */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==================== ERROR HANDLING STYLES ==================== */

.error-retry-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--danger);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    max-width: 90%;
    animation: slideUp 0.3s ease-out;
}

.error-retry-toast span {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
}

.error-retry-toast .btn {
    white-space: nowrap;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Error notification enhancement */
.notification.error,
.toast.error {
    border-left: 4px solid var(--danger);
}

.notification.warning,
.toast.warning {
    border-left: 4px solid var(--warning);
}

/* ==================== TEST RESULTS STYLES ==================== */

.test-results-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 10002;
}

.test-results-panel::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: -1;
}

.test-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-darker);
}

.test-results-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.test-results-header button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
}

.test-results-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
}

.test-results-summary.all-passed {
    background: rgba(132, 189, 0, 0.1);
    border-left: 4px solid var(--success);
}

.test-results-summary.has-failures {
    background: rgba(220, 53, 69, 0.1);
    border-left: 4px solid var(--danger);
}

.test-count {
    font-weight: 600;
    color: var(--text-primary);
}

.test-duration {
    color: var(--text-muted);
    font-size: 13px;
}

.test-results-list {
    overflow-y: auto;
    padding: 12px 0;
    max-height: 400px;
}

.test-suite {
    margin-bottom: 16px;
}

.test-suite-header {
    padding: 8px 20px;
    font-weight: 600;
    color: var(--primary-light);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.test-result {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 20px;
    font-size: 13px;
}

.test-result.passed .test-name {
    color: var(--text-primary);
}

.test-result.failed .test-name {
    color: var(--danger);
}

.test-icon {
    flex-shrink: 0;
    font-size: 12px;
}

.test-name {
    flex: 1;
}

.test-error {
    display: block;
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    padding-left: 20px;
    opacity: 0.8;
}

/* ==================== ACCIONES SECTION ==================== */

.acciones-calendar-day {
    background: var(--gray-900);
    padding: 8px;
    min-height: 60px;
    transition: background 0.15s;
}

.acciones-calendar-day:hover:not(.empty) {
    background: var(--gray-800);
}

.acciones-calendar-day.empty {
    background: var(--gray-900);
    opacity: 0.3;
}

.acciones-calendar-day.today {
    background: rgba(132, 189, 0, 0.08);
    box-shadow: inset 0 0 0 1px var(--primary-light);
}

.acciones-calendar-day.has-actions {
    cursor: pointer;
}

.acciones-kanban-card {
    transition: transform 0.15s, box-shadow 0.15s;
}

.acciones-kanban-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.acciones-kanban-card:active {
    cursor: grabbing;
}

.acciones-kanban-column {
    transition: background 0.15s;
}

@media (max-width: 768px) {
    .acciones-summary-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .acciones-kanban {
        flex-direction: column !important;
    }

    .acciones-kanban-column {
        min-width: unset !important;
    }

    .acciones-filter-bar {
        flex-direction: column !important;
    }
}

/* ==================== NAV INFO ICON ==================== */

.nav-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
    margin-left: auto;
    margin-right: 4px;
    flex-shrink: 0;
}

.nav-info-icon:hover {
    opacity: 1;
    color: var(--accent);
}

.tab-info-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    opacity: 0.5;
    vertical-align: middle;
    cursor: pointer;
    transition: opacity 0.2s;
}

.tab-info-icon:hover {
    opacity: 1;
}

/* ==================== INFO MODAL OVERLAY ==================== */

#info-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.info-modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

/* ==================== MODULE INFO BUTTON ==================== */

.module-info-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    transition: all 0.2s;
}

.module-info-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(132,189,0,0.08);
}

/* ==================== PREGUNTA CLAVE CALLOUT ==================== */

.pregunta-clave {
    background: linear-gradient(135deg, rgba(132,189,0,0.08), rgba(56,178,172,0.06));
    border: 1px solid rgba(132,189,0,0.25);
    border-left: 4px solid var(--accent);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pregunta-clave strong {
    color: var(--accent);
    font-weight: 600;
}

/* ==================== ANALYSIS SECTION ==================== */

/* Textareas in new sections: ensure resize and consistent style */
#analisis-estrategico-content textarea.input-field,
#optimizacion-productiva-content textarea.input-field {
    resize: vertical;
}

.analysis-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.analysis-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-primary);
}

/* ==================== OPTIMIZACION PROJECT ITEMS ==================== */

.op-project-item {
    background: var(--gray-800);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.op-project-item:hover {
    border-color: var(--accent);
}

.op-project-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="light"] .op-project-item {
    background: var(--gray-100, #f5f5f5);
}

/* AI Generation */
.ai-loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ai-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-context-readonly {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 120px;
    overflow-y: auto;
}

/* ==================== AI ADVISOR ==================== */

#ai-advisor-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 9998;
}

.ai-advisor-fab {
    position: fixed;
    bottom: 24px;
    right: 96px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 9998;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-advisor-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.ai-advisor-panel {
    position: fixed;
    bottom: 88px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    /* Solid, not var(--bg-card): that token is 5% white in dark theme, so the
       page content bled through the chat and made it hard to read. */
    background: #1a202c;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
}

[data-theme="light"] .ai-advisor-panel { background: #ffffff; }

.ai-advisor-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-sidebar);
    color: var(--text-primary);
}

.ai-advisor-panel-thread {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-card);
    color: var(--text-primary);
}

.ai-advisor-panel-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-sidebar);
}

.ai-advisor-panel-input textarea {
    flex: 1;
    resize: none;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.ai-advisor-panel-input textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(132, 189, 0, 0.18);
}

.ai-proposal-card button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .ai-advisor-panel {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 80px;
    }
    .ai-advisor-fab {
        right: 84px;
    }
}

/* ==================== PUBLIC LANDING PAGE (strategai.cemi.ai, 2026-10) ==================== */

/* #login-screen holds the whole public landing; auth.js toggles .hidden on it and the
   login modal keeps its original ids. Tokens are scoped to the landing so the app is untouched.
   Concept: strategy as a navigational chart — chart-paper light theme, ink-navy dark theme,
   CEMI crimson as the one accent, gold only for small marks. Display face: Newsreader. */

#login-screen {
    --ld-paper: #eef0f2;
    --ld-paper-2: #e3e7eb;
    --ld-ink: #101c27;
    --ld-ink-2: #2f4f6f;
    --ld-text: #16222d;
    --ld-text-2: #4a5a68;
    --ld-rule: rgba(16, 28, 39, 0.16);
    --ld-rule-strong: rgba(16, 28, 39, 0.4);
    --ld-crimson: #a70000;
    --ld-crimson-ink: #ffffff;
    --ld-gold: #b8862e;
    --ld-nav-bg: rgba(238, 240, 242, 0.86);
    --ld-field: #ffffff;
    --ld-display: 'Newsreader', 'Times New Roman', serif;
    --ld-body: 'Inter', system-ui, sans-serif;
    position: fixed;
    inset: 0;
    display: block;
    align-items: initial;
    justify-content: initial;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--ld-paper);
    color: var(--ld-text);
    font-family: var(--ld-body);
    font-size: 17px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}
body:not([data-theme="light"]) #login-screen {
    --ld-paper: #0f1a24;
    --ld-paper-2: #15232f;
    --ld-ink: #e7e2d8;
    --ld-ink-2: #9fb0c0;
    --ld-text: #e7e2d8;
    --ld-text-2: #a9b4bd;
    --ld-rule: rgba(231, 226, 216, 0.16);
    --ld-rule-strong: rgba(231, 226, 216, 0.42);
    --ld-crimson: #d8463f;
    --ld-crimson-ink: #ffffff;
    --ld-gold: #d9a441;
    --ld-nav-bg: rgba(15, 26, 36, 0.84);
    --ld-field: #15232f;
}
#login-screen *, #login-screen *::before, #login-screen *::after { box-sizing: border-box; }
#login-screen a { color: inherit; }
#login-screen :focus-visible { outline: 2px solid var(--ld-crimson); outline-offset: 3px; border-radius: 2px; }
#login-screen h1, #login-screen h2, #login-screen h3 { text-wrap: balance; }
#login-screen p { text-wrap: pretty; }
#login-screen img { max-width: 100%; height: auto; display: block; }

.landing-skip {
    position: absolute; left: 16px; top: -60px; z-index: 300;
    background: var(--ld-ink); color: var(--ld-paper); padding: 8px 14px; border-radius: 4px; text-decoration: none; font-size: 14px;
}
.landing-skip:focus { top: 12px; }

/* ---------- Nav ---------- */
.landing-nav {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px clamp(16px, 4vw, 48px);
    background: var(--ld-nav-bg);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--ld-rule);
}
.landing-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.landing-logo-img { width: 36px; height: 36px; border-radius: 50%; object-fit: contain; background: #fff; }
.landing-logo-text { font-family: var(--ld-display); font-weight: 500; font-size: 22px; letter-spacing: -0.01em; color: var(--ld-ink); }
.landing-nav-links { display: flex; align-items: center; gap: 26px; }
.landing-nav-links a { text-decoration: none; font-size: 14.5px; font-weight: 500; color: var(--ld-text-2); border-bottom: 1px solid transparent; padding: 2px 0; }
.landing-nav-links a:hover { color: var(--ld-ink); border-bottom-color: var(--ld-crimson); }
.landing-nav-tools { display: flex; align-items: center; gap: 10px; }
.landing-lang-toggle { display: inline-flex; border: 1px solid var(--ld-rule-strong); border-radius: 999px; overflow: hidden; }
.landing-lang-toggle button {
    background: transparent; border: 0; color: var(--ld-text-2); padding: 5px 9px; font: 600 12px/1 var(--ld-body); cursor: pointer; letter-spacing: 0.04em;
}
.landing-lang-toggle button:hover { color: var(--ld-ink); }
.landing-lang-toggle button.active { background: var(--ld-ink); color: var(--ld-paper); }
.landing-theme-btn {
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--ld-rule-strong); background: transparent; color: var(--ld-text-2); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.landing-theme-btn svg { width: 17px; height: 17px; }
.landing-theme-btn:hover { color: var(--ld-ink); }
.landing-theme-btn .landing-ico-sun { display: none; }
body:not([data-theme="light"]) .landing-theme-btn .landing-ico-sun { display: block; }
body:not([data-theme="light"]) .landing-theme-btn .landing-ico-moon { display: none; }
.landing-login-btn {
    background: var(--ld-crimson); color: var(--ld-crimson-ink); border: 0; padding: 9px 18px; border-radius: 999px;
    font: 600 14px/1 var(--ld-body); cursor: pointer;
}
.landing-login-btn:hover { filter: brightness(1.08); }

/* ---------- Layout ---------- */
.landing-main { max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }
.landing-section-head { max-width: 680px; margin-bottom: 40px; }
.landing-section-head h2, .landing-spread-copy h2 {
    font-family: var(--ld-display); font-weight: 400; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.12; letter-spacing: -0.012em; color: var(--ld-ink); margin: 0 0 14px;
}
.landing-section-head p { color: var(--ld-text-2); margin: 0; font-size: 17px; }

/* ---------- Hero ---------- */
.landing-hero {
    display: grid; grid-template-columns: minmax(300px, 11fr) 13fr; gap: clamp(24px, 4vw, 56px); align-items: center;
    padding: clamp(40px, 7vw, 96px) 0 clamp(40px, 6vw, 80px);
}
.landing-hero-kicker { margin: 0 0 18px; font-size: 14px; font-weight: 500; color: var(--ld-crimson); }
.landing-hero-title {
    font-family: var(--ld-display); font-weight: 400; font-size: clamp(38px, 4.6vw, 64px); line-height: 1.04; letter-spacing: -0.02em;
    color: var(--ld-ink); margin: 0 0 24px;
}
.landing-hero-lead { font-size: clamp(17px, 1.4vw, 19px); color: var(--ld-text-2); max-width: 34em; margin: 0 0 32px; }
.landing-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.landing-btn-primary {
    background: var(--ld-crimson); color: var(--ld-crimson-ink); border: 1px solid var(--ld-crimson); padding: 13px 24px; border-radius: 999px;
    font: 600 15px/1.2 var(--ld-body); cursor: pointer; text-decoration: none; display: inline-block;
}
.landing-btn-primary:hover { filter: brightness(1.08); }
.landing-btn-secondary {
    background: transparent; color: var(--ld-ink); border: 1px solid var(--ld-rule-strong); padding: 13px 24px; border-radius: 999px;
    font: 500 15px/1.2 var(--ld-body); cursor: pointer; text-decoration: none; display: inline-block;
}
.landing-btn-secondary:hover { border-color: var(--ld-ink); }
.landing-hero-art { margin: 0; position: relative; }
.landing-hero-art img {
    width: 100%; aspect-ratio: 5 / 4; object-fit: cover; object-position: 68% 50%; border-radius: 6px;
    box-shadow: 0 30px 60px -30px rgba(16, 28, 39, 0.5);
    animation: landing-hero-in 1.1s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes landing-hero-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }

/* ---------- Route (the five stages are a real sequence) ---------- */
.landing-route { padding: clamp(40px, 6vw, 80px) 0; border-top: 1px solid var(--ld-rule); }
.landing-route-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; border-top: 1px solid var(--ld-rule-strong); }
.landing-route-list li { display: grid; grid-template-rows: auto 1fr; padding: 22px 20px 26px 0; border-top: 0; position: relative; }
.landing-route-list li + li { padding-left: 20px; border-left: 1px solid var(--ld-rule); }
.landing-route-num { font-family: var(--ld-display); font-size: 30px; line-height: 1; color: var(--ld-crimson); margin-bottom: 18px; display: block; }
.landing-route-list h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 600 17px/1.3 var(--ld-body); color: var(--ld-ink); }
.landing-route-list .ui-ico { width: 18px; height: 18px; color: var(--ld-ink-2); flex: none; }
.landing-route-list p { margin: 0; font-size: 15px; color: var(--ld-text-2); }

/* ---------- Spreads ---------- */
.landing-spread {
    display: grid; grid-template-columns: 5fr 6fr; gap: clamp(28px, 5vw, 80px); align-items: center;
    padding: clamp(40px, 6vw, 88px) 0; border-top: 1px solid var(--ld-rule);
}
.landing-spread-reverse .landing-spread-art { order: 2; }
.landing-spread-art { margin: 0; }
.landing-spread-art img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.landing-spread-copy p { color: var(--ld-text-2); margin: 0 0 16px; max-width: 36em; }
.landing-spread-copy p:last-child { margin-bottom: 0; }

/* ---------- Capability index ---------- */
.landing-index { padding: clamp(40px, 6vw, 88px) 0; border-top: 1px solid var(--ld-rule); }
.landing-index-list { margin: 0; border-top: 1px solid var(--ld-rule-strong); }
.landing-index-list > div { display: grid; grid-template-columns: 180px 1fr; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--ld-rule); }
.landing-index-list dt { margin: 0; font-family: var(--ld-display); font-size: 24px; line-height: 1.2; color: var(--ld-ink); }
.landing-index-list dd { margin: 0; color: var(--ld-text-2); font-size: 15.5px; line-height: 1.6; }

/* ---------- Principle ---------- */
.landing-principle { padding: clamp(48px, 7vw, 104px) 0; border-top: 1px solid var(--ld-rule); display: grid; grid-template-columns: 7fr 5fr; gap: clamp(24px, 5vw, 80px); align-items: start; }
.landing-principle-line { margin: 0; font-family: var(--ld-display); font-size: clamp(34px, 4.6vw, 64px); line-height: 1.05; letter-spacing: -0.015em; color: var(--ld-crimson); text-wrap: balance; }
.landing-principle-body { margin: 0; color: var(--ld-text-2); padding-top: 10px; border-top: 1px solid var(--ld-rule-strong); }

/* ---------- Contact ---------- */
.landing-contact { padding: clamp(40px, 6vw, 88px) 0 clamp(48px, 7vw, 96px); border-top: 1px solid var(--ld-rule); display: grid; grid-template-columns: 5fr 6fr; gap: clamp(28px, 5vw, 80px); align-items: start; }
.landing-contact-copy h2 { font-family: var(--ld-display); font-weight: 400; font-size: clamp(34px, 4vw, 52px); line-height: 1.08; margin: 0 0 14px; color: var(--ld-ink); }
.landing-contact-copy p { color: var(--ld-text-2); margin: 0 0 18px; max-width: 30em; }
.landing-contact-direct a { color: var(--ld-ink); text-decoration: none; border-bottom: 1px solid var(--ld-crimson); font-size: 18px; line-height: 1.9; }
.landing-contact-form { display: grid; gap: 16px; }
.landing-form-row label { display: block; font-size: 13.5px; font-weight: 500; color: var(--ld-text-2); margin-bottom: 6px; }
.landing-form-row input, .landing-form-row textarea {
    width: 100%; background: var(--ld-field); color: var(--ld-text); border: 1px solid var(--ld-rule-strong); border-radius: 4px;
    padding: 12px 14px; font: 400 16px/1.4 var(--ld-body); resize: vertical;
}
.landing-form-row input:focus, .landing-form-row textarea:focus { outline: none; border-color: var(--ld-crimson); box-shadow: 0 0 0 3px rgba(167, 0, 0, 0.14); }
.landing-honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.landing-form-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.landing-form-status { font-size: 14px; color: var(--ld-text-2); }

/* ---------- Footer ---------- */
.landing-footer { border-top: 1px solid var(--ld-rule-strong); background: var(--ld-paper-2); padding: 24px clamp(16px, 4vw, 48px); }
.landing-footer-inner { max-width: 1240px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 16px 28px; flex-wrap: wrap; font-size: 13.5px; color: var(--ld-text-2); }
.landing-footer-brand { display: flex; align-items: center; gap: 10px; }
.landing-footer-brand img { width: 28px; height: 28px; border-radius: 50%; background: #fff; }
.landing-footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.landing-footer-links a { text-decoration: none; color: var(--ld-text-2); }
.landing-footer-links a:hover { color: var(--ld-ink); }

/* ---------- Login modal (original login-box, ids untouched) ---------- */
.landing-login-modal {
    position: fixed; inset: 0; background: rgba(8, 14, 20, 0.78); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; z-index: 10000; padding: 20px; animation: fadeIn 0.2s ease;
    overflow-y: auto;
}
.landing-login-modal .login-box { background: #15232f; color: #e7e2d8; border-color: rgba(231, 226, 216, 0.14); }
.landing-login-modal .login-title { font-family: var(--ld-display); font-weight: 400; color: #e7e2d8; }
.landing-login-modal .login-subtitle { color: #a9b4bd; }
.landing-login-modal .login-input { background: #0f1a24; color: #e7e2d8; border-color: rgba(231, 226, 216, 0.25); }
.landing-login-modal .login-input::placeholder { color: #7f8c99; }
.landing-login-modal .login-input:focus { border-color: #d8463f; box-shadow: 0 0 0 3px rgba(216, 70, 63, 0.25); }
.landing-login-modal .login-btn { background: #a70000; color: #fff; }
.landing-login-modal .login-btn:hover { box-shadow: 0 8px 20px rgba(167, 0, 0, 0.35); }
.landing-login-modal .forgot-password-link { color: #d9a441; }
.landing-login-modal .google-login-btn { background: #0f1a24; color: #e7e2d8; border-color: rgba(231, 226, 216, 0.25); }
.landing-login-modal .login-footer, .landing-login-modal .login-divider { color: #7f8c99; }

/* ---------- Motion and width ---------- */
@media (prefers-reduced-motion: reduce) {
    #login-screen { scroll-behavior: auto; }
    .landing-hero-art img { animation: none; }
}
@media (max-width: 1100px) {
    .landing-route-list { grid-template-columns: repeat(3, 1fr); }
    .landing-route-list li:nth-child(4) { border-left: 0; padding-left: 0; }
    .landing-route-list li:nth-child(n+4) { border-top: 1px solid var(--ld-rule); }
}
@media (max-width: 900px) {
    .landing-nav-links { display: none; }
    .landing-hero { grid-template-columns: 1fr; padding-top: 28px; }
    .landing-hero-art { order: -1; margin: 0 calc(-1 * clamp(16px, 4vw, 48px)); }
    .landing-hero-art img { border-radius: 0; aspect-ratio: 4 / 3; box-shadow: none; }
    .landing-spread, .landing-contact, .landing-principle { grid-template-columns: 1fr; }
    .landing-spread-reverse .landing-spread-art { order: 0; }
    .landing-spread-art { max-width: 420px; }
    .landing-index-list > div { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 640px) {
    #login-screen { font-size: 16px; }
    .landing-route-list { grid-template-columns: 1fr; border-top: 0; }
    .landing-route-list li, .landing-route-list li + li { padding: 18px 0; border-left: 0; border-top: 1px solid var(--ld-rule); grid-template-columns: 44px 1fr; grid-template-rows: auto; gap: 0 8px; }
    .landing-route-num { font-size: 24px; margin: 2px 0 0; }
    .landing-lang-toggle button { padding: 5px 7px; }
    .landing-login-btn { padding: 8px 14px; }
    .landing-logo-text { display: none; }
}

/* ==================== SECTION-LEVEL EDIT MODE (5.18.0+) ==================== */

/* The bar at the top of every editable section. Contains either the
   "Editar sección" button (read mode) or the Cancelar/Guardar pair (edit mode). */
.edit-toggle-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex-wrap: wrap;
}
.edit-toggle-bar--active {
    background: rgba(132,189,0,0.08);
    border-color: var(--accent);
}
.edit-toggle-bar-hint,
.edit-toggle-bar-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.edit-toggle-bar--active .edit-toggle-bar-status {
    color: var(--accent);
    font-weight: 600;
}
.edit-toggle-bar-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Lock class applied to a section's content container when NOT in edit mode.
   Disables interaction on form controls and action buttons inside; styles them
   as read-only without changing their layout. Elements explicitly marked
   .always-editable (escape hatch for nav buttons, info modals, tabs) remain
   interactive. */
.section-locked input:not(.always-editable),
.section-locked textarea:not(.always-editable),
.section-locked select:not(.always-editable),
.section-locked [contenteditable="true"]:not(.always-editable) {
    pointer-events: none;
    user-select: text;
    background: rgba(255,255,255,0.02);
    border-color: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    cursor: default;
}
.section-locked button:not(.always-editable):not(.module-info-btn):not(.modal-close):not(.export-btn):not(.prospeccion-tab):not(.btn-info-modal) {
    pointer-events: none;
    opacity: 0.5;
    cursor: not-allowed;
    filter: saturate(0.4);
}
/* Soften card edit/delete button rows in lists — they look like they should
   work but are gated by edit mode */
.section-locked .card .btn-secondary.btn-sm,
.section-locked .card .btn-primary.btn-sm {
    pointer-events: none;
    opacity: 0.4;
}

/* Dark theme — invert the native calendar/time picker icon so it shows on
   dark backgrounds. Default user-agent icon is near-black (≈ #555) and
   disappears against our dark input bg. */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
    filter: invert(0.85) opacity(0.85);
    cursor: pointer;
}

/* Light theme: revert. */
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="month"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="week"]::-webkit-calendar-picker-indicator {
    filter: none;
}

/* ==================== Transición de Ventas (5.94.0+) ==================== */
.nav-item-inactive { display: none !important; }
.tr-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 18px; }
.tr-chip { display: inline-block; padding: 4px 10px; border-radius: 14px; border: 2px solid var(--border-color); font-size: 12px; font-weight: 600; cursor: pointer; background: var(--bg-card); color: var(--text-primary); }
.tr-chip:hover { filter: brightness(1.15); }
.tr-progress { height: 8px; border-radius: 4px; background: rgba(128,128,128,0.2); overflow: hidden; }
.tr-progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--success)); transition: width 0.3s; }
.tr-progress.small { height: 5px; margin: 6px 0 10px; }
.tr-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.tr-section-head h2 { margin: 0 0 4px; }
.tr-section-head p { margin: 0; font-size: 13px; color: var(--text-muted); max-width: 720px; }
.tr-group { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); margin: 22px 0 8px; display: flex; align-items: center; gap: 10px; }
.tr-sub { font-size: 12px; color: var(--text-muted); margin: 10px 0 4px; font-weight: 600; }
.tr-count { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: rgba(128,128,128,0.15); color: var(--text-secondary); }
.tr-tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(128,128,128,0.15); color: var(--text-secondary); white-space: nowrap; }
.tr-tag.now { background: rgba(61,174,43,0.2); color: #3DAE2B; }
.tr-num { display: inline-block; min-width: 20px; margin-right: 6px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.tr-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-card); margin-bottom: 6px; }
.tr-row.done { opacity: 0.6; }
.tr-row.done .tr-text { text-decoration: line-through; }
.tr-row.overdue { border-left: 4px solid #E53E3E; }
.tr-check { padding-top: 3px; }
.tr-check input { width: 16px; height: 16px; cursor: pointer; }
.tr-main { flex: 1; min-width: 200px; }
.tr-text { font-size: 14px; line-height: 1.45; cursor: pointer; color: var(--text-primary); }
.tr-more { font-size: 11px; color: var(--text-muted); margin-left: 6px; }
.tr-detail { font-size: 13px; color: var(--text-secondary); margin-top: 6px; padding: 8px 10px; border-left: 2px solid var(--border-color); }
.tr-detail p { margin: 0 0 6px; }
.tr-meta { font-size: 11px; color: var(--text-muted); }
.tr-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.tr-select { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-primary); font-family: inherit; font-size: 12px; max-width: 170px; }
.tr-select.overdue { border-color: #E53E3E; color: #E53E3E; }
.tr-inline { width: 110px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-primary); font-family: inherit; font-size: 12px; }
.tr-icon { border: none; background: transparent; cursor: pointer; font-size: 14px; color: var(--text-muted); padding: 2px 6px; }
.tr-icon:hover { color: var(--accent); }
.tr-empty { color: var(--text-muted); font-size: 13px; padding: 10px 0; }
.tr-para { font-size: 14px; line-height: 1.6; color: var(--text-secondary); max-width: 860px; }
.tr-list { font-size: 14px; line-height: 1.6; color: var(--text-secondary); max-width: 860px; }
.tr-fase { border: 1px solid var(--border-color); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: var(--bg-card); }
.tr-fase.actual { border-color: var(--accent); }
.tr-fase.pasada { opacity: 0.75; }
.tr-fase-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.tr-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 18px; }
.tr-table th, .tr-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border-color); vertical-align: top; }
.tr-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.tr-svg { width: 100%; height: auto; display: block; margin: 8px 0 20px; }
.tr-svg-arrow { fill: none; stroke: var(--text-muted); stroke-width: 1.5; marker-end: url(#tr-arr); }
.tr-svg-line { fill: none; stroke: var(--text-muted); stroke-width: 1.5; }
.tr-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 18px; }
.tr-step { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); font-size: 12px; max-width: 170px; }
.tr-step-n { font-weight: 700; color: var(--accent); }
.tr-arrow { color: var(--text-muted); }
.tr-guia { border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; background: var(--bg-card); }
.tr-guia-head { display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-size: 14px; }
.tr-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.tr-kpi { border: 1px solid var(--border-color); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 12px; background: var(--bg-card); }
.tr-kpi-n { font-size: 24px; font-weight: 700; line-height: 1.1; }
.tr-kpi-l { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-top: 2px; }
.tr-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 8px; }
.tr-bar { margin-bottom: 4px; }
.tr-bar-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }
.tr-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-secondary); margin: 14px 0; }
.tr-check-l { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.tr-log-row { display: grid; grid-template-columns: 150px auto 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border-color); font-size: 13px; }
@media (max-width: 720px) {
    .tr-row { flex-wrap: wrap; }
    .tr-controls { width: 100%; justify-content: flex-start; }
    .tr-log-row { grid-template-columns: 1fr; gap: 2px; }
}

/* ===== Planes de Ejecución + Capacidades del Equipo (5.96.0+) ===== */
.pe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 8px; }
.pe-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card); cursor: pointer; transition: border-color .15s, transform .15s; min-width: 0; }
.pe-card:hover { border-color: var(--accent); }
.pe-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pe-card-head { display: flex; align-items: flex-start; gap: 10px; }
.pe-emoji { font-size: 22px; line-height: 1; }
.pe-card-title { font-weight: 700; font-size: 15px; text-wrap: balance; overflow-wrap: anywhere; }
.pe-card-sub { font-size: 12px; color: var(--text-muted); }
.pe-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.45; }
.pe-card-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 12px; color: var(--text-secondary); }
.pe-tipo-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; background: var(--bg-secondary); }
.pe-tipo-opt:has(input:checked) { border-color: var(--accent); }
.pe-fase-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 8px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--border-color); }
.pe-fase-row .pe-fase-obj { grid-column: 1 / 5; }
.cap-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; max-height: 180px; overflow-y: auto; padding: 8px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 13px; }
.cap-checks label { display: flex; gap: 6px; align-items: center; }
@media (max-width: 720px) {
    .pe-grid { grid-template-columns: 1fr; }
    .pe-fase-row { grid-template-columns: 1fr 1fr; }
    .pe-fase-row .pe-fase-obj { grid-column: 1 / -1; }
    .cap-link-row { grid-template-columns: 1fr 1fr !important; }
}

/* ======================================================================
   CALM UI LAYER (5.97.0+)
   Global, reversible polish against visual clutter: one spacing/type scale,
   neutral secondary surfaces, no hover jumps, compact sidebar, a single
   «Exportar ▾» menu per section (js/navigation.js enhanceExportBars), FABs
   in one row. Deleting this block restores the previous look; no feature is
   moved or hidden by it.
   ====================================================================== */
:root {
    --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
    --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 30px;
    --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
}
/* Theme-dependent tokens live on body because data-theme is set on <body>. */
body {
    --surface-subtle: rgba(255,255,255,0.035);
    --surface-hover: rgba(255,255,255,0.06);
    --surface-raised: #1f2633;
    /* Aliases for tokens that modules reference but were never defined
       (they resolved to nothing: e.g. dark-on-dark reminder text). */
    --text-color: var(--text-primary);
    --text: var(--text-primary);
    --bg-hover: var(--surface-hover);
}
body[data-theme="light"] {
    --surface-subtle: rgba(0,0,0,0.025);
    --surface-hover: rgba(0,0,0,0.045);
    --surface-raised: #ffffff;
}

/* ---- Typography: calmer scale, balanced titles (no one-word last lines) ---- */
h1 { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
h2 { font-size: var(--fs-xl); font-weight: 650; line-height: 1.3; }
h3 { font-size: var(--fs-lg); font-weight: 650; line-height: 1.35; }
h1, h2, h3, h4, .hero-title, .modal-header h2, .modal-header h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
.subtitle { color: var(--text-secondary); font-size: var(--fs-md); margin-bottom: var(--space-5); max-width: 75ch; line-height: 1.5; }
@media (max-width: 768px) {
    h1 { font-size: 26px; }
    h2 { font-size: 20px; }
}

/* ---- Cards: no hover lift; the border hint is enough ---- */
.card { transition: border-color 0.2s, background 0.2s; }
.card:hover { transform: none; box-shadow: none; }
.metric-card, [data-theme="light"] .metric-card { background: var(--bg-card); border: 1px solid var(--border-color); }

/* ---- Buttons: one solid accent for primary, neutral secondary, no jumps ---- */
.btn { font-size: var(--fs-base); }
.btn-primary { background: var(--accent); }
.btn-primary:hover { transform: none; box-shadow: none; filter: brightness(1.08); }
.btn-secondary { background: var(--surface-subtle); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--surface-hover); }
[data-theme="light"] .btn-secondary { background: var(--surface-subtle); color: var(--text-primary); border-color: var(--border-color); }
[data-theme="light"] .btn-secondary:hover { background: var(--surface-hover); }

/* ---- Badges: sentence case, quieter ---- */
.badge { text-transform: none; letter-spacing: 0; font-size: var(--fs-xs); padding: 3px 9px; }

/* ---- Sub-tabs: neutral chips, solid accent for the active one ---- */
.prospeccion-tabs, [data-theme="light"] .prospeccion-tabs { background: transparent; border: none; padding: 0; gap: 6px; }
[data-theme="light"] .prospeccion-tab.active { color: #fff; }
.prospeccion-tab { padding: 8px 14px; font-size: var(--fs-sm); }
.prospeccion-tab:hover { background: var(--surface-hover); border-color: var(--border-color); color: var(--text-primary); }
.prospeccion-tab.active { background: var(--accent); }

/* ---- Sidebar: compact rows, quiet group headers, neutral hover ---- */
.nav-group { margin-top: 2px; }
.nav-group-header { padding: 10px 20px 6px 24px; font-size: 11px; letter-spacing: 0.08em; }
.nav-item { padding: 7px 20px; gap: 10px; font-size: var(--fs-base); transition: background 0.15s, color 0.15s; }
.nav-group .nav-item, .nav-group-items .nav-item { padding-left: 28px; }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-hover); transform: none; }
.nav-item.active { background: var(--surface-hover); }
[data-theme="light"] .nav-item:hover { background: var(--surface-hover); }
[data-theme="light"] .nav-item.active { background: var(--surface-hover); color: var(--accent); }
.nav-group-items { max-height: 2000px; }

/* ---- Export: one «Exportar ▾» menu per section instead of a rainbow bar ---- */
.export-bar[data-export-menu] { position: relative; display: flex; justify-content: flex-end; align-items: center; gap: 0; padding: 0; margin-bottom: var(--space-2); background: none; border: none; flex-wrap: nowrap; }
.export-bar[data-export-menu]::before { display: none; }
.export-bar[data-export-menu] .export-bar-label { display: none; }
.export-bar[data-export-menu] .export-btn { background: transparent; color: var(--text-secondary); box-shadow: none; }
.export-bar[data-export-menu] .export-menu-toggle { padding: 6px 12px; min-height: 0; min-width: 0; border: 1px solid var(--border-color); border-radius: 8px; font-size: var(--fs-sm); font-weight: 500; gap: 6px; }
.export-bar[data-export-menu] .export-menu-toggle .btn-text { display: inline; }
.export-bar[data-export-menu] .export-menu-toggle:hover,
.export-bar[data-export-menu].open .export-menu-toggle { background: var(--surface-hover); color: var(--text-primary); }
.export-menu-toggle svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.export-menu-chevron { transition: transform 0.15s; }
.export-bar.open .export-menu-chevron { transform: rotate(180deg); }
.export-menu { display: none; position: absolute; top: calc(100% + 4px); right: 0; z-index: 60; min-width: 190px; padding: 6px; background: var(--surface-raised); border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,0.3); flex-direction: column; gap: 2px; }
.export-bar.open .export-menu { display: flex; }
.export-bar[data-export-menu] .export-menu .export-btn { width: 100%; justify-content: flex-start; padding: 8px 10px; min-height: 0; border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 500; gap: 10px; color: var(--text-primary); }
.export-bar[data-export-menu] .export-menu .export-btn:hover { background: var(--surface-hover); }
.export-bar[data-export-menu] .export-menu .export-btn .btn-text { display: inline; }
.export-bar[data-export-menu] .export-menu .export-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; opacity: 0.8; }
.export-menu .export-bar-hint { margin: 6px 4px 2px; padding-top: 8px; border-top: 1px solid var(--border-color); max-width: 260px; font-size: 11px; }

/* ---- Floating buttons: one row bottom-right, clear of content ---- */
.main { padding-bottom: 104px; }
.ai-advisor-fab { right: 92px; width: 48px; height: 48px; bottom: 28px; box-shadow: 0 4px 14px rgba(0,0,0,0.3); }
#suggestions-fab.suggestions-fab { position: fixed; bottom: 32px; right: 152px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-color); background: var(--surface-raised); color: var(--text-primary); font-size: 17px; cursor: pointer; z-index: 999; box-shadow: 0 2px 8px rgba(0,0,0,0.2); display: flex; align-items: center; justify-content: center; opacity: 0.85; transition: opacity 0.15s; }
#suggestions-fab.suggestions-fab:hover { opacity: 1; }
@media (max-width: 768px) {
    /* The quick-action FAB is hidden on mobile, so close the gap it leaves. */
    .ai-advisor-fab { right: 16px; bottom: 16px; }
    #suggestions-fab.suggestions-fab { right: 72px; bottom: 20px; }
    .main { padding-bottom: 88px; }
}

/* ---- Legacy modals (.modal / .form-group / .form-control) rendered unstyled ---- */
.modal-overlay > .modal { background: var(--surface-raised); color: var(--text-primary); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.4); animation: slideUp 0.3s ease; }
.modal-overlay > .modal .modal-header h3 { margin: 0; font-size: var(--fs-lg); }
.modal-overlay > .modal .modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border-color); }
.modal-overlay .form-group { margin-bottom: 16px; }
.modal-overlay .form-group > label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.modal-overlay .form-control { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 12px; color: var(--text-primary); font-family: inherit; font-size: var(--fs-base); width: 100%; }
.modal-overlay .form-control:focus { outline: none; border-color: var(--accent); }
.activity-type-btn { background: var(--surface-subtle); border: 1px solid var(--border-color); }
@media (max-width: 480px) { .activity-type-buttons { grid-template-columns: repeat(2, 1fr); } }

/* ---- Dashboard follow-ups: readable in both themes ---- */
.reminder-item { background: var(--surface-subtle); border: 1px solid var(--border-color); border-left-width: 3px; }
.reminder-lead-name { color: var(--text-primary); }
.reminder-details { color: var(--text-muted); }
.reminder-actions .btn-icon { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); border-radius: 6px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.reminder-actions .btn-icon svg { stroke: currentColor; fill: none; stroke-width: 2; }
.reminder-actions .btn-icon:hover { background: var(--surface-hover); color: var(--text-primary); }
@media (max-width: 768px) {
    .mobile-nav-item { padding: 10px 16px; gap: 14px; font-size: var(--fs-md); margin-bottom: 2px; }
    .mobile-nav-group .mobile-nav-item { padding-left: 24px; }
    .mobile-nav-item svg { width: 20px; height: 20px; }
}

/* ---- Home: Planes de Ejecución list (5.97.1+) ---- */
.hub-planes .hub-planes-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.hub-planes .hub-planes-head h3 { margin: 0; font-size: 16px; color: var(--text-primary); }
.hub-plan-row { display: flex; align-items: center; gap: 16px; padding: 10px 8px; border-top: 1px solid var(--border-color); cursor: pointer; border-radius: 6px; }
.hub-plan-row:first-of-type { border-top: 0; }
.hub-plan-row:hover, .hub-plan-row:focus-visible { background: var(--surface-hover, rgba(127,127,127,0.08)); outline: none; }
.hub-plan-main { flex: 1; min-width: 0; }
.hub-plan-title { font-size: 14px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.hub-plan-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.hub-plan-overdue { color: #E53E3E; font-weight: 600; }
.hub-plan-progress { flex-shrink: 0; width: 140px; display: flex; align-items: center; gap: 8px; }
.hub-plan-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--border-color); overflow: hidden; }
.hub-plan-bar span { display: block; height: 100%; background: var(--accent); }
.hub-plan-pct { font-size: 12px; color: var(--text-secondary); min-width: 44px; text-align: right; }
@media (max-width: 480px) { .hub-plan-row { flex-wrap: wrap; } .hub-plan-progress { width: 100%; } }

/* ---- Advisor panel: conversation history selector (5.97.6+) ---- */
.ai-advisor-panel-history-bar { padding: 6px 12px; border-bottom: 1px solid var(--border-color); }
.ai-advisor-panel-history-bar select { width: 100%; font-size: 12px; padding: 6px 8px; }

/* ======================================================================
   BRIEF PRIORIZADO (5.98.0+) — js/brief.js. Calm rows: a band dot, the text,
   one meta line, the score. Bands use muted tones in both themes.
   ====================================================================== */
body { --band-critica: #C53030; --band-alta: #C77D1A; --band-media: #3182CE; --band-baja: #A0AEC0; }
body[data-theme="light"] { --band-critica: #B83232; --band-alta: #B26A12; --band-media: #2B6CB0; --band-baja: #A0AEC0; }
.brief-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.brief-head h1 { margin: 0 0 var(--space-1) 0; }
.brief-head .subtitle { margin-bottom: var(--space-4); }
.brief-head-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.brief-tabs { display: flex; gap: var(--space-1); overflow-x: auto; margin-bottom: var(--space-3); padding-bottom: 2px; }
.brief-tabs .prospeccion-tab { flex-shrink: 0; }
.brief-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-4); }
.brief-filters { flex: 1 1 320px; min-width: 0; border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-2) var(--space-3); background: var(--surface-subtle); }
.brief-filters > summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); min-height: 28px; display: flex; align-items: center; }
.brief-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-2) var(--space-3); margin: var(--space-3) 0; }
.brief-filter { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); color: var(--text-muted); min-width: 0; }
.brief-filter .input-field { padding: 6px 8px; font-size: var(--fs-sm); margin: 0; min-width: 0; }
.brief-vercomo { flex: 0 1 240px; }
.brief-counts { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.brief-countchip { font-size: var(--fs-xs); color: var(--text-secondary); background: var(--surface-subtle); border: 1px solid var(--border-color); border-radius: 999px; padding: 3px 10px; }
.brief-countchip strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.brief-countchip.warn strong { color: var(--band-critica); }
.brief-block { margin-bottom: var(--space-4); }
.brief-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.brief-block-head h3 { margin: 0; font-size: var(--fs-md); color: var(--text-primary); }
.brief-count { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.brief-intro { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0 0 var(--space-2) 0; line-height: 1.5; }
.brief-empty { font-size: var(--fs-sm); color: var(--text-muted); margin: 0; }
.brief-muted { color: var(--text-muted); font-weight: 400; }
.brief-row { display: flex; align-items: flex-start; gap: var(--space-3); padding: 10px var(--space-2); border-top: 1px solid var(--border-color); cursor: pointer; border-radius: var(--radius-sm); min-height: 44px; }
.brief-block .brief-row:first-of-type, .brief-card .brief-counts + .brief-row, .brief-more > .brief-row:first-of-type { border-top: 0; }
.brief-row:hover, .brief-row:focus-visible { background: var(--surface-hover); outline: none; }
.brief-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--band-baja); }
.brief-row[data-banda="critica"] .brief-dot { background: var(--band-critica); }
.brief-row[data-banda="alta"] .brief-dot { background: var(--band-alta); }
.brief-row[data-banda="media"] .brief-dot { background: var(--band-media); }
.brief-main { flex: 1; min-width: 0; }
.brief-text { font-size: var(--fs-base); color: var(--text-primary); line-height: 1.4; overflow-wrap: anywhere; }
.brief-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.brief-score { flex-shrink: 0; font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; margin-top: 2px; }
.brief-overdue { color: var(--band-critica); font-weight: 600; }
.brief-today { color: var(--band-alta); font-weight: 600; }
.brief-more > summary, .brief-group > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--text-secondary); padding: 8px var(--space-2); min-height: 32px; }
.brief-group { border-top: 1px solid var(--border-color); }
.brief-group:first-of-type { border-top: 0; }
.brief-news { font-size: var(--fs-sm); color: var(--text-secondary); padding: 6px 0; border-top: 1px solid var(--border-color); overflow-wrap: anywhere; }
.brief-news span { color: var(--text-muted); font-size: var(--fs-xs); }
.brief-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); }
.brief-kpis > div { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2) var(--space-3); border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.brief-kpis strong { font-size: var(--fs-lg); color: var(--text-primary); }
.brief-kpis span { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.4; }
.brief-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.brief-card-head h3 { margin: 0; font-size: 16px; color: var(--text-primary); }
.brief-card .brief-counts { margin-bottom: var(--space-2); }
.brief-subhead { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin: var(--space-3) 0 var(--space-1) var(--space-2); }
.brief-card-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
.brief-flash { animation: brief-flash 2.4s ease-out; }
@keyframes brief-flash { 0%, 30% { box-shadow: 0 0 0 2px var(--accent); background: var(--surface-hover); } 100% { box-shadow: none; } }
@media (max-width: 600px) {
    .brief-head-actions { width: 100%; }
    .brief-filter-grid { grid-template-columns: 1fr 1fr; }
    .brief-vercomo { flex: 1 1 100%; }
    .brief-row { padding: 10px 4px; }
}

/* GTD capture tags (5.98.0+) */
.gtd-tags { margin-top: var(--space-3); border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-2) var(--space-3); background: var(--surface-subtle); }
.gtd-tags > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--text-secondary); min-height: 28px; display: flex; align-items: center; }
.gtd-tags-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-3); margin-top: var(--space-3); }
.gtd-tags-grid label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); min-width: 0; }
.gtd-tags-grid .input-field { margin: 0; padding: 6px 8px; font-size: var(--fs-sm); }
.gtd-tags-grid .gtd-tags-wide { grid-column: 1 / -1; }
.gtd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gtd-chip { font-size: var(--fs-xs); padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); cursor: pointer; min-height: 30px; }
.gtd-chip.active { border-color: var(--accent); color: var(--text-primary); background: var(--surface-hover); font-weight: 600; }
.gtd-note { font-size: var(--fs-xs); color: var(--text-muted); margin: var(--space-2) 0 0 0; }
.gtd-tagline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.gtd-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-color); color: var(--text-secondary); }
.gtd-tag.nueva { border-color: var(--band-alta); color: var(--band-alta); }
@media (max-width: 600px) {
    #gtd-quick-overlay .modal-content { max-width: 100% !important; width: 100%; }
    .gtd-tags-grid { grid-template-columns: 1fr; }
}

/* ---- Seguimiento comercial (5.99.0+): next step, overdue, cadence chips ---- */
body { --seg-danger: #E53E3E; --seg-warn: #D69E2E; --seg-ok: #38A169; }
body[data-theme="light"] { --seg-danger: #C53030; --seg-warn: #975A16; --seg-ok: #276749; }
.seg-overdue { color: var(--seg-danger) !important; font-weight: 600; }
.seg-date.seg-overdue { color: var(--seg-danger) !important; }
.seg-warn { color: var(--seg-warn) !important; }
.seg-input-overdue { border-color: var(--seg-danger) !important; }
.seg-missing { color: var(--seg-warn) !important; font-size: var(--fs-xs); }
.seg-idle { color: var(--text-muted) !important; font-size: 11px; }
.seg-next-cell { min-width: 170px; max-width: 280px; font-size: var(--fs-xs); line-height: 1.35; }
.seg-next-text { color: var(--text-primary); overflow-wrap: anywhere; }
.seg-next-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.seg-date { font-size: 11px; color: var(--text-secondary) !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.seg-next-line .seg-missing { font-size: inherit; }
.seg-next-line { font-size: 11px; margin-top: 6px; line-height: 1.35; color: var(--text-secondary); overflow-wrap: anywhere; }
.seg-sum, .seg-cad-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border-color); font-size: var(--fs-xs); }
.seg-sum-label { color: var(--text-muted) !important; margin-right: 4px; }
.seg-sum-item { background: transparent; border: 1px solid var(--border-color); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: var(--fs-xs); color: var(--text-secondary); cursor: pointer; }
.seg-sum-item strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.seg-sum-item:not(.has) { opacity: 0.6; }
.seg-sum-item.danger strong { color: var(--seg-danger); }
.seg-sum-item:hover, .seg-sum-item:focus-visible { background: var(--surface-hover); outline: none; }
.seg-sum-item.active { border-color: var(--accent); background: var(--surface-subtle); }
.seg-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; border: 1px solid currentColor; line-height: 1.5; white-space: nowrap; }
.seg-chip--ok { color: var(--seg-ok) !important; }
.seg-chip--warn { color: var(--seg-warn) !important; }
.seg-chip--danger { color: var(--seg-danger) !important; }
.seg-chip--muted { color: var(--text-muted) !important; }
.seg-nextstep-box { margin-top: var(--space-2); padding: var(--space-3); border: 1px dashed var(--border-color); border-radius: var(--radius-sm); background: var(--surface-subtle); }
.seg-nextstep-title { font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 600; margin-bottom: var(--space-2); }
.seg-quick-extra { margin-top: var(--space-3); }
.seg-cad-table { width: 100%; max-width: 560px; border-collapse: collapse; font-size: var(--fs-sm); }
.seg-cad-table th { text-align: left; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; padding: 4px 8px 6px 0; }
.seg-cad-table td { padding: 4px 8px 4px 0; vertical-align: middle; }
.seg-cad-table input { max-width: 110px; }
@media (max-width: 600px) {
    .seg-link-grid, .seg-nextstep-grid { grid-template-columns: 1fr !important; }
}

/* Monitoreo de correo — Outlook (5.100.0+) */
.ol-panel { padding: var(--space-4) var(--space-5); }
.ol-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; }
.ol-title { margin: 0 0 var(--space-1) 0; font-size: var(--fs-md); text-wrap: balance; }
.ol-intro { margin: 0; font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.5; max-width: 64ch; }
.ol-switch { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; min-height: 32px; }
.ol-switch input { accent-color: var(--accent); width: 18px; height: 18px; }
.ol-section { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border-color); }
.ol-subhead { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--space-2); }
.ol-details > summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); min-height: 32px; display: flex; align-items: center; }
.ol-mailbox, .ol-log-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; flex-wrap: wrap; }
.ol-mailbox + .ol-mailbox, .ol-log-row + .ol-log-row { border-top: 1px dashed var(--border-color); }
.ol-mailbox-main, .ol-log-main { min-width: 0; flex: 1 1 260px; }
.ol-mailbox-addr, .ol-log-subject { font-size: var(--fs-sm); font-weight: 600; overflow-wrap: anywhere; }
.ol-mailbox-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.ol-mailbox-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.ol-state { font-weight: 600; color: var(--text-secondary); }
.ol-state-ok { color: #6FBF8A; }
body[data-theme="light"] .ol-state-ok { color: #2F7A4A; }
.ol-state-warn { color: var(--band-alta, #C77D1A); }
.ol-empty { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.ol-add { display: grid; grid-template-columns: 2fr 1.4fr auto; gap: var(--space-2); margin-top: var(--space-3); align-items: center; }
.ol-add .input-field { margin: 0; padding: 6px 8px; font-size: var(--fs-sm); }
.ol-rules { margin-top: var(--space-3); }
.ol-rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-2) var(--space-3); }
.ol-field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); min-width: 0; }
.ol-field .input-field { margin: 0; padding: 6px 8px; font-size: var(--fs-sm); }
.ol-field-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); margin: var(--space-3) 0 var(--space-1) 0; }
.ol-checks { display: flex; flex-direction: column; gap: 6px; margin-top: var(--space-3); }
.ol-check { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-sm); color: var(--text-secondary); cursor: pointer; }
.ol-check input { accent-color: var(--accent); margin-top: 3px; }
.ol-email-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; overflow-wrap: anywhere; }
.ol-email-meta .ol-email-from { color: var(--text-secondary); font-weight: 600; }
.ol-email-meta a { color: var(--accent); text-decoration: underline; }
@media (max-width: 600px) {
    .gtd-row { flex-wrap: wrap; }
    .gtd-row > .gtd-row-actions { width: 100%; justify-content: flex-start !important; padding-left: 34px; }
    .ol-panel { padding: var(--space-3); }
    .ol-add { grid-template-columns: 1fr; }
    .ol-mailbox-actions { width: 100%; }
}

/* ======================================================================
   CALM UI LAYER — second phase (5.106.0+): D2 neutral cards + one accent,
   D3 line icons (uiIcon in js/utils.js), D6 nothing below --fs-xs (12px).
   Colour only for status: --status-ok / --status-warn / --status-danger.
   Covers the home hub, dashboard, the board engine (Transición + Planes),
   Planes de Ejecución and Capacidades del Equipo.
   ====================================================================== */
body { --status-ok: var(--seg-ok); --status-warn: var(--seg-warn); --status-danger: var(--seg-danger); }
.ui-icon { flex-shrink: 0; vertical-align: -0.18em; }
.ui-meta { display: inline-flex; align-items: center; gap: 5px; }
.ui-meta .ui-icon { color: var(--text-muted); }
.ui-status { font-weight: 600; }
.ui-status--ok { color: var(--status-ok) !important; }
.ui-status--warn { color: var(--status-warn) !important; }
.ui-status--danger { color: var(--status-danger) !important; }
.prospeccion-tab .ui-icon { margin-right: 6px; opacity: 0.8; }

/* ---- Home hub ---- */
.hub-ws { margin-bottom: var(--space-6); }
.hub-ws-title { margin: 0 0 var(--space-3) 0; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.hub-card { cursor: pointer; text-align: left; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-4); color: inherit; font-family: inherit; display: flex; flex-direction: column; gap: 6px; width: 100%; min-width: 0; transition: border-color 0.15s, background 0.15s; }
.hub-card:hover { border-color: var(--accent); background: var(--surface-hover); }
.hub-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hub-card-head { display: flex; align-items: center; gap: 10px; }
.hub-card-icon { display: inline-flex; color: var(--text-secondary); }
.hub-card:hover .hub-card-icon { color: var(--accent); }
.hub-card-title { font-size: var(--fs-md); color: var(--text-primary); font-weight: 600; }
.hub-card-desc { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.5; }
.hub-banner { cursor: pointer; }
.hub-banner:hover { border-color: var(--accent); }
.hub-banner-row { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.hub-banner-icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-hover); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; }
.hub-banner-main { flex: 1; min-width: 200px; }
.hub-banner-main h3 { margin: 0 0 4px 0; font-size: 16px; color: var(--text-primary); }
.hub-banner-main p { margin: 0; font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.5; }
.hub-banner-cta { flex-shrink: 0; }
.hub-plan-overdue { color: var(--status-danger); }

/* ---- Board engine (js/transicion.js) shared by Transición and Planes ---- */
.tr-headline { font-size: var(--fs-sm); color: var(--text-muted); }
.tr-intro { font-size: var(--fs-sm); color: var(--text-muted); margin: 0; }
.tr-fase-sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.tr-danger { color: var(--status-danger); font-weight: 600; }
.tr-danger-btn { color: var(--status-danger) !important; }
.btn.tr-btn { padding: 6px 12px; font-size: var(--fs-xs); }
.tr-chip { border-width: 1px; font-weight: 500; background: transparent; }
.tr-chip:hover { filter: none; background: var(--surface-hover); border-color: var(--accent); }
.tr-progress > div { background: var(--accent); }
.tr-progress.is-done > div { background: var(--status-ok); }
.tr-count, .tr-tag, .tr-meta, .tr-more, .tr-num, .tr-kpi-l, .tr-table th { font-size: var(--fs-xs); }
.tr-tag { background: var(--surface-hover); }
.tr-tag.ui-status { background: transparent; border: 1px solid currentColor; padding: 1px 8px; }
.tr-tag-tipo { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; vertical-align: 1px; }
.tr-tag-tipo .ui-icon { color: var(--text-muted); }
.tr-tag.now { background: transparent; color: var(--status-ok); border: 1px solid currentColor; }
.tr-kpi { border: 1px solid var(--border-color); border-left-width: 1px; border-radius: var(--radius); background: var(--bg-card); cursor: pointer; }
.tr-kpi:hover, .tr-kpi:focus-visible { border-color: var(--accent); outline: none; }
.tr-kpi-n { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.tr-kpi.is-danger .tr-kpi-n { color: var(--status-danger); }
.tr-kpi-l { text-transform: none; letter-spacing: 0; }
.tr-bar { cursor: pointer; padding: 2px 4px; border-radius: var(--radius-sm); }
.tr-bar:hover, .tr-bar:focus-visible { background: var(--surface-hover); outline: none; }
.tr-bar-l span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.tr-bar-l .ui-icon { color: var(--text-muted); }
.tr-filters { border: none; background: var(--surface-subtle); }
.tr-search { min-width: 200px; }
.tr-guia { border-color: var(--border-color); background: var(--surface-subtle); }
.tr-fase { background: transparent; }
.tr-fase.actual { border-color: var(--accent); }
/* Rows: a list with hairline dividers instead of a card per row. */
.tr-row { border: none; border-top: 1px solid var(--border-color); border-radius: 0; background: transparent; margin: 0; padding: 10px 6px; }
.tr-row:hover { background: var(--surface-subtle); }
.tr-row.overdue { border-left: none; box-shadow: inset 3px 0 0 var(--status-danger); }
/* Inline row controls read as text until hovered or focused. */
.tr-row .tr-select { border: 0; background: transparent; box-shadow: inset 0 0 0 1px transparent; color: var(--text-secondary); }
.tr-row .tr-select:hover:not(:disabled), .tr-row .tr-select:focus { box-shadow: inset 0 0 0 1px var(--border-color); background: var(--surface-subtle); outline: none; }
.tr-row .tr-select:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.tr-row .tr-select.overdue { color: var(--status-danger); }
.tr-row .tr-select option { color: var(--text-primary); background: var(--surface-raised); }
.tr-st-en-curso { color: var(--status-warn) !important; }
.tr-st-hecho { color: var(--status-ok) !important; }
.tr-st-bloqueado { color: var(--status-danger) !important; font-weight: 600; }
.tr-pr-critica { color: var(--status-danger) !important; font-weight: 600; }
.tr-icon { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; min-height: 30px; border-radius: var(--radius-sm); }
.tr-icon:hover { background: var(--surface-hover); }

/* ---- Planes de Ejecución + Capacidades ---- */
.pe-icon { flex-shrink: 0; width: 36px; height: 36px; border-radius: var(--radius); background: var(--surface-hover); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; }
.pe-icon-sm { width: 28px; height: 28px; margin-right: 4px; }
.pe-card:hover .pe-icon { color: var(--accent); }
.pe-tipo-opt { align-items: center; }
.pe-back { font-size: var(--fs-sm); color: var(--text-secondary); }
.pe-back:hover { color: var(--accent); }
.pe-board-title { display: flex; align-items: center; gap: var(--space-3); margin: 0 0 4px 0; }
.pe-board-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.pe-card-desc { font-size: var(--fs-sm); }
.cap-line { font-size: var(--fs-xs); color: var(--text-secondary); }
.cap-muted { color: var(--text-muted); }
.pe-card input[type="range"] { accent-color: var(--accent); }

/* ---- DASHBOARD CHARTS (js/dashboard.js) ---- */
#section-dashboard .dash-group-head { padding-bottom: var(--space-2); border-bottom: 1px solid var(--border-color); }
#section-dashboard .dash-group-head h2 { margin: 0; font-size: var(--fs-lg); color: var(--text-primary); display: flex; align-items: center; gap: 10px; }
#section-dashboard .dash-h-icon { display: inline-flex; color: var(--text-muted); }
#section-dashboard .dash-kpi-n { color: var(--text-primary); font-variant-numeric: tabular-nums; }
#dashboard-kpis .text-xs { letter-spacing: 0.04em; color: var(--text-muted) !important; }
#section-dashboard h3 { font-size: var(--fs-md); }
.dash-bar-row { display: grid; grid-template-columns: minmax(90px, 140px) minmax(60px, 1fr) auto minmax(0, 96px); align-items: center; gap: 10px; margin-bottom: 10px; font-size: var(--fs-xs); }
.dash-bar-label { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.dash-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; }
.dash-bar-track { height: 10px; border-radius: 5px; background: var(--surface-hover); overflow: hidden; }
.dash-bar-fill { height: 100%; border-radius: 5px; background: var(--accent); transition: width 0.4s; }
.dash-bar-value { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; font-size: var(--fs-sm); }
.dash-bar-meta { color: var(--text-muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-num { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-sub { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 400; }
.dash-big { font-size: 28px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
#section-dashboard .is-ok { color: var(--status-ok) !important; }
#section-dashboard .is-danger { color: var(--status-danger) !important; }
.dash-swatch { display: inline-block; flex-shrink: 0; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.dash-swatch-neutral { background: var(--text-muted); opacity: 0.45; }
.dash-legend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border-color); font-size: var(--fs-sm); }
.dash-legend-row:first-child { border-top: 0; }
.dash-legend-key { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); min-width: 0; }
.dash-legend-val { text-align: right; }
.dash-legend-val-row { display: flex; align-items: baseline; gap: 16px; }
.dash-legend-inline { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; font-size: var(--fs-xs); color: var(--text-secondary); }
.dash-legend-inline > span, .dash-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-secondary); }
.dash-total-row { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-secondary); }
.dash-cols { display: flex; justify-content: space-around; align-items: flex-end; height: 150px; padding-bottom: 10px; }
.dash-col { display: flex; flex-direction: column; align-items: center; width: 18%; }
.dash-col-value { font-size: var(--fs-xs); font-weight: 600; color: var(--text-primary); margin-bottom: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dash-col-bar { width: 100%; max-width: 44px; min-height: 3px; background: var(--accent); border-radius: 4px 4px 0 0; transition: height 0.4s; }
.dash-cols-axis { display: flex; justify-content: space-around; border-top: 1px solid var(--border-color); padding-top: 8px; }
.dash-col-axis { text-align: center; width: 18%; }
.dash-col-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); }
.dash-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.dash-tile { background: var(--surface-subtle); border-radius: var(--radius-sm); padding: var(--space-3); }
.dash-tile-center { text-align: center; }
.dash-tile-l { font-size: var(--fs-xs); color: var(--text-muted); }
.dash-tile-n { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-top: 4px; font-variant-numeric: tabular-nums; }
.dash-rate-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.dash-winloss { display: flex; gap: var(--space-5); flex-wrap: wrap; }
.dash-winloss-col { flex: 1 1 240px; display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.dash-reasons { background: var(--surface-subtle); border-radius: var(--radius-sm); padding: 10px; }
.dash-reasons-title { font-size: var(--fs-xs); font-weight: 600; margin-bottom: 6px; }
.dash-reason { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-xs); padding: 3px 0; color: var(--text-secondary); }
.dash-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 160px; height: 100%; color: var(--text-muted); font-size: var(--fs-sm); text-align: center; }
.dash-velocity { display: flex; flex-direction: column; height: 100%; gap: var(--space-4); }
.dash-velocity .dash-rate-head { margin-bottom: 0; }
.dash-velocity-bars { flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.dash-tip { display: flex; align-items: flex-start; gap: 8px; background: var(--surface-subtle); border-radius: var(--radius-sm); padding: 10px 14px; font-size: var(--fs-xs); color: var(--text-secondary); }
.dash-tip .ui-icon { color: var(--status-warn); margin-top: 1px; }
.dash-scn { display: flex; flex-direction: column; align-items: center; width: 25%; }
.dash-scn-value { font-size: var(--fs-lg); font-weight: 700; color: var(--text-primary); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.dash-scn-bar { width: 64px; max-width: 100%; background: var(--text-muted); opacity: 0.35; border-radius: 6px 6px 0 0; transition: height 0.4s; }
.dash-scn.is-current .dash-scn-bar { background: var(--accent); opacity: 1; }
.dash-scn-label { margin-top: 10px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); }
.dash-timeline { display: flex; justify-content: space-around; align-items: flex-end; height: 280px; padding: 20px 0 16px 0; }
.dash-timeline-week { display: flex; flex-direction: column; align-items: center; width: 30%; }
.dash-timeline-bars { display: flex; align-items: flex-end; gap: 4px; height: 220px; justify-content: center; }
.dash-timeline-bar { width: 24px; min-height: 3px; border-radius: 4px 4px 0 0; transition: height 0.4s; }
#chart-priority-pie { box-shadow: none; }
.pie-chart-circle { box-shadow: none; }
@media (max-width: 600px) {
    .dash-bar-row { grid-template-columns: 1fr auto; row-gap: 4px; }
    .dash-bar-track { grid-column: 1 / -1; grid-row: 2; }
    .dash-bar-meta { display: none; }
    .dash-tiles { grid-template-columns: 1fr; }
    .dash-scn-bar { width: 40px; }
    .dash-timeline-bar { width: 14px; }
    .tr-search { min-width: 0; flex: 1 1 100%; }
    /* Values that clipped inside their cards at phone width */
    #section-dashboard .dash-kpi-n { font-size: clamp(16px, 4.8vw, 28px) !important; white-space: nowrap; }
    #section-dashboard div:has(> #chart-priority-pie) { flex-wrap: wrap; justify-content: center; gap: 16px !important; }
    #chart-priority-legend { flex: 1 1 100% !important; }
    .dash-col-axis .dash-sub { overflow-wrap: anywhere; }
}

/* =====================================================================
   CALM UI — navigation (5.107.0+): D1 seven areas with quiet sub-heads,
   D4 optional modules, D5 one compact «Inicio + vista» control.
   ===================================================================== */
.nav-subhead { padding: 10px 20px 4px 28px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); letter-spacing: 0; text-transform: none; }
.nav-group-items > .nav-subgroup:first-child .nav-subhead { padding-top: 4px; }
.nav-group.nav-empty, .nav-subgroup.nav-empty, .nav-search-hidden { display: none !important; }
body.nav-searching .nav-group { display: block !important; }
body.nav-searching .nav-group.nav-search-hidden, body.nav-searching .nav-group.nav-empty, body.nav-searching .nav-group.nav-item-inactive { display: none !important; }
.nav-group-header { font-size: var(--fs-xs); }
.nav-group-header:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }

#workspace-switcher-container { padding: 8px 16px 8px; border-bottom: 1px solid var(--border-color); margin-bottom: 6px; }
.nav-switch { position: relative; display: flex; align-items: stretch; border: 1px solid var(--border-color); border-radius: var(--radius-sm, 8px); background: var(--surface-subtle); }
.nav-switch button { font-family: inherit; }
.nav-switch-home, .nav-switch-view { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 7px 10px; background: transparent; border: 0; color: var(--text-primary); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; transition: background 0.15s, color 0.15s; }
.nav-switch-home { flex: 1 1 auto; border-radius: 7px 0 0 7px; }
.nav-switch-view { flex: 0 1 auto; border-left: 1px solid var(--border-color); border-radius: 0 7px 7px 0; color: var(--text-secondary); font-weight: 500; }
.nav-switch-view.filtered { color: var(--accent); }
.nav-switch-home:hover, .nav-switch-view:hover, .nav-switch-view[aria-expanded="true"] { background: var(--surface-hover); }
.nav-switch-home:focus-visible, .nav-switch-view:focus-visible, .nav-switch-option:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nav-switch-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-switch-view-icon { display: inline-flex; }
.nav-switch .ui-icon, .nav-switch-chevron, .nav-switch-check { flex-shrink: 0; }
.nav-switch-chevron { transition: transform 0.15s; opacity: 0.7; }
.nav-switch-view[aria-expanded="true"] .nav-switch-chevron { transform: rotate(180deg); }
.nav-switch-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 70; padding: 6px; background: var(--surface-raised); border: 1px solid var(--border-color); border-radius: var(--radius, 10px); box-shadow: 0 12px 32px rgba(0,0,0,0.3); display: flex; flex-direction: column; gap: 2px; }
.nav-switch-menu[hidden] { display: none; }
.nav-switch-menu-title { padding: 4px 8px 6px; font-size: var(--fs-xs); color: var(--text-muted); }
.nav-switch-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; background: transparent; border: 0; border-radius: 6px; color: var(--text-primary); font-size: var(--fs-sm); text-align: left; cursor: pointer; }
.nav-switch-option span { flex: 1; }
.nav-switch-option:hover, .nav-switch-option:focus { background: var(--surface-hover); outline: none; }
.nav-switch-option .nav-switch-check { visibility: hidden; color: var(--accent); }
.nav-switch-option[aria-checked="true"] .nav-switch-check { visibility: visible; }
.nav-switch-option[aria-checked="true"] { font-weight: 600; }

/* Mobile menu (generated from the sidebar) */
.mobile-nav-subhead { padding: 10px 20px 2px 24px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.mobile-nav-item { cursor: pointer; }
.mobile-nav-item .ui-icon { flex-shrink: 0; }
.mobile-nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mobile-nav-group-header { font-size: var(--fs-xs); }
[data-theme="light"] .mobile-nav-overlay { background: rgba(255,255,255,0.98); }
[data-theme="light"] .mobile-nav-item { color: var(--text-primary); }

/* ======================================================================
   ORGANIGRAMA + ADOPCIÓN E IMPACTO DE IA (5.108.0+)
   js/organigrama.js · js/impacto-ia.js. Neutral cards, one accent, colour
   only for status and for the división stripe (it groups and colours).
   The tree is HTML/CSS with connectors: wide trees scroll inside
   .org-scroll; at ≤ 640 px it becomes an indented vertical tree.
   ====================================================================== */
body { --org-line: rgba(255,255,255,0.22); }
body[data-theme="light"] { --org-line: rgba(0,0,0,0.22); }
.org-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.org-empty { font-size: var(--fs-sm); color: var(--text-muted); }
.org-empty-card { text-align: center; padding: var(--space-6) var(--space-4); }
.org-status-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin: var(--space-3) 0; }
.org-status-main { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-secondary); }
.org-status-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.org-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid currentColor; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); }
.org-notas { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0 0 var(--space-3) 0; max-width: 80ch; }
.org-controls { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: flex-end; margin: var(--space-2) 0 var(--space-3); }
.org-controls:empty { display: none; }
.org-ctl { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); color: var(--text-muted); min-width: 150px; }
.org-ctl--grow { flex: 1 1 200px; }
.org-ctl--check { flex-direction: row; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-sm); color: var(--text-secondary); padding-bottom: 8px; }
.org-select { padding: 6px 10px; font-size: var(--fs-sm); }
.org-group-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); margin: var(--space-5) 0 var(--space-2); }
.org-div-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.org-scroll { overflow: auto; max-width: 100%; padding: var(--space-2) 0 var(--space-4); border-radius: var(--radius); }
.org-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.org-tree { display: inline-block; min-width: 100%; }
.org-tree ul, .org-tree li { list-style: none; margin: 0; }

/* Card */
.org-card { position: relative; display: flex; flex-direction: column; gap: 3px; width: 184px; min-height: 84px; padding: 10px 12px 10px 12px; text-align: left; font-family: inherit; color: var(--text-primary); background: var(--surface-raised); border: 1px solid var(--border-color); border-top: 3px solid var(--org-div, var(--border-color)); border-radius: var(--radius); box-sizing: border-box; }
button.org-card { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
button.org-card:hover { border-color: var(--accent); border-top-color: var(--org-div); background: var(--surface-hover); }
button.org-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.org-card--flag { border-style: dashed; border-top-style: solid; }
.org-card--compact { width: 100%; min-height: 0; }
.org-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: var(--fs-xs); color: var(--text-muted); }
.org-card-div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-card-title { font-size: var(--fs-sm); font-weight: 650; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere; }
.org-card-cant { font-weight: 500; color: var(--text-muted); font-size: var(--fs-xs); }
.org-card-holders { font-size: var(--fs-xs); color: var(--text-secondary); line-height: 1.35; overflow-wrap: anywhere; }
.org-card-holders.is-empty { color: var(--text-muted); font-style: italic; }
.org-card-fn { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-muted); }
.org-fn-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.org-card-flag { display: flex; align-items: flex-start; gap: 4px; font-size: var(--fs-xs); color: var(--status-danger); line-height: 1.3; }
.org-pill { font-size: var(--fs-xs); padding: 0 6px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.org-pill--warn { color: var(--status-warn); }
.org-group { display: flex; flex-direction: column; gap: 6px; padding: 8px; width: 204px; box-sizing: border-box; border: 1px dashed var(--org-line); border-radius: var(--radius); background: var(--surface-subtle); }

/* Tooltip (map): the .org-tip inside each card holds the text; js/impacto-ia.js
   shows it in one fixed #iia-tooltip on hover and keyboard focus, so scroll
   containers never clip it. */
.org-tip { display: none; }
.iia-tooltip { position: fixed; z-index: 1200; width: 270px; max-width: calc(100vw - 24px); padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-raised); color: var(--text-primary); border: 1px solid var(--border-color); box-shadow: 0 10px 28px rgba(0,0,0,0.35); font-size: var(--fs-xs); line-height: 1.45; pointer-events: none; }
.iia-tooltip ul { margin: 6px 0 4px; padding-left: 16px; }
.iia-tooltip em { color: var(--text-muted); }

/* Connectors — desktop: top-down tree */
@media (min-width: 641px) {
    .org-tree ul { display: flex; justify-content: center; position: relative; padding: 20px 0 0 0; }
    .org-tree ul.org-level--root { padding-top: 0; gap: 28px; align-items: flex-start; }
    .org-tree li { position: relative; display: flex; flex-direction: column; align-items: center; padding: 20px 6px 0; }
    .org-tree ul.org-level--root > li { padding-top: 0; }
    .org-tree li::before, .org-tree li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 20px; border-top: 1px solid var(--org-line); }
    .org-tree li::after { right: auto; left: 50%; border-left: 1px solid var(--org-line); }
    .org-tree li:only-child::before, .org-tree li:only-child::after { display: none; }
    .org-tree li:only-child { padding-top: 0; }
    .org-tree li:first-child::before, .org-tree li:last-child::after { border: 0 none; }
    .org-tree li:last-child::before { border-right: 1px solid var(--org-line); border-radius: 0 6px 0 0; }
    .org-tree li:first-child::after { border-radius: 6px 0 0 0; }
    .org-tree ul.org-level--root > li::before, .org-tree ul.org-level--root > li::after { display: none; }
    .org-tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 20px; border-left: 1px solid var(--org-line); }
}
/* Connectors — phone: indented vertical tree */
@media (max-width: 640px) {
    .org-tree { display: block; }
    .org-tree ul { display: block; padding: 0 0 0 14px; position: relative; }
    .org-tree ul.org-level--root { padding-left: 0; }
    .org-tree li { position: relative; padding: 8px 0 0 14px; }
    .org-tree ul.org-level--root > li { padding-left: 0; }
    .org-tree li::before { content: ''; position: absolute; left: 0; top: 0; width: 12px; height: 34px; border-left: 1px solid var(--org-line); border-bottom: 1px solid var(--org-line); border-radius: 0 0 0 6px; }
    .org-tree li::after { content: ''; position: absolute; left: 0; top: 34px; bottom: 0; border-left: 1px solid var(--org-line); }
    .org-tree li:last-child::after { display: none; }
    .org-tree ul.org-level--root > li::before, .org-tree ul.org-level--root > li::after { display: none; }
    .org-card, .org-group { width: 100%; }
    .org-card .iia-badge { top: 8px; right: 8px; }
    .org-card .org-card-top { padding-right: 56px; }
}

.org-qe-card { margin-top: var(--space-4); }
.org-qe-scroll { overflow-x: auto; }
.org-qe-table { min-width: 720px; margin-bottom: 0; }
.org-qe-table td { vertical-align: middle; }
.org-qe { padding: 5px 8px; font-size: var(--fs-sm); min-width: 120px; }
.org-qe-num { width: 80px; min-width: 70px; }
.org-questions { margin-top: var(--space-5); }
.org-questions-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.org-q-list { list-style: none; padding: 0; margin: 0; }
.org-q-list.is-done .org-q-text { text-decoration: line-through; color: var(--text-muted); }
.org-q { display: flex; align-items: flex-start; gap: 10px; padding: 10px 6px; border-top: 1px solid var(--border-color); }
.org-q-check input { width: 16px; height: 16px; margin-top: 2px; }
.org-q-main { flex: 1; min-width: 0; }
.org-q-text { font-size: var(--fs-base); line-height: 1.45; overflow-wrap: anywhere; }
.org-q-meta { display: flex; gap: var(--space-3); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 3px; }
.org-doc-tree ul { margin-top: 4px; }

/* ---- Impacto de IA ---- */
.iia-kpis { margin-bottom: var(--space-3); }
.iia-kpis .tr-kpi { cursor: default; }
.iia-tabs { margin-bottom: var(--space-3); flex-wrap: wrap; }
.iia-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.iia-views { display: inline-flex; border: 1px solid var(--border-color); border-radius: var(--radius); overflow: hidden; flex-wrap: wrap; }
.iia-view { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.iia-view + .iia-view { border-left: 1px solid var(--border-color); }
.iia-view:hover { background: var(--surface-hover); color: var(--text-primary); }
.iia-view.active { background: var(--accent); color: #111; font-weight: 600; }
.iia-view:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.iia-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.iia-muted { color: var(--text-muted); font-size: var(--fs-sm); }
.iia-para { margin: 0 0 10px 0; font-size: var(--fs-base); line-height: 1.6; color: var(--text-secondary); max-width: 80ch; }
.iia-narr-card { margin-bottom: var(--space-3); }
.iia-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-2); }
.iia-card-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.iia-meta { display: flex; gap: var(--space-3); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }
.iia-op-mini { margin: 6px 0 0 0; padding-left: 18px; font-size: var(--fs-sm); line-height: 1.7; }
.iia-sin { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: var(--space-3); }
.iia-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.iia-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: var(--fs-xs); color: var(--text-secondary); background: var(--surface-hover); border: 1px solid transparent; white-space: nowrap; }
.iia-chip.ui-status { background: transparent; border-color: currentColor; }
.iia-chip--muted { opacity: 0.65; }
.iia-chip--btn { cursor: pointer; font-family: inherit; border-color: var(--border-color); }
.iia-chip--btn:hover, .iia-chip--btn.active { border-color: var(--accent); color: var(--text-primary); }
.iia-chip--btn.active { background: var(--surface-subtle); font-weight: 600; }
.iia-chip--btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.iia-link { background: none; border: 0; padding: 0; font: inherit; color: var(--text-primary); text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--border-color); text-underline-offset: 3px; }
.iia-link:hover, .iia-link:focus-visible { text-decoration-color: var(--accent); outline: none; color: var(--accent); }
.iia-paso-block { margin-top: var(--space-3); }
.iia-details { margin: 8px 0; font-size: var(--fs-sm); }
.iia-details summary { cursor: pointer; color: var(--text-secondary); }
.iia-filters { margin-top: 0; }
.iia-count-line { font-size: var(--fs-xs); color: var(--text-muted); margin: 0 0 6px 0; }
.iia-table-wrap { overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius); }
.iia-table { margin: 0; }
.iia-table th.num, .iia-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.iia-table tfoot td { border-bottom: 0; }
.iia-td-name { padding-left: calc(10px + var(--iia-depth, 0) * 16px) !important; }
.iia-row-group td { background: var(--surface-subtle); }
.iia-desc { display: block; font-size: var(--fs-xs); color: var(--text-secondary); line-height: 1.45; margin: 3px 0; }
.iia-estado-sel { max-width: 150px; }
.iia-row-actions { white-space: nowrap; }
.iia-badge { position: absolute; top: -9px; right: -9px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; background: var(--accent); color: #111; font-size: var(--fs-xs); font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
.iia-badge.is-zero { background: var(--surface-raised); color: var(--text-muted); border: 1px solid var(--border-color); box-shadow: none; }
.iia-badge-ok { display: inline-flex; align-items: center; gap: 2px; padding-left: 4px; border-left: 1px solid rgba(0,0,0,0.25); }
.iia-proc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-2); }

/* Process map: lanes (desktop) / vertical list (phone) */
.iia-flow-scroll { overflow: auto; max-width: 100%; border: 1px solid var(--border-color); border-radius: var(--radius); }
.iia-flow-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.iia-flow { position: relative; }
.iia-lane { position: absolute; left: 0; right: 0; border-bottom: 1px solid var(--border-color); }
.iia-lane.is-alt { background: var(--surface-subtle); }
.iia-lane-label { position: absolute; left: 0; top: 0; bottom: 0; width: 138px; padding: 10px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-secondary); border-right: 1px solid var(--border-color); display: flex; align-items: center; line-height: 1.3; overflow-wrap: anywhere; box-sizing: border-box; }
.iia-flow-svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.iia-flow-line { fill: none; stroke: var(--org-line); stroke-width: 1.5; }
.iia-flow-arrow { fill: var(--org-line); }
.iia-step { position: absolute; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; text-align: left; font-family: inherit; color: var(--text-primary); background: var(--surface-raised); border: 1px solid var(--border-color); border-radius: var(--radius); cursor: pointer; box-sizing: border-box; transition: border-color 0.15s, background 0.15s; }
.iia-step:hover { border-color: var(--accent); background: var(--surface-hover); }
.iia-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.iia-step-n { font-size: var(--fs-xs); font-weight: 700; color: var(--accent); }
.iia-step-name { font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.iia-step-others { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iia-flow-list { display: none; list-style: none; margin: 0; padding: 0; }
.iia-flow-list li { position: relative; padding-bottom: 22px; }
.iia-flow-list li:not(:last-child)::after { content: '↓'; position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); color: var(--text-muted); font-size: var(--fs-sm); }
.iia-flow-list .iia-step { position: relative; width: 100%; min-height: 72px; }
.iia-flow-list-lane { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 4px; }
@media (max-width: 640px) {
    .iia-flow-scroll { display: none; }
    .iia-flow-list { display: block; }
}

/* Side panel */
.iia-panel-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 1000; }
/* Same layer as .modal-overlay (1000): above the FABs (999); a modal opened from the panel is appended later, so it stays on top. */
.iia-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 1000; display: flex; flex-direction: column; background: var(--surface-raised); border-left: 1px solid var(--border-color); box-shadow: -12px 0 32px rgba(0,0,0,0.3); color: var(--text-primary); }
.iia-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--border-color); }
.iia-panel-head h2 { font-size: var(--fs-lg); }
.iia-panel-kicker { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.iia-panel-body { flex: 1; overflow-y: auto; padding: var(--space-4); }
.iia-panel-narr { margin-bottom: var(--space-3); }
.iia-panel-h { font-size: var(--fs-md); margin: var(--space-3) 0 var(--space-2); display: flex; align-items: center; gap: 8px; }
.iia-panel-foot { display: flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border-color); }
.iia-op { padding: var(--space-3) 0; border-top: 1px solid var(--border-color); }
.iia-op.is-muted { opacity: 0.6; }
.iia-op-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-size: var(--fs-base); line-height: 1.4; }
.iia-op-btns { display: inline-flex; flex-shrink: 0; }
.iia-op-estado { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
@media (max-width: 640px) {
    .iia-panel { top: auto; left: 0; width: 100vw; max-height: 88vh; border-left: 0; border-top: 1px solid var(--border-color); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

/* Forms, proposal review, progress */
.iia-fieldset, .iia-step-edit { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 10px 14px 14px; margin: 0 0 12px 0; }
.iia-fieldset legend, .iia-step-edit legend { font-size: var(--fs-sm); font-weight: 600; padding: 0 6px; }
.iia-step-edit { position: relative; }
.iia-step-edit-tools { position: absolute; top: 4px; right: 8px; display: flex; gap: 2px; }
.iia-radio-row { display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: var(--fs-sm); }
.iia-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; max-height: 140px; overflow-y: auto; padding: 8px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-size: var(--fs-sm); }
.iia-checks label { display: inline-flex; align-items: center; gap: 6px; }
.iia-gen-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.iia-gen-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border-color); cursor: pointer; font-size: var(--fs-sm); }
.iia-gen-row:last-child { border-bottom: 0; }
.iia-gen-row input { margin-top: 3px; }
.iia-prop-card { border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-3); margin-bottom: var(--space-3); }
.iia-prop-lbl { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 4px; }
.iia-prop-lbl.is-accent { color: var(--accent); }
.iia-prop-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-3); margin-top: 6px; }
.iia-prop-narr-check { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 600; }
.iia-prop-op { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-top: 1px solid var(--border-color); font-size: var(--fs-sm); cursor: pointer; }
.iia-prop-op input { margin-top: 3px; }
.iia-prop-op.is-dup { opacity: 0.55; cursor: default; }
.iia-prop-paso { font-size: var(--fs-sm); font-weight: 600; margin: 10px 0 2px; color: var(--text-secondary); }
.iia-prop-err { margin-bottom: var(--space-3); padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--status-danger); font-size: var(--fs-sm); }
.iia-progress { height: 4px; background: var(--surface-hover); border-radius: 2px; overflow: hidden; margin-top: 12px; }
.iia-progress > div { height: 100%; background: var(--accent); transition: width 0.3s; }

/* Tables become cards on phones (no horizontal page scroll) */
@media (max-width: 640px) {
    .iia-table-wrap { border: 0; overflow: visible; }
    .iia-table, .iia-table tbody, .iia-table tfoot, .iia-table tr, .iia-table td { display: block; width: 100%; box-sizing: border-box; }
    .iia-table { min-width: 0 !important; }
    .iia-table thead { display: none; }
    .iia-table tr { border: 1px solid var(--border-color); border-radius: var(--radius); margin-bottom: 8px; padding: 6px 10px; background: var(--bg-card); }
    .iia-table td { border: 0; padding: 4px 0 !important; display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; text-align: right; }
    .iia-table td::before { content: attr(data-label); font-size: var(--fs-xs); color: var(--text-muted); text-align: left; flex-shrink: 0; max-width: 45%; }
    .iia-table td[data-label=""]::before { content: none; }
    .iia-table td:first-child { display: block; text-align: left; }
    .iia-table td:first-child::before { display: block; margin-bottom: 2px; }
    .iia-table td.num { text-align: right; }
    .iia-table td:empty { display: none; }
    .iia-views { width: 100%; }
    .iia-view { flex: 1 1 auto; justify-content: center; padding: 8px 6px; }
    .iia-view span { font-size: var(--fs-xs); }
}

/* ===== Adjuntos protegidos de ítems de plan (5.109.0+) ===== */
.tr-adj { margin: 8px 0 6px; padding: var(--space-2, 8px) var(--space-3, 12px); border: 1px solid var(--border-color); border-radius: var(--radius, 8px); background: var(--surface-subtle); }
.tr-adj-head { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm, 13px); margin-bottom: 4px; color: var(--text-primary); }
.tr-adj-list { list-style: none; margin: 0 0 6px; padding: 0; }
.tr-adj-item { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 4px 0; border-bottom: 1px solid var(--border-color); }
.tr-adj-item:last-child { border-bottom: 0; }
.tr-adj-open { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; padding: 2px 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: var(--fs-sm, 13px); text-align: left; cursor: pointer; }
.tr-adj-open:hover .tr-adj-name { text-decoration: underline; }
.tr-adj-name { overflow-wrap: anywhere; }
.tr-adj-meta { font-size: var(--fs-xs, 12px); }
.tr-adj-confirm { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-xs, 12px); }
.tr-adj-add { display: inline-flex; align-items: center; gap: 6px; margin: 4px 8px 4px 0; }
.tr-adj-progress { height: 4px; border-radius: 2px; background: var(--surface-hover); overflow: hidden; margin-top: 6px; }
.tr-adj-progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.tr-adj-count { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; font-size: var(--fs-xs, 12px); color: var(--text-muted); vertical-align: middle; }

/* ======================================================================
   SALA DE DIRECCIÓN + SOLICITUDES (5.110.0+) — js/sala-direccion.js, js/suggestions.js
   Calm UI: neutral surfaces, one accent, colour only for status, line icons.
   ====================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sala-title { margin: 0; font-size: var(--fs-xl); text-wrap: balance; }
.sala-sub { margin: 4px 0 0; display: block; line-height: 1.5; max-width: 72ch; }
.sala-head, .sol-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.sala-head-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.sala-head-actions .btn, .sol-head .btn { display: inline-flex; align-items: center; gap: 6px; }
.sala-board { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: var(--space-2); margin-bottom: var(--space-4); scrollbar-width: thin; }
.sala-board-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--surface-subtle); flex-shrink: 0; }
.sala-board-item strong { display: block; font-size: var(--fs-sm); line-height: 1.2; }
.sala-board-item .ui-meta { font-size: var(--fs-xs); white-space: nowrap; }
.sala-avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface-hover); }
.sala-avatar--ini { display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: 700; color: var(--text-secondary); }
.sala-layout { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: var(--space-4); min-height: 60vh; }
.sala-lista { border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--bg-card); display: flex; flex-direction: column; min-width: 0; max-height: 75vh; }
.sala-filtros { display: flex; gap: 4px; flex-wrap: wrap; padding: var(--space-2); border-bottom: 1px solid var(--border-color); }
.sala-filtro { border: 1px solid transparent; background: transparent; color: var(--text-secondary); border-radius: var(--radius-sm); padding: 5px 10px; font-size: var(--fs-xs); cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 5px; }
.sala-filtro:hover { background: var(--surface-hover); }
.sala-filtro.active { border-color: var(--border-color); background: var(--surface-raised); color: var(--text-primary); font-weight: 600; }
#sala-lista-items { overflow-y: auto; flex: 1; }
.sala-item { display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--border-color); background: transparent; color: inherit; padding: var(--space-3); cursor: pointer; font-family: inherit; }
.sala-item:hover { background: var(--surface-hover); }
.sala-item.active { background: var(--surface-raised); box-shadow: inset 3px 0 0 var(--accent); }
.sala-item-titulo { font-size: var(--fs-sm); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.sala-item--nuevo .sala-item-titulo { color: var(--text-primary); }
.sala-item-meta { font-size: var(--fs-xs); display: block; }
.sala-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.sala-nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sala-vacio { padding: var(--space-4); margin: 0; display: block; }
.sala-vacio-grande { padding: var(--space-6) var(--space-4); text-align: center; }
.sala-hilo { border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--bg-card); display: flex; flex-direction: column; min-width: 0; max-height: 75vh; }
.sala-hilo-cabecera { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.sala-hilo-info { flex: 1; min-width: 200px; }
.sala-hilo-info h2 { margin: 0 0 4px; font-size: var(--fs-lg); text-wrap: balance; }
.sala-hilo-info .ui-meta { display: block; line-height: 1.5; font-size: var(--fs-xs); }
.sala-hilo-acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.sala-hilo-acciones .btn { display: inline-flex; align-items: center; gap: 5px; }
.sala-volver { display: none; }
.sala-chip { font-size: var(--fs-xs); font-weight: 600; padding: 1px 8px; border: 1px solid currentColor; border-radius: 10px; vertical-align: middle; }
.sala-mensajes { flex: 1; overflow-y: auto; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.sala-msg header { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.sala-msg header strong { font-size: var(--fs-sm); }
.sala-msg header .ui-meta { font-size: var(--fs-xs); }
.sala-msg-texto { font-size: var(--fs-base); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.sala-msg--ejecutivo { display: flex; gap: var(--space-3); align-items: flex-start; }
.sala-msg-cuerpo { flex: 1; min-width: 0; }
.sala-msg--persona { align-self: flex-end; max-width: 85%; background: var(--surface-subtle); border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-3); }
.sala-msg--mio { background: var(--surface-raised); }
.sala-progreso { display: none; padding: 8px var(--space-4); border-top: 1px solid var(--border-color); font-size: var(--fs-sm); color: var(--text-secondary); align-items: center; gap: 8px; flex-wrap: wrap; }
.sala-progreso--on { display: flex; }
.sala-motivo { display: block; width: 100%; font-size: var(--fs-xs); }
.sala-typing { display: inline-flex; gap: 3px; align-items: center; }
.sala-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); animation: salaTyping 1.2s infinite ease-in-out; }
.sala-typing i:nth-child(2) { animation-delay: .15s; }
.sala-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes salaTyping { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .sala-typing i { animation: none; opacity: .6; } }
.sala-composer { border-top: 1px solid var(--border-color); padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: 8px; }
.sala-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sala-chip-btn { border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); border-radius: 999px; padding: 4px 10px; font-size: var(--fs-xs); cursor: pointer; font-family: inherit; }
.sala-chip-btn:hover { background: var(--surface-hover); }
.sala-chip-btn.active { border-color: var(--accent); color: var(--text-primary); background: var(--surface-raised); font-weight: 600; }
.sala-texto { resize: vertical; min-height: 64px; font-family: inherit; }
.sala-composer-pie { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sala-composer-pie .btn { display: inline-flex; align-items: center; gap: 6px; }
.sala-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 12px; }
.sala-check { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-sm); cursor: pointer; line-height: 1.4; }
.sala-check input { margin-top: 3px; }
.sala-matriz { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.sala-matriz th, .sala-matriz td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border-color); }
.sala-matriz th { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; }
.sala-matriz select { padding: 4px 8px; }
.sala-msg .ai-proposal-card { background: var(--surface-subtle) !important; }

/* Solicitudes */
.sol-filtros { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-3); }
.sol-filtros .input-field { width: auto; min-width: 150px; flex: 0 1 auto; }
.sol-filtros input[type="search"] { flex: 1 1 180px; }
.sol-vista { display: flex; gap: 4px; margin-left: auto; }
.sol-resumen { display: block; margin: 0 0 var(--space-3); font-size: var(--fs-xs); }
.sol-lista { display: flex; flex-direction: column; border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--bg-card); overflow: hidden; }
.sol-fila { display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--border-color); background: transparent; color: inherit; padding: var(--space-3) var(--space-4); cursor: pointer; font-family: inherit; }
.sol-fila:last-child { border-bottom: none; }
.sol-fila:hover { background: var(--surface-hover); }
.sol-fila-ico { color: var(--text-secondary); display: inline-flex; }
.sol-fila-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sol-fila-main strong { font-size: var(--fs-base); }
.sol-fila-main .ui-meta { display: block; font-size: var(--fs-xs); }
.sol-fila-der { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.sol-chip { font-size: var(--fs-xs); font-weight: 600; padding: 2px 9px; border-radius: 10px; border: 1px solid currentColor; white-space: nowrap; }
.sol-chip--info { color: var(--text-secondary); }
.sol-chip--muted { color: var(--text-muted); border-style: dashed; }
.sol-tablero { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-2); }
.sol-col { background: var(--surface-subtle); border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-3); display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.sol-col h3 { margin: 0 0 4px; font-size: var(--fs-sm); display: flex; justify-content: space-between; align-items: center; }
.sol-tarjeta { display: flex; flex-direction: column; gap: 4px; text-align: left; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-card); color: inherit; padding: 10px; cursor: pointer; font-family: inherit; }
.sol-tarjeta:hover { border-color: var(--accent); }
.sol-tarjeta strong { font-size: var(--fs-sm); }
.sol-tarjeta .ui-meta { display: block; font-size: var(--fs-xs); }
.sol-estructura { border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-3) var(--space-4) var(--space-4); margin: 0; }
.sol-estructura legend { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); padding: 0 6px; text-transform: uppercase; letter-spacing: .06em; }
.sol-miniatura { width: 40px; height: 28px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border-color); }
.sol-meta-linea { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: var(--space-3); }
.sol-meta-linea .ui-meta { font-size: var(--fs-xs); }
.sol-bloque { margin-top: var(--space-4); }
.sol-bloque h3 { margin: 0 0 6px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.sol-texto { white-space: pre-wrap; line-height: 1.6; font-size: var(--fs-base); }
.sol-historial { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
#suggestions-fab.suggestions-fab .ui-icon { vertical-align: 0; }

@media (max-width: 760px) {
    .sala-layout { grid-template-columns: 1fr; min-height: 0; }
    .sala-layout .sala-hilo { display: none; }
    .sala-layout--hilo .sala-lista { display: none; }
    .sala-layout--hilo .sala-hilo { display: flex; max-height: none; min-height: 70vh; }
    .sala-volver { display: inline-flex; }
    .sala-msg--persona { max-width: 100%; }
    .sol-grid3 { grid-template-columns: 1fr !important; }
    .sol-filtros .input-field { flex: 1 1 140px; min-width: 0; }
    .sol-vista { margin-left: 0; }
    .sol-fila { flex-wrap: wrap; }
    .sol-fila-der { width: 100%; justify-content: flex-start; padding-left: 30px; }
}
:where(#sala-direccion-content, #suggestions-content, #suggestion-overlay, #sol-detalle, #sala-nuevo, #sala-compartir, #sala-config) .ui-meta { color: var(--text-muted); font-size: var(--fs-sm); }
:where(#sala-direccion-content, #suggestions-content, #suggestion-overlay, #sol-detalle, #sala-nuevo, #sala-compartir, #sala-config) p.ui-meta { display: block; line-height: 1.5; }
.sala-chips .ui-meta, .sala-composer-pie .ui-meta, .sala-check .ui-meta { font-size: var(--fs-xs); }

/* ============================================================================
   FACTURACIÓN CON NCF Y OBLIGACIONES DGII (5.112.0+) — js/facturacion.js
   Calm UI: neutral cards, one accent (Emitir / primary), colour only for status.
   ============================================================================ */
#section-facturacion .card { margin-bottom: var(--space-4); }
.fac-banner { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3) var(--space-4); border: 1px solid var(--border-color); border-left: 3px solid var(--status-warn); border-radius: var(--radius); background: var(--surface-subtle); font-size: var(--fs-sm); margin-bottom: var(--space-4); }
.fac-banner.is-danger { border-left-color: var(--status-danger); }
.fac-banner .ui-icon { flex: 0 0 auto; margin-top: 2px; color: var(--status-warn); }
.fac-toolbar { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-4); }
.fac-toolbar .input-field { width: auto; min-width: 160px; }
.fac-grow { flex: 1 1 auto; }
.fac-table-wrap { overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius); margin-bottom: var(--space-4); }
.fac-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.fac-table th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: var(--surface-subtle); padding: var(--space-2) var(--space-3); font-weight: 600; }
.fac-table td { padding: var(--space-2) var(--space-3); border-top: 1px solid var(--border-color); vertical-align: top; }
.fac-table-sm td, .fac-table-sm th { padding: 6px var(--space-2); }
.fac-row { cursor: pointer; }
.fac-row:hover { background: var(--surface-hover); }
.fac-row.is-anulado, .fac-list .is-anulado { opacity: .55; text-decoration: line-through; }
.fac-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fac-mono { font-family: 'Space Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.fac-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-color); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.fac-rangos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.fac-rango { border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-3); background: var(--surface-subtle); font-size: var(--fs-sm); }
.fac-rango-top { display: flex; justify-content: space-between; gap: var(--space-2); }
.fac-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.fac-inline { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.fac-inline .input-field { width: auto; flex: 1 1 120px; }
.fac-h3 { font-size: var(--fs-md); margin: var(--space-5) 0 var(--space-3); display: flex; gap: var(--space-2); align-items: center; }
.fac-h4 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: var(--space-4) 0 var(--space-2); }
.fac-linea { display: grid; grid-template-columns: 2.2fr 1.6fr .7fr .8fr 1fr .8fr .8fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.fac-linea .input-field { width: 100%; min-width: 0; }
.fac-linea-head { font-size: var(--fs-xs); }
.fac-totales { margin: var(--space-3) 0 0 auto; max-width: 340px; font-size: var(--fs-sm); }
.fac-totales > div { display: flex; justify-content: space-between; gap: var(--space-3); padding: 3px 0; }
.fac-totales .fac-total { border-top: 1px solid var(--border-color); margin-top: 4px; padding-top: 6px; font-weight: 700; font-size: var(--fs-md); }
.fac-val { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin: var(--space-3) 0; font-size: var(--fs-sm); background: var(--surface-subtle); }
.fac-val ul { margin: 4px 0 0; padding-left: 18px; }
.fac-val.is-danger { border-left: 3px solid var(--status-danger); }
.fac-val.is-ok { border-left: 3px solid var(--status-ok); }
.fac-kv { display: flex; justify-content: space-between; gap: var(--space-3); padding: 4px 0; border-bottom: 1px dashed var(--border-color); font-size: var(--fs-sm); }
.fac-ficha-head { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-4); }
.fac-list { margin: 0; padding-left: 18px; font-size: var(--fs-sm); }
.fac-list li { margin-bottom: 4px; }
.fac-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.fac-stat { border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-3); background: var(--surface-subtle); }
.fac-stat-v { font-size: var(--fs-lg); font-weight: 700; text-align: left; }
.fac-reps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); }
.fac-rep-head { display: flex; justify-content: space-between; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.fac-rep-head h3 { margin: 0; font-size: var(--fs-md); display: flex; gap: var(--space-2); align-items: center; }
.fac-rep.is-pendiente { opacity: .8; }
.fac-cal-row { display: grid; grid-template-columns: 110px 1fr auto; gap: var(--space-3); align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border-color); font-size: var(--fs-sm); }
.fac-cal-row.is-danger .fac-mono { color: var(--status-danger); }
.fac-obl { padding: var(--space-3) var(--space-4) !important; }
.fac-obl.is-off { opacity: .65; }
.fac-obl-head { display: flex; justify-content: space-between; gap: var(--space-3); align-items: flex-start; cursor: pointer; }
.fac-obl-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.fac-obl-body { margin-top: var(--space-3); }
.fac-alerta { display: flex; gap: var(--space-2); align-items: flex-start; padding: 6px 0; font-size: var(--fs-sm); border-bottom: 1px solid var(--border-color); }
.fac-alerta .ui-icon { color: var(--status-warn); flex: 0 0 auto; margin-top: 2px; }
.fac-home h3 { display: flex; gap: var(--space-2); align-items: center; }
@media (max-width: 720px) {
    .fac-grid { grid-template-columns: 1fr; }
    .fac-linea { grid-template-columns: 1fr 1fr; }
    .fac-linea-head { display: none; }
    .fac-linea .fac-l-desc, .fac-linea .fac-l-det { grid-column: 1 / -1; }
    .fac-toolbar .input-field { min-width: 0; flex: 1 1 140px; }
    /* tablas → tarjetas en el teléfono */
    .fac-table thead { display: none; }
    .fac-table, .fac-table tbody, .fac-table tr, .fac-table td { display: block; width: 100%; }
    .fac-table tr { border-top: 1px solid var(--border-color); padding: var(--space-2) var(--space-3); }
    .fac-table td { border: 0; padding: 2px 0; text-align: left; }
    .fac-table td[data-l]::before { content: attr(data-l) ": "; color: var(--text-muted); font-size: var(--fs-xs); }
    .fac-num { text-align: left; }
    .fac-cal-row { grid-template-columns: 90px 1fr; }
    .fac-cal-row .fac-chip { grid-column: 2; justify-self: start; }
}
.fac-meta { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; }
p.fac-meta, div.fac-meta { display: block; margin: 0 0 var(--space-2); }
.fac-rango .fac-meta { font-size: var(--fs-xs); margin: 2px 0 0; }
.fac-origen-chip { display: inline-block; margin-left: var(--space-1, 4px); padding: 1px 8px; border: 1px solid var(--border-color); border-radius: 999px; font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }

/* ==================== NATURALEZA DE LA OPORTUNIDAD (5.112.1+) ====================
   Neutral chip for collaborations / approaches and the document type of a quote;
   colour is not status here, so it stays neutral with a line icon. */
.nat-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: var(--fs-xs); font-weight: 600; line-height: 1.6; white-space: nowrap; border: 1px solid var(--border-color); color: var(--text-secondary); background: var(--surface-subtle); vertical-align: middle; }
.nat-chip .ui-icon { color: var(--text-muted); flex-shrink: 0; }
.nat-counts { display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--fs-sm); margin: 0 0 var(--space-4); }
.nat-counts .ui-icon { color: var(--text-muted); }
.nat-sin-precio { font-size: var(--fs-sm); color: var(--text-muted); font-style: italic; font-family: inherit; font-weight: 400; }

/* ============================================================
   POLÍTICAS · INCORPORACIÓN (5.113.0+) — js/politicas.js, js/incorporacion.js
   Calm UI: neutral cards, one accent, colour only for status.
   ============================================================ */
.pol-aviso { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); margin: var(--space-3) 0 var(--space-4); border: 1px solid var(--status-warn); border-left-width: 4px; border-radius: var(--radius); background: var(--surface-subtle); font-size: var(--fs-sm); line-height: 1.5; }
.pol-aviso > .ui-icon { color: var(--status-warn); flex-shrink: 0; margin-top: 2px; }
.pol-aviso--suave { border-color: var(--border-color); border-left-color: var(--accent); }
.pol-aviso--suave > .ui-icon { color: var(--text-muted); }
.pol-cond { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; line-height: 1.45; }
.pol-h3 { font-size: var(--fs-md, 15px); margin: var(--space-5, 20px) 0 var(--space-2); text-wrap: balance; }
.pol-ico { color: var(--text-muted); display: inline-flex; margin-top: 2px; }
.pol-nivel { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.pol-nivel--verde { background: var(--status-ok); }
.pol-nivel--ambar { background: var(--status-warn); }
.pol-nivel--rojo { background: var(--status-danger); }
.pol-matriz td { min-width: 110px; }
.pol-fuera { border: 1px solid var(--status-danger); border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-3); font-size: var(--fs-sm); }
.pol-fuera strong { display: inline-flex; gap: 6px; align-items: center; color: var(--status-danger); }
.pol-fuera ul, .pol-nombres ul, .pol-hist { margin: var(--space-2) 0 0; padding-left: 20px; font-size: var(--fs-sm); line-height: 1.55; }
.pol-hist { list-style: none; padding-left: 0; }
.pol-partes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-2); }
.pol-probador { margin-top: var(--space-3); max-width: 560px; }
.pol-cuerpo { white-space: pre-wrap; line-height: 1.6; font-size: var(--fs-sm); padding: var(--space-4); border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--surface-subtle); overflow-wrap: anywhere; }
.pol-lect { display: flex; flex-direction: column; gap: 2px; }
.pol-lect-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 8px; border-bottom: 1px solid var(--border-color); font-size: var(--fs-sm); }
.pol-det { border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-3); }
.pol-det > summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.pol-fila-ed { border: 1px solid var(--border-color); border-radius: var(--radius); padding: var(--space-3); margin: var(--space-2) 0; background: var(--surface-subtle); }
.inc-items { display: flex; flex-direction: column; gap: 6px; }
.inc-item { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3); border: 1px solid var(--border-color); border-radius: var(--radius); background: var(--bg-card); }
.inc-item.is-done .inc-item-texto { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-color); }
.inc-item.is-late { border-left: 4px solid var(--status-danger); }
.inc-item-check { padding-top: 2px; color: var(--text-muted); }
.inc-item-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.inc-item-texto { font-size: var(--fs-sm); font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
@media (max-width: 640px) {
    .modal-overlay[id^="pol-"] .modal-content [style*="grid-template-columns"],
    .modal-overlay[id^="inc-"] .modal-content [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    .pol-aviso { padding: var(--space-3); }
    .inc-item { padding: var(--space-2); }
}

/* ============ VISTA DE PARTICIPANTE (5.115.0) ============
   Phone-first view for permissions.participantes (js/participante.js).
   One column, 44 px targets, theme tokens only. */
.pt-app { display: none; min-height: 100vh; background: var(--bg-color, var(--bg-primary)); color: var(--text-primary); padding: 16px 16px 40px; box-sizing: border-box; }
.pt-app * { box-sizing: border-box; }
.pt-app > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.pt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.pt-org { font-size: var(--fs-sm, 13px); color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.pt-h1 { margin: 2px 0; font-size: 24px; text-wrap: balance; }
.pt-h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 18px; text-wrap: balance; }
.pt-h3 { margin: 14px 0 6px; font-size: 15px; }
.pt-meta { font-size: var(--fs-xs, 12px); color: var(--text-secondary); }
.pt-pie { text-align: center; margin-top: 24px; }
.pt-card { background: var(--surface-raised, var(--bg-secondary)); border: 1px solid var(--border-color); border-radius: var(--radius, 12px); padding: 16px; margin-bottom: 14px; }
.pt-aviso { font-size: 13px; color: var(--text-secondary); background: var(--surface-subtle, transparent); border-radius: 8px; padding: 8px 10px; margin: 6px 0 10px; line-height: 1.45; }
.pt-list { list-style: none; margin: 0; padding: 0; }
.pt-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-color); overflow-wrap: anywhere; }
.pt-list li:last-child { border-bottom: 0; }
.pt-list li > span { flex: 1; min-width: 0; }
.pt-hecho > span { color: var(--text-secondary); }
.pt-vencido { color: var(--status-danger, #e53e3e); font-weight: 600; }
.pt-btn { min-height: 44px; padding: 8px 14px; font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.pt-ancho { width: 100%; margin-top: 10px; }
.pt-barra { height: 6px; background: var(--surface-subtle, var(--border-color)); border-radius: 3px; overflow: hidden; margin: 8px 0 4px; }
.pt-barra span { display: block; height: 100%; background: var(--accent); }
.pt-fs { border: 0; padding: 0; margin: 0 0 14px; }
.pt-fs legend { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.pt-escala { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pt-escala label { position: relative; }
.pt-escala input { position: absolute !important; width: 1px !important; height: 1px !important; margin: 0 !important; opacity: 0 !important; pointer-events: none; clip-path: inset(50%); -webkit-appearance: none; appearance: none; }
body.pt-modo #suggestions-fab, body.pt-modo #quick-actions-fab, body.pt-modo .suggestions-fab { display: none !important; }
.pt-escala span { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--border-color); border-radius: 8px; font-weight: 600; cursor: pointer; }
.pt-escala input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }
.pt-escala input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pt-lbl { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 6px; }
.pt-form .input-field, .pt-card textarea.input-field, .pt-card select.input-field { width: 100%; font-size: 16px; }
.pt-dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.pt-politica { border-top: 1px solid var(--border-color); margin-top: 12px; padding-top: 12px; }
.pt-md { overflow-x: auto; font-size: 14px; line-height: 1.55; }
.pt-md table { border-collapse: collapse; font-size: 13px; }
.pt-md td, .pt-md th { border: 1px solid var(--border-color); padding: 4px 6px; }
@media (max-width: 420px) { .pt-dos { grid-template-columns: 1fr; } .pt-head { flex-direction: column; } }

/* ===== Oportunidades estancadas (5.115.1) — neutral chip; warn only when the re-contact date arrived ===== */
.est-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: var(--fs-xs); font-weight: 600; line-height: 1.6; white-space: nowrap; border: 1px dashed var(--border-color); color: var(--text-secondary); background: var(--surface-subtle); vertical-align: middle; }
.est-chip .ui-icon { color: var(--text-muted); flex-shrink: 0; }
.est-chip--due { border-style: solid; border-color: var(--status-warn, #ed8936); color: var(--status-warn, #ed8936); }
.est-line { margin-top: 4px; }
.kanban-column-header .status-dot.estancado { background: #a0aec0; }
.vc-line { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 4px; font-variant-numeric: tabular-nums; }
.gan-line { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 6px 12px; border-left: 3px solid var(--status-ok, #48bb78); background: var(--surface-subtle); border-radius: var(--radius, 6px); font-size: var(--fs-sm, 13px); color: var(--text-secondary); }
.gan-line .ui-icon { color: var(--status-ok, #48bb78); }
.cobro-chip { border-color: var(--status-warn, #ed8936); color: var(--status-warn, #ed8936); }

/* ===== Taller multiline fields (5.115.2) =====
   Carlos, 2026-10-05: every multiline field should be taller. Applies to form textareas
   (.input-field and those inside modals); chat inputs (advisor, comments, quick activity) are
   untouched. Fields grow with their content up to a cap and stay resizable. */
textarea.input-field,
.modal-content textarea {
    min-height: 9.5em;
    resize: vertical;
}
@supports (field-sizing: content) {
    textarea.input-field,
    .modal-content textarea {
        field-sizing: content;
        max-height: 60vh;
    }
}
#edit-lead-notes { min-height: 14em; }
/* Chat-style composers keep their compact height (they grow with content) */
#advisor-input, #sala-texto, [id^="new-comment-"], .ai-advisor-panel-input textarea {
    min-height: 0;
}

/* ======================================================================
   STYLE PRESET «MINIMALISTA» (5.115.3+) — body.preset-minimal
   Set and removed by setMinimalPresetClass() (js/sections.js) from
   applyStylePreset / applySavedStyle. White background whatever the
   dark/light toggle says: the class also forces data-theme="light" (the
   user's choice in localStorage is untouched) and hides the toggle.
   Everything here is scoped to .preset-minimal; other presets are unchanged.
   The gray scale is inverted (the app was drawn dark-first: --gray-100 is
   the main text, --gray-900 the deepest surface), so inline
   var(--gray-*) colours land the right way round on white.
   ====================================================================== */
body.preset-minimal {
    --gray-50: #111827; --gray-100: #111827; --gray-200: #1f2937; --gray-300: #374151;
    --gray-400: #4b5563; --gray-500: #5b6472; --gray-600: #6b7280; --gray-700: #e5e7eb;
    --gray-800: #f3f4f6; --gray-900: #f9fafb;
    --bg-primary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-sidebar: #fafafa;
    --bg-input: #ffffff;
    --border-color: #e5e7eb;
    --border-accent: rgba(30,58,138,0.28);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #5b6472;
    --shadow-color: rgba(17,24,39,0.06);
    --surface-subtle: #f9fafb;
    --surface-hover: #f3f4f6;
    --surface-raised: #ffffff;
    /* Undefined elsewhere (see CLAUDE.md); defined only for this preset. */
    --bg-secondary: #f9fafb;
    --card-bg: #ffffff;
    --bg-tertiary: #f3f4f6;
    /* Status colours stay meaningful, but muted. */
    --seg-danger: #b42318; --seg-warn: #8a5a12; --seg-ok: #2f6b4a;
    --band-critica: #b42318; --band-alta: #9a5b13; --band-media: #1e40af; --band-baja: #9ca3af;
    --org-line: #d1d5db;
    background: #ffffff;
    color: #111827;
}
body.preset-minimal .theme-toggle-nav { display: none; }

/* ---- Shell: sidebar, mobile header and menu ---- */
body.preset-minimal .sidebar { background: #fafafa; backdrop-filter: none; border-right: 1px solid #e5e7eb; }
body.preset-minimal .nav-item { color: #4b5563; }
body.preset-minimal .nav-item:hover { background: #f3f4f6; color: #111827; }
body.preset-minimal .nav-item.active { background: rgba(30,58,138,0.07); border-left-color: var(--accent); color: var(--accent); }
body.preset-minimal .sidebar-footer-card { background: #ffffff; border: 1px solid #e5e7eb; }
body.preset-minimal .sidebar-footer-label { color: #5b6472 !important; }
body.preset-minimal .sidebar-footer-value { color: #111827; }
body.preset-minimal .sidebar-footer-change { color: #4b5563 !important; }
body.preset-minimal .mobile-header,
body.preset-minimal .mobile-nav { background: #ffffff; backdrop-filter: none; border-color: #e5e7eb; }
body.preset-minimal .hamburger span { background: #111827; }

/* ---- Surfaces: white cards, hairline borders, no gradients or heavy shadows ---- */
body.preset-minimal .card,
body.preset-minimal .metric-card,
body.preset-minimal .hub-card { background: #ffffff; backdrop-filter: none; border: 1px solid #e5e7eb; box-shadow: none; }
body.preset-minimal .card { color: #111827; }
body.preset-minimal .card p, body.preset-minimal .card li, body.preset-minimal .card span { color: inherit; }
body.preset-minimal .hub-card:hover { background: #fafafa; border-color: #c7cdd6; }
body.preset-minimal .hero { background: #ffffff; border: 1px solid #e5e7eb; }
body.preset-minimal .hero-title { background: none; -webkit-text-fill-color: #111827; color: #111827; }
body.preset-minimal .hero-subtitle { color: #4b5563 !important; }
body.preset-minimal .phase-card { box-shadow: none; }
body.preset-minimal .export-bar { background: transparent; border: 1px solid #e5e7eb; }
body.preset-minimal .export-bar[data-export-menu] { border: none; }
body.preset-minimal .export-bar-label { color: #4b5563; }

/* ---- Tables ---- */
body.preset-minimal table { color: #111827; }
body.preset-minimal th { background: #f9fafb !important; color: #4b5563 !important; border-bottom: 1px solid #e5e7eb; font-weight: 600; }
body.preset-minimal td { background: transparent; border-color: #eef0f3 !important; }
body.preset-minimal #tasks-table tr, body.preset-minimal #tasks-table tr:hover { background: transparent; }
body.preset-minimal th.sortable:hover { background: #f3f4f6 !important; }

/* ---- Forms and buttons: one accent ---- */
body.preset-minimal .input-field,
body.preset-minimal .select-field { background: #ffffff; border: 1px solid #d1d5db; color: #111827; }
body.preset-minimal .input-field:focus,
body.preset-minimal .select-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30,58,138,0.12); outline: none; }
body.preset-minimal .input-field::placeholder { color: #6b7280; }
body.preset-minimal .btn-primary { background: var(--accent); color: #ffffff; }
body.preset-minimal .btn-primary:hover { filter: none; background: #172f73; }
body.preset-minimal .btn-secondary { background: #ffffff; color: #111827; border: 1px solid #d1d5db; }
body.preset-minimal .btn-secondary:hover { background: #f3f4f6; }
body.preset-minimal .prospeccion-tab { color: #4b5563; }
body.preset-minimal .prospeccion-tab.active { background: var(--accent); color: #ffffff; border-color: var(--accent); }
body.preset-minimal .badge { background: #f3f4f6; color: #374151; }

/* ---- Modals ---- */
body.preset-minimal .modal-overlay { background: rgba(17,24,39,0.35); backdrop-filter: none; }
body.preset-minimal .modal-content { background: #ffffff; border: 1px solid #e5e7eb; box-shadow: 0 12px 32px rgba(17,24,39,0.12); color: #111827; }

/* ---- Kanban ---- */
body.preset-minimal .kanban-column { background: #f9fafb; border: 1px solid #eef0f3; }
body.preset-minimal .kanban-column.drag-over { background: rgba(30,58,138,0.05); }

/* ---- Inline text colours drawn for the dark theme (light tints that fail AA on
   white): mapped to darker equivalents of the same hue. Text colour only —
   the patterns never match background-color or border-color. ---- */
body.preset-minimal [style^="color: #48bb78" i],
body.preset-minimal [style^="color:#48bb78" i],
body.preset-minimal [style*="; color: #48bb78" i],
body.preset-minimal [style*=";color:#48bb78" i],
body.preset-minimal [style*="; color:#48bb78" i],
body.preset-minimal [style*=";color: #48bb78" i],
body.preset-minimal [style^="color: #68d391" i],
body.preset-minimal [style^="color:#68d391" i],
body.preset-minimal [style*="; color: #68d391" i],
body.preset-minimal [style*=";color:#68d391" i],
body.preset-minimal [style*="; color:#68d391" i],
body.preset-minimal [style*=";color: #68d391" i],
body.preset-minimal [style^="color: #38a169" i],
body.preset-minimal [style^="color:#38a169" i],
body.preset-minimal [style*="; color: #38a169" i],
body.preset-minimal [style*=";color:#38a169" i],
body.preset-minimal [style*="; color:#38a169" i],
body.preset-minimal [style*=";color: #38a169" i],
body.preset-minimal [style^="color: #22c55e" i],
body.preset-minimal [style^="color:#22c55e" i],
body.preset-minimal [style*="; color: #22c55e" i],
body.preset-minimal [style*=";color:#22c55e" i],
body.preset-minimal [style*="; color:#22c55e" i],
body.preset-minimal [style*=";color: #22c55e" i],
body.preset-minimal [style^="color: #10b981" i],
body.preset-minimal [style^="color:#10b981" i],
body.preset-minimal [style*="; color: #10b981" i],
body.preset-minimal [style*=";color:#10b981" i],
body.preset-minimal [style*="; color:#10b981" i],
body.preset-minimal [style*=";color: #10b981" i] { color: #2f6b4a !important; }
body.preset-minimal [style^="color: #4299e1" i],
body.preset-minimal [style^="color:#4299e1" i],
body.preset-minimal [style*="; color: #4299e1" i],
body.preset-minimal [style*=";color:#4299e1" i],
body.preset-minimal [style*="; color:#4299e1" i],
body.preset-minimal [style*=";color: #4299e1" i],
body.preset-minimal [style^="color: #63b3ed" i],
body.preset-minimal [style^="color:#63b3ed" i],
body.preset-minimal [style*="; color: #63b3ed" i],
body.preset-minimal [style*=";color:#63b3ed" i],
body.preset-minimal [style*="; color:#63b3ed" i],
body.preset-minimal [style*=";color: #63b3ed" i],
body.preset-minimal [style^="color: #3b82f6" i],
body.preset-minimal [style^="color:#3b82f6" i],
body.preset-minimal [style*="; color: #3b82f6" i],
body.preset-minimal [style*=";color:#3b82f6" i],
body.preset-minimal [style*="; color:#3b82f6" i],
body.preset-minimal [style*=";color: #3b82f6" i],
body.preset-minimal [style^="color: #60a5fa" i],
body.preset-minimal [style^="color:#60a5fa" i],
body.preset-minimal [style*="; color: #60a5fa" i],
body.preset-minimal [style*=";color:#60a5fa" i],
body.preset-minimal [style*="; color:#60a5fa" i],
body.preset-minimal [style*=";color: #60a5fa" i] { color: #1e40af !important; }
body.preset-minimal [style^="color: #ed8936" i],
body.preset-minimal [style^="color:#ed8936" i],
body.preset-minimal [style*="; color: #ed8936" i],
body.preset-minimal [style*=";color:#ed8936" i],
body.preset-minimal [style*="; color:#ed8936" i],
body.preset-minimal [style*=";color: #ed8936" i],
body.preset-minimal [style^="color: #f6ad55" i],
body.preset-minimal [style^="color:#f6ad55" i],
body.preset-minimal [style*="; color: #f6ad55" i],
body.preset-minimal [style*=";color:#f6ad55" i],
body.preset-minimal [style*="; color:#f6ad55" i],
body.preset-minimal [style*=";color: #f6ad55" i],
body.preset-minimal [style^="color: #dd6b20" i],
body.preset-minimal [style^="color:#dd6b20" i],
body.preset-minimal [style*="; color: #dd6b20" i],
body.preset-minimal [style*=";color:#dd6b20" i],
body.preset-minimal [style*="; color:#dd6b20" i],
body.preset-minimal [style*=";color: #dd6b20" i],
body.preset-minimal [style^="color: #f97316" i],
body.preset-minimal [style^="color:#f97316" i],
body.preset-minimal [style*="; color: #f97316" i],
body.preset-minimal [style*=";color:#f97316" i],
body.preset-minimal [style*="; color:#f97316" i],
body.preset-minimal [style*=";color: #f97316" i] { color: #9a5b13 !important; }
body.preset-minimal [style^="color: #d69e2e" i],
body.preset-minimal [style^="color:#d69e2e" i],
body.preset-minimal [style*="; color: #d69e2e" i],
body.preset-minimal [style*=";color:#d69e2e" i],
body.preset-minimal [style*="; color:#d69e2e" i],
body.preset-minimal [style*=";color: #d69e2e" i],
body.preset-minimal [style^="color: #ecc94b" i],
body.preset-minimal [style^="color:#ecc94b" i],
body.preset-minimal [style*="; color: #ecc94b" i],
body.preset-minimal [style*=";color:#ecc94b" i],
body.preset-minimal [style*="; color:#ecc94b" i],
body.preset-minimal [style*=";color: #ecc94b" i],
body.preset-minimal [style^="color: #facc15" i],
body.preset-minimal [style^="color:#facc15" i],
body.preset-minimal [style*="; color: #facc15" i],
body.preset-minimal [style*=";color:#facc15" i],
body.preset-minimal [style*="; color:#facc15" i],
body.preset-minimal [style*=";color: #facc15" i],
body.preset-minimal [style^="color: #eab308" i],
body.preset-minimal [style^="color:#eab308" i],
body.preset-minimal [style*="; color: #eab308" i],
body.preset-minimal [style*=";color:#eab308" i],
body.preset-minimal [style*="; color:#eab308" i],
body.preset-minimal [style*=";color: #eab308" i],
body.preset-minimal [style^="color: #f59e0b" i],
body.preset-minimal [style^="color:#f59e0b" i],
body.preset-minimal [style*="; color: #f59e0b" i],
body.preset-minimal [style*=";color:#f59e0b" i],
body.preset-minimal [style*="; color:#f59e0b" i],
body.preset-minimal [style*=";color: #f59e0b" i] { color: #8a5a12 !important; }
body.preset-minimal [style^="color: #e53e3e" i],
body.preset-minimal [style^="color:#e53e3e" i],
body.preset-minimal [style*="; color: #e53e3e" i],
body.preset-minimal [style*=";color:#e53e3e" i],
body.preset-minimal [style*="; color:#e53e3e" i],
body.preset-minimal [style*=";color: #e53e3e" i],
body.preset-minimal [style^="color: #fc8181" i],
body.preset-minimal [style^="color:#fc8181" i],
body.preset-minimal [style*="; color: #fc8181" i],
body.preset-minimal [style*=";color:#fc8181" i],
body.preset-minimal [style*="; color:#fc8181" i],
body.preset-minimal [style*=";color: #fc8181" i],
body.preset-minimal [style^="color: #f87171" i],
body.preset-minimal [style^="color:#f87171" i],
body.preset-minimal [style*="; color: #f87171" i],
body.preset-minimal [style*=";color:#f87171" i],
body.preset-minimal [style*="; color:#f87171" i],
body.preset-minimal [style*=";color: #f87171" i],
body.preset-minimal [style^="color: #f56565" i],
body.preset-minimal [style^="color:#f56565" i],
body.preset-minimal [style*="; color: #f56565" i],
body.preset-minimal [style*=";color:#f56565" i],
body.preset-minimal [style*="; color:#f56565" i],
body.preset-minimal [style*=";color: #f56565" i],
body.preset-minimal [style^="color: #ef4444" i],
body.preset-minimal [style^="color:#ef4444" i],
body.preset-minimal [style*="; color: #ef4444" i],
body.preset-minimal [style*=";color:#ef4444" i],
body.preset-minimal [style*="; color:#ef4444" i],
body.preset-minimal [style*=";color: #ef4444" i] { color: #b42318 !important; }
body.preset-minimal [style^="color: #38b2ac" i],
body.preset-minimal [style^="color:#38b2ac" i],
body.preset-minimal [style*="; color: #38b2ac" i],
body.preset-minimal [style*=";color:#38b2ac" i],
body.preset-minimal [style*="; color:#38b2ac" i],
body.preset-minimal [style*=";color: #38b2ac" i],
body.preset-minimal [style^="color: #14b8a6" i],
body.preset-minimal [style^="color:#14b8a6" i],
body.preset-minimal [style*="; color: #14b8a6" i],
body.preset-minimal [style*=";color:#14b8a6" i],
body.preset-minimal [style*="; color:#14b8a6" i],
body.preset-minimal [style*=";color: #14b8a6" i],
body.preset-minimal [style^="color: #4fd1c5" i],
body.preset-minimal [style^="color:#4fd1c5" i],
body.preset-minimal [style*="; color: #4fd1c5" i],
body.preset-minimal [style*=";color:#4fd1c5" i],
body.preset-minimal [style*="; color:#4fd1c5" i],
body.preset-minimal [style*=";color: #4fd1c5" i] { color: #0f766e !important; }
body.preset-minimal [style^="color: #9f7aea" i],
body.preset-minimal [style^="color:#9f7aea" i],
body.preset-minimal [style*="; color: #9f7aea" i],
body.preset-minimal [style*=";color:#9f7aea" i],
body.preset-minimal [style*="; color:#9f7aea" i],
body.preset-minimal [style*=";color: #9f7aea" i],
body.preset-minimal [style^="color: #b794f4" i],
body.preset-minimal [style^="color:#b794f4" i],
body.preset-minimal [style*="; color: #b794f4" i],
body.preset-minimal [style*=";color:#b794f4" i],
body.preset-minimal [style*="; color:#b794f4" i],
body.preset-minimal [style*=";color: #b794f4" i],
body.preset-minimal [style^="color: #a855f7" i],
body.preset-minimal [style^="color:#a855f7" i],
body.preset-minimal [style*="; color: #a855f7" i],
body.preset-minimal [style*=";color:#a855f7" i],
body.preset-minimal [style*="; color:#a855f7" i],
body.preset-minimal [style*=";color: #a855f7" i] { color: #5b3fa8 !important; }
body.preset-minimal [style^="color: #84bd00" i],
body.preset-minimal [style^="color:#84bd00" i],
body.preset-minimal [style*="; color: #84bd00" i],
body.preset-minimal [style*=";color:#84bd00" i],
body.preset-minimal [style*="; color:#84bd00" i],
body.preset-minimal [style*=";color: #84bd00" i],
body.preset-minimal [style^="color: #a8d94e" i],
body.preset-minimal [style^="color:#a8d94e" i],
body.preset-minimal [style*="; color: #a8d94e" i],
body.preset-minimal [style*=";color:#a8d94e" i],
body.preset-minimal [style*="; color:#a8d94e" i],
body.preset-minimal [style*=";color: #a8d94e" i] { color: #3f6212 !important; }
body.preset-minimal [style^="color: #ec4899" i],
body.preset-minimal [style^="color:#ec4899" i],
body.preset-minimal [style*="; color: #ec4899" i],
body.preset-minimal [style*=";color:#ec4899" i],
body.preset-minimal [style*="; color:#ec4899" i],
body.preset-minimal [style*=";color: #ec4899" i],
body.preset-minimal [style^="color: #f472b6" i],
body.preset-minimal [style^="color:#f472b6" i],
body.preset-minimal [style*="; color: #f472b6" i],
body.preset-minimal [style*=";color:#f472b6" i],
body.preset-minimal [style*="; color:#f472b6" i],
body.preset-minimal [style*=";color: #f472b6" i] { color: #be185d !important; }
body.preset-minimal [style^="color: #94a3b8" i],
body.preset-minimal [style^="color:#94a3b8" i],
body.preset-minimal [style*="; color: #94a3b8" i],
body.preset-minimal [style*=";color:#94a3b8" i],
body.preset-minimal [style*="; color:#94a3b8" i],
body.preset-minimal [style*=";color: #94a3b8" i],
body.preset-minimal [style^="color: #a0aec0" i],
body.preset-minimal [style^="color:#a0aec0" i],
body.preset-minimal [style*="; color: #a0aec0" i],
body.preset-minimal [style*=";color:#a0aec0" i],
body.preset-minimal [style*="; color:#a0aec0" i],
body.preset-minimal [style*=";color: #a0aec0" i],
body.preset-minimal [style^="color: #cbd5e1" i],
body.preset-minimal [style^="color:#cbd5e1" i],
body.preset-minimal [style*="; color: #cbd5e1" i],
body.preset-minimal [style*=";color:#cbd5e1" i],
body.preset-minimal [style*="; color:#cbd5e1" i],
body.preset-minimal [style*=";color: #cbd5e1" i],
body.preset-minimal [style^="color: #cbd5e0" i],
body.preset-minimal [style^="color:#cbd5e0" i],
body.preset-minimal [style*="; color: #cbd5e0" i],
body.preset-minimal [style*=";color:#cbd5e0" i],
body.preset-minimal [style*="; color:#cbd5e0" i],
body.preset-minimal [style*=";color: #cbd5e0" i] { color: #5b6472 !important; }

/* ---- Clean type: form fields in the body sans ---- */
body.preset-minimal .input-field,
body.preset-minimal .select-field,
body.preset-minimal textarea { font-family: var(--font-body); }

/* ===== 5.115.4 — phone width: no horizontal overflow in modals and panels ===== */
.modal-content { box-sizing: border-box; max-width: 100%; }
.modal-content input, .modal-content select, .modal-content textarea { max-width: 100%; box-sizing: border-box; }
.modal-content label { overflow-wrap: anywhere; }
.wf-panel, .wf-panel > * { min-width: 0; }
.wf-panel .wf-grid > * { min-width: 0; }
@media (max-width: 640px) {
    .modal-overlay { padding: 8px; box-sizing: border-box; }
    .modal-content { padding: 16px; width: 100%; min-width: 0; }
    .modal-content [style*="grid-template-columns"],
    .modal-content .form-grid, .modal-content .fac-grid, .modal-content .pol-grid { grid-template-columns: minmax(0, 1fr) !important; }
    .modal-content [style*="display: flex"], .modal-content [style*="display:flex"] { flex-wrap: wrap; }
    .modal-content [style*="display: grid"] > *, .modal-content [style*="display:grid"] > *,
    .modal-content [style*="display: flex"] > *, .modal-content [style*="display:flex"] > * { min-width: 0; }
    .modal-content input, .modal-content select, .modal-content textarea,
    .modal-content [style*="width:"] input, .modal-content .input-field, .modal-content .select-field { max-width: 100%; min-width: 0; }
    .modal-content select[style*="width"], .modal-content input[style*="width"] { width: 100% !important; }
    .modal-content table { display: block; max-width: 100%; overflow-x: auto; }
    .modal-footer, .modal-content > div[style*="justify-content: flex-end"] { flex-wrap: wrap; }
    .wf-panel .wf-grid { grid-template-columns: minmax(0, 1fr) !important; }
    .wf-panel span[style*="min-width"] { min-width: 0 !important; }
    .wf-panel .wf-kpis { gap: 8px 16px !important; }
}

/* ===== 5.116.0 — Clientes y cuentas (js/cuentas-institucionales.js) ===== */
.cta-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cta-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.cta-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: var(--radius, 8px); background: transparent; color: inherit; cursor: pointer; text-align: left; font: inherit; min-width: 0; }
.cta-kpi:hover { background: var(--surface-hover, rgba(127,127,127,0.08)); }
.cta-kpi.is-active { border-color: var(--accent); }
.cta-kpi-label { font-size: 12px; color: var(--text-muted); }
.cta-kpi-val { font-size: 20px; font-weight: 700; }
.cta-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; margin-bottom: 14px; }
.cta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.cta-card { cursor: pointer; min-width: 0; }
.cta-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cta-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; min-width: 0; }
.cta-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cta-card-title strong { font-size: 15px; overflow-wrap: anywhere; }
.cta-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.cta-card-stats { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; font-size: 13px; }
.cta-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cta-chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; line-height: 1.4; white-space: nowrap; color: var(--text-muted); }
.cta-chip--ok { color: var(--seg-ok); }
.cta-chip--warn { color: var(--seg-warn); }
.cta-chip--danger { color: var(--seg-danger); }
.cta-chip--info { color: var(--accent); }
.cta-chip--muted { color: var(--text-muted); }
.cta-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.cta-line .ui-icon { flex-shrink: 0; color: var(--text-muted); }
.cta-ok { color: var(--seg-ok); }
.cta-warn { color: var(--seg-warn); }
.cta-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 13px; }
.cta-config { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.cta-config input { width: 80px; }
.cta-detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cta-detail-head h2 { margin: 0; overflow-wrap: anywhere; }
.cta-detail-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.cta-tabs { flex-wrap: wrap; }
.cta-count { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--accent); border: 1px solid currentColor; }
.prospeccion-tab.active .cta-count { color: inherit; }
.cta-overview { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.cta-h3 { margin: 0 0 10px 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.cta-texto { color: var(--text-secondary); line-height: 1.6; font-size: 13px; margin: 0; overflow-wrap: anywhere; }
.cta-datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 14px; }
.cta-dato { font-size: 14px; overflow-wrap: anywhere; }
.cta-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cta-stat { padding: 8px; border: 1px solid var(--border-color); border-radius: 6px; min-width: 0; }
.cta-stat-label { font-size: 12px; color: var(--text-muted); }
.cta-stat-val { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.cta-tab-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cta-tab-head p { margin: 0; }
.cta-op { border-left: 3px solid var(--text-muted); min-width: 0; }
.cta-op--ok { border-left-color: var(--seg-ok); }
.cta-op--danger { border-left-color: var(--seg-danger); }
.cta-op--info { border-left-color: var(--accent); }
.cta-op-monto { text-align: right; font-weight: 700; white-space: nowrap; }
.cta-link { cursor: pointer; }
.cta-link:hover, .cta-link:focus-visible { text-decoration: underline; }
.cta-table-wrap { overflow-x: auto; }
.cta-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cta-table th, .cta-table td { padding: 8px; border-bottom: 1px solid var(--border-color); text-align: left; vertical-align: top; }
.cta-table th { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.cta-num { text-align: right !important; white-space: nowrap; }
.cta-acts { display: flex; flex-direction: column; gap: 8px; }
.cta-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.cta-form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) {
    .cta-overview { grid-template-columns: minmax(0, 1fr); }
    .cta-form-grid, .cta-form-grid--3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .cta-filters { grid-template-columns: minmax(0, 1fr); }
    .cta-detail-actions { margin-left: 0; }
    .cta-table thead { display: none; }
    .cta-table, .cta-table tbody, .cta-table tr, .cta-table td { display: block; width: 100%; box-sizing: border-box; }
    .cta-table tr { border-bottom: 1px solid var(--border-color); padding: 6px 0; }
    .cta-table td { border: 0; padding: 2px 0; text-align: left !important; }
    .cta-table td::before { content: attr(data-l); display: block; font-size: 12px; color: var(--text-muted); }
}

/* Signed-out visitors (landing) and the participant view never see the suggestions button:
   it belongs to the app, which shows #main-app only after sign-in. */
body:has(#main-app[style*="display: none"]) #suggestions-fab { display: none !important; }
