/* ============================================================
   TaskFlow — Premium corporate design
   Tipografía: Inter
   Iconos: Lucide (SVG)
   Paleta: Slate + Blue refinado
   ============================================================ */

:root {
    /* Marca */
    --primary: #2563eb;          /* blue-600 */
    --primary-dark: #1d4ed8;     /* blue-700 */
    --primary-light: #eff6ff;    /* blue-50 */
    --primary-soft: #dbeafe;     /* blue-100 */

    /* Estados */
    --success: #059669;
    --success-bg: #d1fae5;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --purple: #7c3aed;
    --purple-bg: #ede9fe;

    /* Neutros (Slate) */
    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* Aliases semánticos */
    --bg: var(--slate-50);
    --bg-card: #ffffff;
    --surface: var(--bg-card); /* alias usado en varios lugares del código — nunca existía como variable propia, quedaba transparente */
    --bg-hover: var(--slate-100);
    --bg-sidebar: #0a0e1a;
    --bg-sidebar-section: #111726;
    --bg-sidebar-hover: #1a2030;

    --text: var(--slate-900);
    --text-secondary: var(--slate-600);
    --text-tertiary: var(--slate-500);
    --text-light: var(--slate-400);
    --text-on-dark: #f8fafc;
    --text-on-dark-dim: #cbd5e1;
    --text-on-dark-muted: #94a3b8;

    --border: var(--slate-200);
    --border-strong: var(--slate-300);
    --border-dark: rgba(255,255,255,0.06);

    /* Sombras corporativas */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow:    0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.10), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --ring: 0 0 0 3px rgba(37, 99, 235, 0.15);

    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --sidebar-w: 232px;
    --topbar-h: 52px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: all 0.15s var(--ease);
    --transition-slow: all 0.25s var(--ease);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
*:focus-visible { outline: none; }

/* Scrollbar premium minimalista */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.2);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.4); background-clip: content-box; }

/* Selection con brand color */
::selection { background: rgba(37, 99, 235, 0.2); color: var(--primary-dark); }

/* Smooth scroll */
html { scroll-behavior: smooth; }

html { -webkit-text-size-adjust: 100%; }

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
    transition: background-color 0.2s, color 0.2s;
}

/* ============ MODO OSCURO ============ */
html[data-theme="dark"] {
    --bg: #0b1020;
    --bg-card: #131a2e;
    --bg-hover: #1c2440;
    --bg-sidebar: #06091a;
    --bg-sidebar-section: #0d1226;
    --bg-sidebar-hover: #1a2240;

    --text: #e5e7eb;
    --text-secondary: #a7afc2;
    --text-tertiary: #7a8294;
    --text-light: #555f72;

    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --border-dark: rgba(255, 255, 255, 0.04);

    --primary-light: rgba(37, 99, 235, 0.15);
    --primary-soft: rgba(37, 99, 235, 0.25);
    --success-bg: rgba(5, 150, 105, 0.15);
    --warning-bg: rgba(217, 119, 6, 0.15);
    --danger-bg: rgba(220, 38, 38, 0.15);
    --purple-bg: rgba(124, 58, 237, 0.15);

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.45), 0 4px 6px rgba(0,0,0,0.3);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.5), 0 8px 10px rgba(0,0,0,0.3);
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .board-header,
html[data-theme="dark"] .group-header,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .board-card,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .config-panel,
html[data-theme="dark"] .config-tabs,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .drawer,
html[data-theme="dark"] .cmdk,
html[data-theme="dark"] .group {
    background-color: var(--bg-card);
    color: var(--text);
}
html[data-theme="dark"] .topbar-search input,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background-color: #0f1730;
    color: var(--text);
    border-color: var(--border);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--text-light); }

html[data-theme="dark"] .form-group input:focus,
html[data-theme="dark"] .form-group select:focus,
html[data-theme="dark"] .form-group textarea:focus {
    background: #131a2e;
}

html[data-theme="dark"] .tasks-table thead th,
html[data-theme="dark"] .gantt-header-row,
html[data-theme="dark"] .gantt-group-row,
html[data-theme="dark"] .gantt-day.weekend,
html[data-theme="dark"] .gantt-months {
    background: #0d1226;
}
html[data-theme="dark"] .gantt-day.today { background: var(--primary-soft); color: var(--primary); }
html[data-theme="dark"] .tasks-table tbody tr:hover { background: var(--bg-hover); }

html[data-theme="dark"] code {
    background: #1c2440;
    color: #ffd28a;
}

html[data-theme="dark"] .auth-body { background: var(--bg); }
html[data-theme="dark"] .auth-right { background: var(--bg-card); }
html[data-theme="dark"] .auth-form input { background: #0f1730 !important; color: var(--text) !important; border-color: var(--border) !important; }
html[data-theme="dark"] .auth-form-wrapper h2 { color: var(--text); }
html[data-theme="dark"] .auth-subtitle, html[data-theme="dark"] .auth-footer { color: var(--text-secondary); }
html[data-theme="dark"] .demo-info { background: #0f1730; border-color: var(--border); color: var(--text-secondary); }
html[data-theme="dark"] .demo-info code { background: var(--bg-card); color: #ffd28a; }

/* === DARK MODE OVERRIDES AMPLIOS (board, kanban, tablas, etc.) === */
html[data-theme="dark"] .view-tabs { background: var(--bg-card) !important; border-bottom: 1px solid var(--border) !important; padding: 0 16px !important; }
html[data-theme="dark"] .view-tab { color: var(--text-secondary) !important; background: transparent !important; }
html[data-theme="dark"] .view-tab:hover { color: var(--text) !important; background: var(--bg-hover) !important; }
html[data-theme="dark"] .view-tab.active { color: var(--primary) !important; border-bottom-color: var(--primary) !important; }
html[data-theme="dark"] .board-header { background: var(--bg-card) !important; color: var(--text) !important; }
html[data-theme="dark"] .board-title { color: var(--text) !important; }
html[data-theme="dark"] .board-description, html[data-theme="dark"] .board-card-desc { color: var(--text-secondary) !important; }

html[data-theme="dark"] .tasks-table { background: var(--bg-card); color: var(--text); }
html[data-theme="dark"] .tasks-table tbody tr { background: var(--bg-card); }
html[data-theme="dark"] .tasks-table tbody td { color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .group { background: var(--bg-card); }
html[data-theme="dark"] .kanban-column { background: var(--bg-sidebar-section); }
html[data-theme="dark"] .kanban-card,
html[data-theme="dark"] .task-row,
html[data-theme="dark"] .add-row,
html[data-theme="dark"] .add-group-input { background: var(--bg-card); color: var(--text); }
html[data-theme="dark"] .calendar,
html[data-theme="dark"] .calendar-cell,
html[data-theme="dark"] .calendar-day-name { background: var(--bg-card); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .calendar-cell.today { background: var(--primary-soft); }
html[data-theme="dark"] .calendar-cell.empty { background: var(--bg); }
html[data-theme="dark"] .group-name:focus { background: var(--bg-card); }
html[data-theme="dark"] .date-input:focus { background: var(--bg-card); }
html[data-theme="dark"] .gantt-task { color: var(--text); }
html[data-theme="dark"] .breadcrumbs a, html[data-theme="dark"] .breadcrumbs .current { color: var(--text-secondary); }
html[data-theme="dark"] .topbar-actions .btn-secondary { background: var(--bg-card); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .dropdown-menu { background: var(--bg-card); border-color: var(--border); }
html[data-theme="dark"] .dropdown-item { color: var(--text); }
html[data-theme="dark"] .dropdown-item:hover { background: var(--bg-hover); }
html[data-theme="dark"] .empty-state-rich { background: var(--bg-card); }
html[data-theme="dark"] .add-group { background: var(--bg-card); border-color: var(--border); color: var(--text-secondary); }

/* === Tareas completadas: opacas y tachadas (alta especificidad) === */
tr[data-estado="completado"],
tr.task-completed,
.kanban-card[data-estado="completado"],
.kanban-card.task-completed {
    background: rgba(0,200,117,0.04) !important;
}
tr[data-estado="completado"] td,
tr.task-completed td {
    opacity: 0.55 !important;
    color: var(--text-tertiary) !important;
    text-decoration: line-through !important;
}
tr[data-estado="completado"]:hover td,
tr.task-completed:hover td { opacity: 0.9 !important; }
tr[data-estado="completado"] td:first-child,
tr.task-completed td:first-child { opacity: 1 !important; text-decoration: none !important; }
.kanban-card[data-estado="completado"],
.kanban-card.task-completed { opacity: 0.55 !important; }
.kanban-card[data-estado="completado"]:hover,
.kanban-card.task-completed:hover { opacity: 0.95 !important; }
.kanban-card[data-estado="completado"] .kanban-card-title,
.kanban-card.task-completed .kanban-card-title { text-decoration: line-through !important; color: var(--text-tertiary) !important; }
html[data-theme="dark"] tr[data-estado="completado"],
html[data-theme="dark"] tr.task-completed { background: rgba(0,200,117,0.08) !important; }
.completed-divider { border-top: 1px dashed var(--border); margin: 6px 0; padding: 6px 12px; font-size: 11px; color: var(--text-tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Toggle visible en sidebar */
.theme-toggle {
    display: flex; align-items: center; gap: 8px;
    margin: 8px 12px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    color: rgba(255,255,255,0.85);
    font-size: 12.5px;
}
.theme-toggle:hover { background: rgba(255,255,255,0.1); }
.theme-toggle svg { width: 14px; height: 14px; }
.theme-toggle .switch-dot {
    margin-left: auto;
    width: 28px; height: 14px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    position: relative;
    transition: var(--transition);
}
.theme-toggle .switch-dot::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 10px; height: 10px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s var(--ease);
}
html[data-theme="dark"] .theme-toggle .switch-dot { background: var(--primary); }
html[data-theme="dark"] .theme-toggle .switch-dot::after { transform: translateX(14px); }

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
}

/* ============ ICONOS LUCIDE ============ */
/* display:inline-block es clave: un <i> es inline por defecto y los navegadores
   ignoran width/height en elementos inline, así que antes de que Lucide.js lo
   convierta a <svg> el ícono no reserva espacio — se ve "flotante" y salta al cargar. */
[data-lucide], .icon-svg {
    display: inline-block;
    width: 18px;
    height: 18px;
    stroke-width: 2;
    flex-shrink: 0;
    vertical-align: middle;
}
.icon-sm { width: 14px !important; height: 14px !important; }
.icon-md { width: 18px !important; height: 18px !important; }
.icon-lg { width: 22px !important; height: 22px !important; }
.icon-xl { width: 32px !important; height: 32px !important; stroke-width: 1.5 !important; }

/* ============ BOTONES ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 13px;
    line-height: 1.4;
    letter-spacing: -0.01em;
    transition: var(--transition);
    border: 1px solid transparent;
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}
.btn:focus-visible { box-shadow: var(--ring); }

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
}
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
    background: white;
    color: var(--text);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; color: white; }

.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; gap: 5px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn-icon { padding: 6px; }

/* ============ LAYOUT ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 60;
    border-right: 1px solid var(--border-dark);
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.sidebar-header {
    padding: 14px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    color: white;
    letter-spacing: -0.02em;
}
.sidebar-logo:hover { color: white; }
.sidebar-logo svg { width: 24px; height: 24px; }

.sidebar-section { padding: 4px 10px; margin-top: 8px; }

.sidebar-title {
    padding: 10px 10px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-on-dark-muted);
    letter-spacing: 0.04em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title-action {
    color: var(--text-on-dark-muted);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.sidebar-title-action:hover {
    background: var(--bg-sidebar-hover);
    color: white;
}
.sidebar-title-action svg { width: 14px; height: 14px; }

.sidebar-group { padding: 4px 10px; margin-top: 8px; }
.sidebar-group-header {
    padding: 10px 10px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-on-dark-muted);
    letter-spacing: 0.04em;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
}
.sidebar-group-header:hover { color: white; }
.sidebar-group-header span { flex: 1; }
.sidebar-group-header .sidebar-title-action { flex: none; margin-left: auto; }
.sidebar-group-chevron { width: 13px; height: 13px; flex-shrink: 0; transition: transform 0.15s var(--ease, ease); }
.sidebar-group.collapsed .sidebar-group-chevron { transform: rotate(-90deg); }
.sidebar-group-body { display: flex; flex-direction: column; }
.sidebar-group.collapsed .sidebar-group-body { display: none; }

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 10px;
    border-radius: var(--radius);
    color: var(--text-on-dark-dim);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 1px;
}
.sidebar-item:hover {
    background: var(--bg-sidebar-hover);
    color: white;
}
.sidebar-item.active {
    background: rgba(37, 99, 235, 0.15);
    color: white;
    box-shadow: inset 2px 0 0 var(--primary);
}
.sidebar-item svg { width: 16px; height: 16px; color: var(--text-on-dark-muted); flex-shrink: 0; }
.sidebar-item.active svg { color: white; }
.sidebar-item:hover svg { color: white; }

.sidebar-board-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 10px;
    border-top: 1px solid var(--border-dark);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}
.user-card:hover { background: var(--bg-sidebar-hover); }

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    background: var(--primary);
}
.avatar.sm { width: 24px; height: 24px; font-size: 9px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

.user-info { flex: 1; overflow: hidden; min-width: 0; }
.user-name {
    font-weight: 600;
    font-size: 13px;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.user-email {
    font-size: 11px;
    color: var(--text-on-dark-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-h);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 18px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.015em;
}

.topbar-search {
    flex: 1;
    max-width: 380px;
    position: relative;
    display: flex;
    align-items: center;
}
.topbar-search svg {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-light);
    pointer-events: none;
}
.topbar-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    transition: var(--transition);
    font-size: 13px;
}
.topbar-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: var(--ring);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.active { color: var(--warning); }

.content {
    flex: 1;
    padding: 18px 22px;
    overflow-x: auto;
}

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-xs);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ============ BOARD HEADER ============ */
.board-header {
    background: white;
    padding: 12px 18px 10px;
    border-bottom: 1px solid var(--border);
}

.board-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.board-color-tag {
    width: 6px;
    height: 26px;
    border-radius: 3px;
}

.board-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.board-description {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 6px;
    max-width: 680px;
}

.view-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    background: var(--surface, white);
    padding: 0 16px;
}
html[data-theme="dark"] .view-tabs { background: var(--bg-card); }

.view-tab {
    padding: 12px 14px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    margin-bottom: -1px;
}
.view-tab:hover { color: var(--text); }
.view-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.view-tab svg { width: 15px; height: 15px; }

/* ============ GRUPOS Y TAREAS - VISTA TABLA ============ */
.group {
    margin-bottom: 24px;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
}

.group-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 4px solid var(--primary);
    background: white;
}

.group-toggle {
    color: var(--text-tertiary);
    cursor: pointer;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}
.group-toggle:hover { background: var(--bg-hover); }
.group-toggle svg { transition: transform 0.2s var(--ease); width: 16px; height: 16px; }
.group.collapsed .group-toggle svg { transform: rotate(-90deg); }

.group-drag-handle {
    color: var(--text-tertiary);
    cursor: grab;
    width: 20px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}
.group-drag-handle:hover { background: var(--bg-hover); color: var(--text); }
.group-drag-handle svg { width: 14px; height: 14px; }
.group-dragging { opacity: 0.4; cursor: grabbing; }

.group-name {
    font-weight: 600;
    font-size: 14.5px;
    cursor: text;
    padding: 3px 6px;
    border-radius: 4px;
    letter-spacing: -0.01em;
}
.group-name:hover { background: var(--bg-hover); }
.group-name:focus { outline: 2px solid var(--primary); background: white; }

.group-count {
    color: var(--text-tertiary);
    font-size: 12px;
    background: var(--bg);
    padding: 2px 9px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid var(--border);
}

.group-actions { margin-left: auto; display: flex; gap: 2px; }

.table-wrap { overflow-x: auto; }

.tasks-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 820px;
}

.tasks-table thead th {
    background: #fafbfc;
    padding: 7px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 10.5px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    white-space: nowrap;
}
.tasks-table thead th:last-child { border-right: none; }

.tasks-table tbody tr {
    transition: background 0.1s var(--ease);
    border-bottom: 1px solid var(--border);
}
.tasks-table tbody tr:hover { background: var(--bg-hover); }
.tasks-table tbody tr:last-child { border-bottom: none; }

.tasks-table td {
    padding: 6px 12px;
    border-right: 1px solid var(--border);
    vertical-align: middle;
}
.tasks-table td:last-child { border-right: none; }

.task-title-cell { min-width: 280px; font-weight: 500; }
.task-title-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.task-title-row .title-link { min-width: 0; flex: 1; }
.task-title-cell .title-link {
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
}
.task-title-cell .title-link:hover { color: var(--primary); }

.task-open-btn {
    opacity: 0;
    color: var(--text-tertiary);
    padding: 3px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    transition: var(--transition);
}
.task-open-btn svg { width: 13px; height: 13px; }
.tasks-table tr:hover .task-open-btn { opacity: 1; }
.task-open-btn:hover { background: var(--bg); color: var(--primary); }

/* ============ BADGE-SELECT (status/priority) ============ */
.badge-select-wrap {
    display: flex;
    justify-content: center;
}

.status-badge, .priority-badge {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: none;
    color: white;
    font-weight: 600;
    font-size: 11.5px;
    padding: 5px 22px 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    text-align-last: center;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3e%3cpath fill='white' d='M6 8L2 4h8z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px;
    min-width: 124px;
    transition: var(--transition);
    letter-spacing: -0.005em;
}
.status-badge:hover, .priority-badge:hover { filter: brightness(1.05); }
.status-badge:focus, .priority-badge:focus {
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 1px;
}

.status-badge option, .priority-badge option {
    background: white;
    color: var(--text);
    font-weight: 500;
}

.status-pendiente    { background-color: var(--slate-400); }
.status-en_progreso  { background-color: var(--warning); }
.status-revision     { background-color: var(--purple); }
.status-completado   { background-color: var(--success); }
.status-detenido     { background-color: var(--danger); }

.priority-baja    { background-color: #0ea5e9; }
.priority-media   { background-color: #6366f1; }
.priority-alta    { background-color: var(--warning); }
.priority-critica { background-color: var(--danger); }

.priority-tag, .status-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 4px;
    color: white;
    font-weight: 600;
    font-size: 11px;
    text-transform: capitalize;
    line-height: 1.4;
    letter-spacing: -0.005em;
}

/* ============ ASIGNADOS ============ */
.assignees {
    display: flex;
    align-items: center;
}
.assignees .avatar {
    margin-left: -7px;
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--border);
}
.assignees .avatar:first-child { margin-left: 0; }

.add-assignee {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 1.5px dashed var(--border-strong);
    color: var(--text-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    cursor: pointer;
    transition: var(--transition);
}
.add-assignee svg { width: 12px; height: 12px; }
.add-assignee:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* ============ DATE INPUT ============ */
.date-input {
    border: 1px solid transparent;
    background: transparent;
    padding: 5px 8px;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 12.5px;
    width: 138px;
    cursor: pointer;
    transition: var(--transition);
    color-scheme: light;
}
.date-input:hover { background: var(--bg); border-color: var(--border); }
.date-input:focus { outline: none; border-color: var(--primary); background: white; box-shadow: var(--ring); }
.date-input.overdue { color: var(--danger); font-weight: 600; }

.tiempo-vencido { color: var(--danger); font-weight: 600; }
.tiempo-hoy { color: #f59e0b; font-weight: 600; }
.tiempo-pronto { color: #f59e0b; }
.cierre-a-tiempo { color: var(--success); font-weight: 600; }
.cierre-tarde { color: var(--danger); font-weight: 600; }

/* Columna de timer play/stop en la tabla */
.timer-cell { display: flex; align-items: center; gap: 6px; }
.timer-play-btn {
    width: 26px; height: 26px; border-radius: 50%; border: none;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; background: var(--primary-light); color: var(--primary);
    transition: var(--transition); flex-shrink: 0;
}
.timer-play-btn:hover:not(.disabled) { background: var(--primary); color: white; }
.timer-play-btn.active { background: var(--danger); color: white; }
.timer-play-btn.active:hover { background: #b91c1c; }
.timer-play-btn.disabled { background: var(--bg); color: var(--text-tertiary); cursor: not-allowed; opacity: 0.6; }
.timer-play-btn svg { width: 13px; height: 13px; }
.timer-col-text { font-size: 11.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Botón "asignar fecha de inicio de hoy" (mismo lenguaje visual que timer-play-btn) */
.start-date-btn { width: 26px; height: 26px; color: var(--text-tertiary); flex-shrink: 0; }
.start-date-btn:hover { color: var(--primary); background: var(--primary-light); }
.start-date-btn.active { color: var(--success); }
.start-date-btn.active:hover { background: var(--success-bg); }

/* Columna de acciones de fila: drag handle + agregar debajo */
.row-actions-cell { width: 52px; white-space: nowrap; padding-left: 6px !important; padding-right: 2px !important; }
.row-drag-handle,
.row-add-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 5px; border: none; background: none; padding: 0;
    color: var(--text-tertiary); opacity: 0; transition: var(--transition); vertical-align: middle;
}
.row-drag-handle { cursor: grab; }
.row-add-btn { cursor: pointer; }
.tasks-table tbody tr:hover .row-drag-handle,
.tasks-table tbody tr:hover .row-add-btn { opacity: 1; }
.row-drag-handle:hover, .row-add-btn:hover { background: var(--bg-hover); color: var(--text); }
.row-drag-handle svg, .row-add-btn svg { width: 14px; height: 14px; }
.row-dragging { opacity: 0.4; background: var(--primary-light); cursor: grabbing; }

/* ============ PROGRESS ============ */
.progress-cell { min-width: 140px; }
.progress-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--slate-200);
    border-radius: 999px;
    overflow: hidden;
    min-width: 60px;
}
.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 999px;
    transition: width 0.25s var(--ease);
}
.progress-text {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 30px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.progress-range {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    margin: 0;
}

/* ============ ADD ROWS ============ */
.add-task-row td {
    padding: 0 !important;
    background: white;
    border-right: none !important;
}
.add-task-input {
    width: 100%;
    padding: 10px 18px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    transition: var(--transition);
    font-size: 13.5px;
}
.add-task-input:hover { background: var(--bg); color: var(--text); }
.add-task-input:focus {
    background: white;
    color: var(--text);
    outline: none;
    box-shadow: inset 0 0 0 2px var(--primary);
}

.add-group-bar { margin-top: 8px; }
.add-group-input {
    padding: 10px 14px;
    border: 1px dashed var(--border-strong);
    background: transparent;
    border-radius: var(--radius);
    color: var(--text-tertiary);
    width: 280px;
    transition: var(--transition);
    font-size: 13px;
}
.add-group-input:hover { background: white; color: var(--text); }
.add-group-input:focus {
    outline: none;
    border-color: var(--primary);
    border-style: solid;
    color: var(--text);
    background: white;
    box-shadow: var(--ring);
}

/* ============ KANBAN ============ */
.kanban {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 20px;
}

.kanban-col {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-width: 296px;
    max-width: 296px;
    padding: 12px;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.kanban-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 10px;
    border-bottom: 2px solid;
    margin-bottom: 12px;
}

.kanban-col-name {
    font-weight: 600;
    flex: 1;
    font-size: 13.5px;
    letter-spacing: -0.01em;
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
    border-radius: var(--radius);
    transition: background 0.15s var(--ease);
    padding: 4px 0;
}
.kanban-cards.drop-target {
    background: var(--primary-light);
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
}

.kanban-card {
    background: white;
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    cursor: grab;
    transition: var(--transition);
}
.kanban-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    border-color: var(--border-strong);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.4; }

.kanban-card-title {
    font-weight: 600;
    font-size: 13.5px;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
    color: var(--text);
}

.kanban-card-desc {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.kanban-card-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 11.5px;
}
.meta-chip svg { width: 12px; height: 12px; }

.btn-add-card {
    width: 100%;
    padding: 9px;
    background: transparent;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-tertiary);
    font-size: 13px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-add-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.btn-add-card svg { width: 14px; height: 14px; }

/* ============ DASHBOARD ============ */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.dashboard-greeting h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: -0.02em;
}
.dashboard-greeting p { color: var(--text-secondary); font-size: 13px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 11.5px;
    color: var(--text-secondary);
    font-weight: 500;
}
.stat-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon svg { width: 14px; height: 14px; }
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.amber  { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red    { background: var(--danger-bg); color: var(--danger); }

.stat-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text);
}

.stat-trend {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 8px;
}

.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.board-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: var(--transition-slow);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}
.board-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: var(--border-strong);
    color: inherit;
}
.board-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--card-color, var(--primary));
}

.board-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}
.board-card-head h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text);
}
.board-card-head svg { width: 16px; height: 16px; color: var(--warning); fill: var(--warning); }

.board-card-desc {
    color: var(--text-secondary);
    font-size: 12.5px;
    line-height: 1.5;
    margin-bottom: 14px;
    height: 38px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.board-card .progress-bar { margin-bottom: 10px; }

.board-card-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.create-board-card {
    background: transparent;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 170px;
    color: var(--text-tertiary);
    font-weight: 500;
    font-size: 13px;
    gap: 6px;
}
.create-board-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.create-board-card svg { width: 24px; height: 24px; }

.upcoming-tasks { padding: 0; overflow: hidden; }
.upcoming-task {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    color: inherit;
    transition: background 0.15s var(--ease);
    text-decoration: none;
}
.upcoming-task:hover { background: var(--bg-hover); color: inherit; }
.upcoming-task:last-child { border-bottom: none; }

.upcoming-task-main { flex: 1; min-width: 0; }
.upcoming-task-title {
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 3px;
    color: var(--text);
    letter-spacing: -0.005em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upcoming-task-meta {
    font-size: 11.5px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.upcoming-task-meta svg { width: 11px; height: 11px; }

.text-danger { color: var(--danger) !important; font-weight: 600; }

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
    animation: overlayIn 0.15s var(--ease);
}
.modal-overlay.show { display: flex; }

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

.modal {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 580px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.2s var(--ease);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body { padding: 22px 24px; }

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #fafbfc;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============ FORMS ============ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 500;
    font-size: 12.5px;
    margin-bottom: 6px;
    color: var(--text);
    letter-spacing: -0.005em;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: var(--transition);
    background: white;
    font-size: 13.5px;
    color-scheme: light;
}
.form-group input::placeholder, .form-group textarea::placeholder {
    color: var(--text-light);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}
.form-group textarea { resize: vertical; min-height: 84px; font-family: inherit; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--border-strong);
    transition: var(--transition);
}
.color-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.color-swatch:has(input:checked) {
    box-shadow: 0 0 0 2px var(--text);
    transform: scale(1.08);
}

/* ============ POPOVER ============ */
.popover {
    position: absolute;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    min-width: 260px;
    z-index: 300;
    display: none;
    padding: 6px;
    animation: modalIn 0.15s var(--ease);
}
.popover.show { display: block; }
.popover-title {
    font-size: 10.5px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 600;
    padding: 8px 10px 4px;
    letter-spacing: 0.04em;
}
.popover-list {
    max-height: 280px;
    overflow-y: auto;
}
.popover-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}
.popover-item:hover { background: var(--bg-hover); }
.popover-item.selected {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 500;
}
.popover-item .check { margin-left: auto; color: var(--primary); display: inline-flex; }
.popover-item .check svg { width: 14px; height: 14px; }

/* ============ DROPDOWN ============ */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    min-width: 210px;
    z-index: 100;
    display: none;
    overflow: hidden;
    animation: modalIn 0.15s var(--ease);
}
.dropdown-menu.show { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-bg); color: var(--danger); }
.dropdown-item svg { width: 14px; height: 14px; color: var(--text-tertiary); }
.dropdown-item.danger svg { color: var(--danger); }

.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ============ ALERTS ============ */
.alert {
    padding: 11px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid var(--primary-soft); }

/* ============ EMPTY STATE RICH (CTA premium) ============ */
.empty-state-rich {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 24px;
    text-align: center;
    max-width: 480px;
    margin: 0 auto;
    box-shadow: var(--shadow-xs);
}
.empty-state-rich .empty-icon-bg {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}
.empty-state-rich .empty-icon-bg svg { width: 28px; height: 28px; }
.empty-state-rich h3 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    color: var(--text);
}
.empty-state-rich p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
    max-width: 360px;
    margin: 0 auto 18px;
}
.empty-state-rich .empty-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============ EMPTY STATE simple (existente) ============ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-tertiary);
}
/* Selector de hijo directo (no descendiente): en webhooks.php el estado vacío
   incluye un grid de tarjetas con sus propios íconos anidados más profundo, y un
   selector ".empty-state svg" los afectaba también (margin-bottom/opacity filtrándose
   y descentrando esos íconos dentro de sus badges — se veían "flotantes"). */
.empty-state > svg {
    width: 36px;
    height: 36px;
    margin-bottom: 12px;
    opacity: 0.5;
    color: var(--text-tertiary);
}
.empty-state h3 {
    color: var(--text);
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 15px;
}
.empty-state p { font-size: 13px; }

/* ============ DRAWER ============ */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 150;
    display: none;
    animation: overlayIn 0.2s var(--ease);
}
.drawer-overlay.show { display: block; }

.drawer {
    position: fixed;
    top: 0;
    right: -560px;
    width: 520px;
    max-width: 100%;
    height: 100vh;
    background: white;
    box-shadow: var(--shadow-xl);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: right 0.25s var(--ease);
}
.drawer.show { right: 0; }

.drawer-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.drawer-title-input {
    border: none;
    font-size: 15px;
    font-weight: 600;
    width: 100%;
    padding: 4px 6px;
    border-radius: var(--radius);
    background: transparent;
    letter-spacing: -0.015em;
    color: var(--text);
}
.drawer-title-input:hover { background: var(--bg-hover); }
.drawer-title-input:focus { outline: 2px solid var(--primary); background: white; }

.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px; }

.drawer-section {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.drawer-section:last-child { border-bottom: none; }

.drawer-section-title {
    font-size: 10.5px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.drawer-section-title svg { width: 12px; height: 12px; }

.detail-row {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
    align-items: center;
    font-size: 12.5px;
    min-height: 28px;
}
.detail-label {
    width: 84px;
    color: var(--text-tertiary);
    font-size: 11.5px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}
.detail-label svg { width: 12px; height: 12px; }
.detail-value { flex: 1; min-width: 0; }
.detail-value textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    transition: var(--transition);
}
.detail-value textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }

.comment {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.comment-body { flex: 1; min-width: 0; }
.comment-author { font-weight: 600; font-size: 13px; color: var(--text); }
.comment-time { font-size: 11px; color: var(--text-tertiary); margin-left: 6px; }
.comment-text { font-size: 13px; margin-top: 3px; word-wrap: break-word; line-height: 1.5; }

.comment-form {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.comment-form input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 13px;
}
.comment-form input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }

/* ============ DRAWER TABS Y CONTENIDO ENRIQUECIDO ============ */
.drawer-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
    overflow-x: auto;
}
.drawer-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    font-size: 12.5px;
    color: var(--text-tertiary);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: var(--transition);
}
.drawer-tab:hover { color: var(--text); background: var(--bg-hover); }
.drawer-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.drawer-tab svg { width: 14px; height: 14px; }
.tab-count {
    background: var(--slate-200);
    color: var(--text-secondary);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}
.drawer-tab.active .tab-count { background: var(--primary-light); color: var(--primary); }

.drawer-tab-content { animation: modalIn 0.18s var(--ease); }

/* Subitems */
.subitem-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
    background: white;
}
.subitem-row:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.subitem-row svg { width: 16px; height: 16px; flex-shrink: 0; }
.subitem-row span { font-size: 13px; flex: 1; }

/* Checklist */
.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    margin-bottom: 2px;
    transition: var(--transition);
}
.checklist-item:hover { background: var(--bg-hover); }
.checklist-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.checklist-item span { font-size: 13px; flex: 1; }
.checklist-item.done span { text-decoration: line-through; color: var(--text-tertiary); }
.checklist-item .icon-btn { opacity: 0; width: 24px; height: 24px; }
.checklist-item:hover .icon-btn { opacity: 1; }
.checklist-item .icon-btn svg { width: 13px; height: 13px; }

/* Archivos */
.file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    background: white;
}
.file-icon {
    width: 36px;
    height: 36px;
    background: var(--bg);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}
.file-icon svg { width: 18px; height: 18px; }
.files-list { width: 100%; max-width: 100%; }
.file-info { flex: 1; min-width: 0; overflow: hidden; }
.file-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--text);
    display: block;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-name:hover { color: var(--primary); text-decoration: underline; }
.file-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-tertiary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}
.file-upload:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.file-upload svg { width: 16px; height: 16px; }

/* Dependencias */
.dep-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    background: white;
}
.dep-row svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Actividad */
.activity-feed { display: flex; flex-direction: column; gap: 10px; }
.activity-item {
    display: flex;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    transition: var(--transition);
}
.activity-item:hover { background: var(--bg-hover); }
.activity-body { flex: 1; min-width: 0; }

/* Tags */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid transparent;
}
.tag-add {
    padding: 3px 9px;
    border-radius: 4px;
    border: 1px dashed var(--border-strong);
    background: white;
    color: var(--text-tertiary);
    font-size: 11.5px;
    transition: var(--transition);
}
.tag-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Input inline add */
.inline-add {
    margin-top: 8px;
}
.inline-add input {
    width: 100%;
    padding: 8px 12px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    font-size: 13px;
    background: transparent;
    color: var(--text-tertiary);
    transition: var(--transition);
}
.inline-add input:hover { background: white; color: var(--text); }
.inline-add input:focus {
    outline: none;
    border-color: var(--primary);
    border-style: solid;
    background: white;
    color: var(--text);
    box-shadow: var(--ring);
}

.icon-sm-btn {
    width: 22px !important;
    height: 22px !important;
}

/* ============ BÚSQUEDA RÁPIDA EN BOARD ============ */
.board-quick-search {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 10px 4px 28px;
    width: 200px;
    transition: var(--transition);
}
.board-quick-search:focus-within {
    background: white;
    border-color: var(--primary);
    box-shadow: var(--ring);
    width: 280px;
}
.board-quick-search svg {
    position: absolute;
    left: 8px;
    width: 13px;
    height: 13px;
    color: var(--text-tertiary);
}
.board-quick-search input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 12.5px;
    width: 100%;
    color: var(--text);
}
.board-quick-search input::placeholder { color: var(--text-light); }

/* ============ DRAG ROWS ============ */
.row-dragging { opacity: 0.4; background: var(--primary-light) !important; }
.tasks-table tr[data-task-id] { transition: background 0.12s; }
.group.drop-zone-active {
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
    background: var(--primary-light);
}

/* ============ SUBITEMS INDENTADOS ============ */
.task-subitem-toggle {
    display: inline-flex;
    width: 14px; height: 14px;
    margin-right: 4px;
    color: var(--text-tertiary);
    cursor: pointer;
}
.task-subitem-toggle svg { width: 12px; height: 12px; transition: transform 0.15s; }
.task-row.expanded .task-subitem-toggle svg { transform: rotate(90deg); }
.task-subitem-row { background: rgba(0,0,0,0.015); }
.task-subitem-row .task-title-cell .title-link { padding-left: 28px; font-size: 12.5px; opacity: 0.9; }
.task-subitem-row .task-title-cell .title-link::before {
    content: '↳';
    color: var(--text-light);
    margin-right: 6px;
}

/* Colapsar/desplegar subitems en la vista Tabla */
.subitem-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 4px; cursor: pointer;
    color: var(--text-tertiary); flex-shrink: 0; vertical-align: middle;
    margin-right: 2px; transition: var(--transition);
}
.subitem-toggle:hover { background: var(--bg-hover); color: var(--text); }
.subitem-toggle svg { width: 14px; height: 14px; transition: transform 0.2s var(--ease); }
tr.subitems-collapsed .subitem-toggle svg { transform: rotate(-90deg); }

/* ============ DRAWER INTERACTIVO PREMIUM ============ */

/* Quick action button (marcar completado) — compacto y sutil */
.quick-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 9px 14px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.005em;
    cursor: pointer;
    margin-bottom: 14px;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
}
.quick-action-btn:hover { background: #047857; box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3); }
.quick-action-btn:active { transform: scale(0.98); }
.quick-action-btn svg { width: 14px; height: 14px; }
.quick-action-btn.done {
    background: var(--slate-500);
    box-shadow: 0 1px 2px rgba(100, 116, 139, 0.2);
}
.quick-action-btn.done:hover { background: var(--slate-600); }

/* Input date dentro del drawer */
.drawer-date {
    padding: 5px 8px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    font-size: 12.5px;
    background: white;
    color-scheme: light;
    transition: var(--transition);
}
.drawer-date:hover { border-color: var(--primary); }
.drawer-date:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }

/* PROGRESS BAR interactivo compacto */
.drawer-progress { width: 100%; }
.drawer-progress-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 10px;
}
.drawer-progress-value {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
}
.drawer-progress-presets {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}
.prog-preset {
    padding: 2px 7px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-variant-numeric: tabular-nums;
}
.prog-preset:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary-soft); }
.prog-preset.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.drawer-progress-bar-wrap {
    position: relative;
    cursor: pointer;
    padding: 3px 0;
}
.drawer-progress-bar {
    height: 7px;
    background: var(--slate-100);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.drawer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: 999px;
    transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}
.drawer-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progFillShimmer 2s infinite;
}
@keyframes progFillShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.drawer-progress-slider {
    position: absolute;
    inset: 0;
    width: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
}
.drawer-progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: grab;
}

/* Asignados clickables */
.asignado-chip {
    cursor: pointer;
    transition: var(--transition);
}
.asignado-chip:hover {
    transform: scale(1.15) translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 3;
}
.asignado-chip::after {
    content: '×';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    border: 1.5px solid white;
}
.asignado-chip { position: relative; }
.asignado-chip:hover::after { opacity: 1; }

/* Animación "guardado" */
@keyframes savedPulse {
    0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); }
    100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}
.saved-pulse {
    animation: savedPulse 0.8s ease-out;
}

/* ============ REALTIME BANNER ============ */
.rt-banner {
    position: sticky;
    top: 0;
    background: linear-gradient(90deg, var(--primary-light), white);
    border: 1px solid var(--primary-soft);
    color: var(--primary-dark);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 12.5px;
    font-weight: 500;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideInDown 0.3s var(--ease);
    z-index: 5;
}
.rt-banner svg { width: 14px; height: 14px; }
.rt-banner.fade-out { opacity: 0; transform: translateY(-10px); transition: all 0.4s var(--ease); }
@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ PICKER MODAL ============ */
.picker-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}
.picker-item:hover, .picker-item.selected {
    background: var(--bg-hover);
}
.picker-item.selected {
    background: var(--primary-light);
}
.picker-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.picker-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* ============ MENCIONES + HILOS ============ */
.mention {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 500;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 6px;
}
.comment-reply-btn {
    margin-left: auto;
    color: var(--text-tertiary);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}
.comment:hover .comment-reply-btn { opacity: 1; }
.comment-reply-btn:hover { background: var(--primary-light); color: var(--primary); }
.comment-reply-btn svg { width: 11px; height: 11px; }

.comment-reply {
    position: relative;
}
.comment-reply::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
    border-radius: 1px;
}

.comment-form.replying {
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 8px;
    margin-top: 8px;
    background: var(--primary-light);
}
.comment-form.replying::before {
    content: 'Respondiendo — Esc para cancelar';
    font-size: 11px;
    color: var(--primary);
    font-weight: 500;
    margin-right: 8px;
    white-space: nowrap;
}

.mention-suggest {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 6px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    max-height: 240px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}
.mention-suggest.show { display: block; }
.mention-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition);
}
.mention-opt:hover, .mention-opt.selected {
    background: var(--primary-light);
}

/* ============ GANTT PREMIUM ============ */
.gantt-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 18px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-bottom: -1px;
}
.gantt-zoom-tabs {
    display: inline-flex;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 2px;
}
.gantt-zoom-tab {
    padding: 5px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}
.gantt-zoom-tab:hover { color: var(--text); }
.gantt-zoom-tab.active { background: white; color: var(--primary); box-shadow: var(--shadow-xs); }

.gantt-legend {
    display: flex;
    gap: 14px;
    margin-left: auto;
    font-size: 11.5px;
    color: var(--text-tertiary);
}
.gantt-legend span { display: inline-flex; align-items: center; gap: 5px; }
.gantt-legend .dot { width: 8px; height: 8px; border-radius: 50%; }

.gantt-container {
    background: white;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.gantt-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
}

.gantt-today-line {
    position: absolute;
    top: 76px;
    bottom: 0;
    width: 2px;
    background: var(--danger);
    z-index: 4;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.4);
}
.gantt-today-line::before {
    content: 'HOY';
    position: absolute;
    top: -16px;
    left: -16px;
    background: var(--danger);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 0.05em;
}

.gantt-header-row {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
}
.gantt-header-label {
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
    border-right: 1px solid var(--border);
}
.gantt-months {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}
.gantt-month {
    flex-shrink: 0;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gantt-days {
    display: grid;
}
.gantt-day {
    border-right: 1px solid var(--border);
    text-align: center;
    padding: 6px 0;
    font-size: 10.5px;
    color: var(--text-tertiary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.gantt-day.weekend { background: #f8fafc; color: var(--text-light); }
.gantt-day.today { background: var(--primary-light); color: var(--primary); font-weight: 700; }

.gantt-group-row {
    padding: 10px 16px;
    background: #fafbfc;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}
.gantt-group-count {
    background: var(--bg);
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    border: 1px solid var(--border);
    margin-left: 6px;
}

.gantt-row {
    display: grid;
    grid-template-columns: 260px 1fr;
    border-bottom: 1px solid var(--border);
    align-items: center;
    min-height: 40px;
    transition: background 0.12s;
}
.gantt-row:hover { background: var(--bg-hover); }

.gantt-label {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-right: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: white;
}
.gantt-label:hover { color: var(--primary); }
.gantt-label > span:last-child { overflow: hidden; text-overflow: ellipsis; }

.gantt-track {
    position: relative;
    height: 100%;
    padding: 6px 0;
}

.gantt-bar {
    position: absolute;
    height: 26px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 4px;
    overflow: visible;
    cursor: grab;
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.15s, transform 0.05s;
    user-select: none;
}
.gantt-bar:hover { box-shadow: var(--shadow); }
.gantt-bar.dragging { opacity: 0.75; cursor: grabbing; transition: none; box-shadow: var(--shadow-lg); }

.gantt-bar-content {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 10px;
    overflow: hidden;
    white-space: nowrap;
    color: white;
    font-size: 11.5px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}
.gantt-bar-title { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.gantt-bar-progress { font-size: 10.5px; opacity: 0.9; margin-left: 6px; }

.gantt-bar-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
    pointer-events: none;
}

.gantt-bar-handle {
    position: absolute;
    top: 0; bottom: 0;
    width: 6px;
    cursor: ew-resize;
    background: transparent;
    z-index: 2;
}
.gantt-bar-handle.left { left: 0; }
.gantt-bar-handle.right { right: 0; }
.gantt-bar:hover .gantt-bar-handle {
    background: rgba(255,255,255,0.3);
}
.gantt-bar:hover .gantt-bar-handle.left { border-left: 2px solid white; }
.gantt-bar:hover .gantt-bar-handle.right { border-right: 2px solid white; }

/* ============ TIMELINE / GANTT (LEGACY - mantenido para compat) ============ */
.timeline-container {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.timeline-header {
    display: flex;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.timeline-scroll { overflow-x: auto; }
.timeline-grid {
    display: grid;
    min-width: 1000px;
}
.timeline-row {
    display: grid;
    grid-template-columns: 240px 1fr;
    border-bottom: 1px solid var(--border);
    align-items: center;
    min-height: 44px;
}
.timeline-row:hover { background: var(--bg-hover); }
.timeline-label {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    border-right: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.timeline-label:hover { color: var(--primary); }
.timeline-track {
    position: relative;
    height: 100%;
    padding: 8px 0;
}
.timeline-bar {
    position: absolute;
    height: 26px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 4px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 500;
    color: white;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}
.timeline-bar:hover { transform: translateY(-50%) scale(1.02); box-shadow: var(--shadow); }
.timeline-group-header {
    padding: 10px 16px;
    background: var(--bg);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}
.timeline-days {
    display: grid;
    border-left: 1px solid var(--border);
}
.timeline-day-cell {
    border-right: 1px solid var(--border);
    text-align: center;
    padding: 6px 0;
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}
.timeline-day-cell.weekend { background: #fafbfc; color: var(--text-light); }
.timeline-day-cell.today { background: var(--primary-light); color: var(--primary); font-weight: 700; }

/* ============ TOAST ============ */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--text);
    color: white;
    padding: 10px 14px 10px 12px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    animation: toastIn 0.25s var(--ease);
    max-width: 320px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.fade-out { animation: toastOut 0.2s var(--ease) forwards; }

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

/* ============ CONFIRM MODAL ============ */
.confirm-modal { max-width: 400px; }
.confirm-modal .modal-body { text-align: center; padding: 28px 24px 20px; }
.confirm-modal .confirm-icon {
    width: 56px;
    height: 56px;
    background: var(--danger-bg);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--danger);
    margin-bottom: 14px;
}
.confirm-modal .confirm-icon svg { width: 26px; height: 26px; }
.confirm-modal h3 { font-size: 16px; margin-bottom: 4px; }
.confirm-modal p { color: var(--text-secondary); font-size: 13px; }
/* Cuando el mensaje trae un formulario propio (solicitar aprobación, etc.) alinear a la izquierda */
.confirm-modal .modal-body:has(#confirmMessage select),
.confirm-modal .modal-body:has(#confirmMessage textarea),
.confirm-modal .modal-body:has(#confirmMessage input) {
    text-align: left;
}
.confirm-modal #confirmMessage select,
.confirm-modal #confirmMessage textarea,
.confirm-modal #confirmMessage input {
    font-family: inherit;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 13px;
}

/* ============ POLISH PREMIUM ============ */
/* Avatares con borde sutil al hover */
.avatar { transition: transform 0.15s var(--ease); cursor: default; }
.assignees .avatar:hover { transform: scale(1.1) translateY(-1px); z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

/* Botones con feedback más sutil */
.btn { will-change: transform; }
.btn:active { transform: scale(0.97); }

/* Estados de focus enterprise */
input:focus, select:focus, textarea:focus, button:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 0;
}

/* Stat cards con hover más suave */
.stat-card { will-change: transform; }

/* Loading dots reutilizable */
.loading-dots::after {
    content: '';
    display: inline-block;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: currentColor;
    animation: loadingDots 1.4s infinite;
    box-shadow: 8px 0 0 currentColor, 16px 0 0 currentColor;
    margin-left: 4px;
}
@keyframes loadingDots {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

/* Card content reveal animation */
.boards-grid > * { animation: fadeUp 0.3s var(--ease) backwards; }
.boards-grid > *:nth-child(1) { animation-delay: 0ms; }
.boards-grid > *:nth-child(2) { animation-delay: 50ms; }
.boards-grid > *:nth-child(3) { animation-delay: 100ms; }
.boards-grid > *:nth-child(4) { animation-delay: 150ms; }
.boards-grid > *:nth-child(5) { animation-delay: 200ms; }
.boards-grid > *:nth-child(n+6) { animation-delay: 250ms; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* KPI grid en reportes igual */
.kpi-grid > *, .stats-grid > * {
    animation: fadeUp 0.3s var(--ease) backwards;
}
.kpi-grid > *:nth-child(2), .stats-grid > *:nth-child(2) { animation-delay: 50ms; }
.kpi-grid > *:nth-child(3), .stats-grid > *:nth-child(3) { animation-delay: 100ms; }
.kpi-grid > *:nth-child(4), .stats-grid > *:nth-child(4) { animation-delay: 150ms; }
.kpi-grid > *:nth-child(5), .stats-grid > *:nth-child(5) { animation-delay: 200ms; }
.kpi-grid > *:nth-child(6), .stats-grid > *:nth-child(6) { animation-delay: 250ms; }

/* Modal close con rotación sutil */
.modal-close { transition: all 0.2s var(--ease); }
.modal-close:hover { transform: rotate(90deg); }

/* Drawer con apertura más fluida */
.drawer { transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

/* Toast más expresivo */
.toast { animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Sidebar items con indicador sutil */
.sidebar-item { position: relative; }
.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: white;
    border-radius: 0 3px 3px 0;
}

/* Tooltip nativo más bonito (browser default es OK pero hacemos custom para algunos) */
[title]:hover { position: relative; }

/* Empty states más vivos con icono pulsante.
   Hijo directo (no descendiente): igual que con el margin-bottom/opacity de arriba,
   ".empty-state svg" también le pegaba un rebote infinito a los íconos anidados
   dentro de las tarjetas de servicio en webhooks.php — se veían "flotando y moviéndose". */
.empty-state > svg { animation: gentleBounce 3s ease-in-out infinite; }
@keyframes gentleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Status badges con shadow */
.status-tag, .priority-tag {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Progress bars con shimmer cuando están activas */
.progress-fill { position: relative; overflow: hidden; }
.progress-fill::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: progressShimmer 2.5s infinite;
}
@keyframes progressShimmer {
    100% { left: 200%; }
}

/* Card-header con espacio mejor */
.card-header h2 { letter-spacing: -0.015em; }

/* Print styles globales */
@media print {
    .topbar, .sidebar, .cmdk-overlay, .modal-overlay, .drawer { display: none !important; }
    .main { margin-left: 0 !important; }
    /* #mobileHeader/#mobileBottomNav son position:fixed — sin ocultarlos, un navegador
       angosto (el caso típico: imprimir desde el celular) los repite/superpone en cada
       página impresa en vez de mostrarlos una sola vez. */
    #mobileHeader, #mobileBottomNav, #mobileFAB, #floatingWidgets, #fwChatPanel, #fwTimerActivo { display: none !important; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    :root { --sidebar-w: 0; }
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
}

/* ============ UTILITIES ============ */
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-semibold { font-weight: 600; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ============================================
   MOBILE GLOBAL OVERRIDES (alta prioridad)
   ============================================ */
@media (max-width: 900px) {
    /* Anti-desborde */
    html, body { overflow-x: hidden !important; width: 100% !important; max-width: 100vw !important; }
    *, *::before, *::after { box-sizing: border-box !important; }
    .app, .main, .content, .card, .modal, .drawer, table, pre, code {
        max-width: 100% !important;
    }

    /* Drawer escondido por defecto, sólo visible con .show */
    .drawer {
        width: 100vw !important;
        max-width: 100vw !important;
        right: -110vw !important;
        transition: right 0.25s ease !important;
    }
    .drawer.show { right: 0 !important; }

    /* Sidebar móvil ya manejado en sidebar.php */
    /* Main: sin margin-left, padding-top para header móvil */
    .main { margin-left: 0 !important; padding-top: 58px !important; width: 100% !important; overflow-x: hidden !important; }
    .app.sidebar-collapsed-app .main { margin-left: 0 !important; }

    /* Topbar: limpio */
    .topbar { padding: 12px 14px !important; flex-wrap: wrap; gap: 8px; }
    .topbar-cmdk { display: none !important; }

    /* Contenido principal */
    .content { padding: 14px !important; }
    h1 { font-size: 19px !important; }
    h2 { font-size: 16px !important; }
    .dashboard-greeting h1 { font-size: 20px !important; }

    /* Grids → 1 col */
    .boards-grid, .stats-grid, .form-row { grid-template-columns: 1fr !important; flex-direction: column !important; }

    /* Cards */
    .card { padding: 14px !important; }
    .stat-card { padding: 14px !important; }
    .board-card { padding: 14px !important; }

    /* Tablas */
    .tasks-table-wrap, .table-wrap, .data-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .tasks-table { font-size: 12px; min-width: 600px; }
    .tasks-table th, .tasks-table td { padding: 6px 8px !important; }

    /* Kanban scroll horizontal */
    .kanban-board { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .kanban-column { min-width: 260px !important; max-width: 260px !important; flex-shrink: 0; }

    /* Vista tabs */
    .view-tabs { overflow-x: auto !important; -webkit-overflow-scrolling: touch; padding: 0 12px !important; }
    .view-tab { white-space: nowrap; padding: 10px 12px !important; font-size: 12px; }

    /* Inputs sin zoom iOS */
    input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="date"], textarea, select {
        font-size: 16px !important;
    }

    /* Modales */
    .modal-overlay { padding: 10px !important; }
    .modal { max-width: 100% !important; width: 100% !important; max-height: 92vh; overflow-y: auto; }
    .modal-footer { flex-direction: column-reverse !important; gap: 6px !important; }
    .modal-footer .btn { width: 100%; }

    /* Botones del topbar — solo iconos */
    .topbar-actions .btn span:not(.badge):not(.sidebar-badge) { display: none; }
    .topbar-actions .btn { padding: 8px 10px !important; }

    /* === FIX BOARD: header en columna, búsqueda full-width === */
    .topbar { padding: 10px 12px !important; }
    .topbar-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100%;
        margin-top: 6px;
    }
    .topbar-actions .assignees { margin-right: 0 !important; }
    .topbar-actions .btn-ai span { display: inline !important; }
    .topbar-actions .btn-ai { padding: 6px 10px !important; font-size: 12px !important; }
    .board-quick-search {
        flex: 1 1 100% !important;
        order: -1 !important;
    }
    .board-quick-search input { width: 100% !important; min-width: 0 !important; font-size: 14px !important; }
    .board-header { padding: 12px !important; }
    .board-title-row { flex-wrap: wrap !important; gap: 8px !important; align-items: center !important; }
    .board-title { font-size: 18px !important; word-break: break-word; }

    /* === FIX CARDS DESBORDE: forzar width y word-wrap === */
    .board-card, .stat-card, .card, .empty-state-rich {
        width: auto !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
    }
    .board-card-desc, .board-title, .card p, .stat-card div, h3, h4 {
        overflow-wrap: break-word !important;
        word-break: break-word !important;
        white-space: normal !important;
        max-width: 100% !important;
    }
    .boards-grid { display: flex !important; flex-direction: column !important; gap: 10px !important; }

    /* Breadcrumbs en una sola línea con scroll horizontal si hace falta */
    .breadcrumbs {
        overflow-x: auto !important;
        white-space: nowrap !important;
        font-size: 12px !important;
        max-width: 100% !important;
        -webkit-overflow-scrolling: touch;
    }
    .breadcrumbs::-webkit-scrollbar { display: none; }

    /* === TOPBAR: VERTICAL EN MÓVIL (sin solapes) === */
    .topbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding: 10px 12px !important;
    }
    .topbar > * { width: 100% !important; }
    .topbar-title, .topbar > h1 { text-align: left; font-size: 16px !important; margin: 0 !important; }
    .topbar-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        justify-content: flex-start !important;
        width: 100% !important;
    }
    .topbar-actions .btn { flex-shrink: 0; }

    /* === BOARD HEADER: column con todo bien apilado === */
    .board-header {
        padding: 12px !important;
    }
    .board-title-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .board-title-row > div[style*="margin-left: auto"],
    .board-title-row > div:last-child {
        margin-left: 0 !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
    }
    .board-stat { font-size: 11.5px !important; }

    /* === TABLA: separación segura entre columnas === */
    .tasks-table {
        min-width: 720px !important;
        table-layout: auto;
    }
    .tasks-table thead th,
    .tasks-table tbody td {
        padding: 8px 10px !important;
        vertical-align: middle;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap !important;
    }
    .tasks-table td .assignees,
    .tasks-table td .badge-select-wrap {
        position: static !important;
    }
    .tasks-table tbody td:first-child { width: 240px; min-width: 240px; }
    .tasks-table tbody td:nth-child(2) { width: 110px; min-width: 110px; }

    /* === ASSIGNEES no se solapan con título === */
    .assignees, .avatars-stack {
        display: inline-flex !important;
        flex-wrap: nowrap;
    }
    .avatar.sm { width: 22px !important; height: 22px !important; font-size: 10px !important; flex-shrink: 0; }

    /* === Board search input full-width === */
    .board-quick-search {
        width: 100% !important;
        flex: 1 1 100% !important;
    }
    .board-quick-search input { width: 100% !important; }

    /* Group header */
    .group-header {
        padding: 10px !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    /* === BOARD TOPBAR ACTIONS: scroll horizontal con TODOS los botones === */
    .topbar .topbar-actions {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        width: 100% !important;
        margin-top: 4px;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 4px;
        flex-direction: row !important;
        align-items: center;
    }
    .topbar .topbar-actions::-webkit-scrollbar { display: none; }
    .topbar .topbar-actions > * { flex-shrink: 0 !important; }
    .topbar .topbar-actions .board-quick-search {
        flex: 0 0 auto !important;
        min-width: 160px !important;
        max-width: 200px;
    }
    .topbar .topbar-actions .board-quick-search input {
        width: 100% !important;
        font-size: 14px !important;
    }
    .topbar .topbar-actions .btn-ai,
    .topbar .topbar-actions .btn-primary {
        white-space: nowrap !important;
        padding: 8px 12px !important;
    }
    .topbar .topbar-actions .btn-ai span,
    .topbar .topbar-actions .btn-primary span { display: inline !important; }
    .topbar .topbar-actions .assignees {
        display: inline-flex !important;
        flex-shrink: 0 !important;
    }
    .topbar .topbar-actions .dropdown,
    .topbar .topbar-actions .icon-btn { flex-shrink: 0 !important; }

    /* === BOARD HEADER (segundo): título + stats apilados === */
    .board-header {
        padding: 14px 12px !important;
    }
    .board-title-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    .board-title-row > * { width: 100% !important; max-width: 100% !important; }
    .board-title { font-size: 18px !important; line-height: 1.25; }
    .board-description { font-size: 12.5px !important; }
    .board-title-row > div:last-child {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        margin-left: 0 !important;
    }

    /* === TABLA: wrapper con scroll horizontal real === */
    .table-wrap, .tasks-table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    .tasks-table {
        min-width: 820px !important;
        table-layout: fixed;
    }
    .tasks-table thead th:nth-child(1),
    .tasks-table tbody td:nth-child(1) {
        width: 280px !important;
        min-width: 280px !important;
        max-width: 280px !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .tasks-table thead th:nth-child(2),
    .tasks-table tbody td:nth-child(2) {
        width: 120px !important;
        min-width: 120px !important;
    }
    .tasks-table tbody td:nth-child(2) .assignees {
        display: flex !important;
        gap: 2px;
    }

    /* Group container interior: scroll si la tabla es más ancha */
    .group { overflow-x: auto !important; }

    /* === FIX FINAL: cards descripciones visibles completas, sin desborde === */
    .boards-grid {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .board-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 14px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
    .board-card-desc, .board-card h3 {
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        line-height: 1.4 !important;
        max-width: 100% !important;
    }
    /* Stats grid en inicio: sin desborde */
    .stats-grid { padding: 0 !important; width: 100% !important; max-width: 100% !important; }
    .stat-card { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
    /* Content padding consistente */
    .content { padding-left: 14px !important; padding-right: 14px !important; }

    /* === Floating widgets arriba del bottom nav === */
    #floatingWidgets { bottom: 82px !important; right: 14px !important; }
    #fwTimerActivo { bottom: 142px !important; }
    #fwChatPanel { bottom: 82px !important; }

    /* === GLOBAL: TOPBAR STICKY con botones siempre visibles === */
    .topbar {
        position: sticky !important;
        top: 54px !important;
        background: var(--surface, white) !important;
        z-index: 100;
        border-bottom: 1px solid var(--border);
    }
    html[data-theme="dark"] .topbar { background: var(--bg-card) !important; }

    /* === Topbar-actions: scroll horizontal universal === */
    /* Cualquier topbar-actions con muchos botones se vuelve scroll horizontal */
    .topbar-actions {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 8px !important;
        padding-bottom: 4px;
        max-width: 100%;
    }
    .topbar-actions::-webkit-scrollbar { display: none; }
    .topbar-actions > *,
    .topbar-actions .btn { flex-shrink: 0 !important; white-space: nowrap !important; }

    /* === Botones de acción primaria siempre con texto + icono === */
    .topbar-actions .btn-primary,
    .topbar-actions .btn.btn-primary {
        padding: 8px 14px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
    }
    .topbar-actions .btn-primary span,
    .topbar-actions .btn-primary i { display: inline-flex !important; }

    /* === Modal: footer sticky con botón principal SIEMPRE visible === */
    .modal { position: relative; }
    .modal-footer {
        position: sticky !important;
        bottom: 0 !important;
        background: var(--surface, white) !important;
        margin-top: 12px;
        padding: 12px 14px !important;
        border-top: 1px solid var(--border);
        z-index: 10;
    }
    html[data-theme="dark"] .modal-footer { background: var(--bg-card) !important; }
    .modal-body { padding-bottom: 14px !important; }

    /* === Botones "+ Agregar" inline (en cards, grupos, etc.) === */
    .add-task-row, .add-group-input, .create-board-card, .add-row {
        position: sticky !important;
        bottom: 80px;
        background: var(--surface, white);
        z-index: 5;
    }
    /* Excepto cuando son children directos sin scroll context */
    .tasks-table .add-task-row { position: relative !important; bottom: auto; }

    /* === Padding bottom GLOBAL: contenido nunca tapado por bottom nav === */
    .main { padding-bottom: 88px !important; }
    .content { padding-bottom: 24px !important; }

    /* === Drawer header con close visible === */
    .drawer-header { position: sticky !important; top: 0; z-index: 5; background: var(--surface, white); }
    html[data-theme="dark"] .drawer-header { background: var(--bg-card) !important; }
    .drawer-body { padding-bottom: 80px !important; }

    /* === FAB universal (botones tipo + Nueva tarea/objetivo/etc.) === */
    /* Si una página tiene un botón flotante específico, este CSS le da bottom de seguridad */
    .fab, .floating-add-btn {
        position: fixed !important;
        bottom: 80px !important;
        right: 18px !important;
        z-index: 110;
        width: 56px !important;
        height: 56px !important;
        border-radius: 50% !important;
        box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    }
}

/* ============ DESKTOP: revertir sticky === */
@media (min-width: 901px) {
    .topbar { position: relative; top: auto; }
}

/* ============ FIX FINAL MÓVIL (sobreescribe todo lo anterior) ============ */
@media (max-width: 900px) {
    /* Body con scroll funcional */
    html { height: 100%; }
    body {
        position: relative !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        width: 100% !important;
        max-width: 100vw !important;
        min-height: 100vh;
    }
    .app {
        position: relative !important;
        min-height: 100vh;
        overflow-x: hidden !important;
    }

    /* QUITAR sticky de topbar (causaba problemas) */
    .topbar {
        position: relative !important;
        top: auto !important;
        z-index: auto !important;
    }

    /* === BOTTOM NAV: 100% fijo === */
    #mobileBottomNav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 9988 !important;
        display: flex !important;
    }

    /* === HEADER MÓVIL: 100% fijo === */
    #mobileHeader {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 9990 !important;
        display: flex !important;
    }

    /* === DRAWER por encima de TODO en móvil === */
    .drawer { z-index: 9999 !important; background: white !important; }
    html[data-theme="dark"] .drawer { background: var(--bg-card) !important; }
    .drawer-overlay { z-index: 9998 !important; }
    .ai-drawer { z-index: 9999 !important; }

    /* Cuando hay drawer abierto: ocultar todo lo de fondo */
    body:has(.drawer.show) #mobileBottomNav,
    body:has(.drawer.show) #floatingWidgets,
    body:has(.drawer.show) #fwTimerActivo,
    body:has(.drawer.show) #mobileFAB { display: none !important; }

    /* Main con padding correcto */
    .main {
        padding-top: 54px !important;
        padding-bottom: 76px !important;
        min-height: 100vh;
    }

    /* FAB: visible cuando hay un botón primario en topbar-actions */
    body.has-primary-action #mobileFAB { display: flex !important; }
    body.has-primary-action #floatingWidgets { bottom: 150px !important; }

    /* Cuando hay drawer/modal: ocultar FAB y bottom nav y flotantes */
    body:has(.modal.active) #mobileFAB,
    body:has(.modal-overlay.show) #mobileFAB,
    body:has(.modal-overlay.active) #mobileFAB,
    body:has(.drawer.show) #mobileFAB,
    body.modal-open #mobileFAB { display: none !important; }

    body:has(.modal-overlay.active) #mobileBottomNav,
    body:has(.modal-overlay.show) #mobileBottomNav,
    body:has(.modal.active) #mobileBottomNav,
    body:has(.drawer.show) #mobileBottomNav,
    body.modal-open #mobileBottomNav { display: none !important; }

    body:has(.modal-overlay.active) #floatingWidgets,
    body:has(.modal-overlay.show) #floatingWidgets,
    body:has(.drawer.show) #floatingWidgets,
    body.modal-open #floatingWidgets { display: none !important; }

    body:has(.modal-overlay.active) #fwTimerActivo,
    body:has(.modal-overlay.show) #fwTimerActivo,
    body:has(.drawer.show) #fwTimerActivo,
    body.modal-open #fwTimerActivo { display: none !important; }

    /* === ESCONDER botón primario del topbar (ya hay FAB) === */
    body.has-primary-action .topbar-actions .btn-primary { display: none !important; }

    /* === MODAL: ajustar tamaño correcto en móvil === */
    .modal-overlay {
        padding: 12px !important;
        align-items: flex-start !important;
        padding-top: 70px !important;
    }
    .modal {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        max-height: calc(100vh - 90px) !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .modal-header { flex-shrink: 0; }
    .modal-body {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .modal-footer { flex-shrink: 0; position: relative !important; }

    /* === DASHBOARD board-card: ancho exacto del viewport === */
    .boards-grid { padding: 0 !important; margin: 0 !important; width: 100% !important; }
    .board-card {
        width: calc(100vw - 28px) !important;
        max-width: calc(100vw - 28px) !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
    .board-card-desc {
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        word-break: break-word !important;
        line-height: 1.4;
    }
    .board-card h3 {
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        max-width: 100% !important;
    }

    /* === Próximas tareas / Actividad reciente === */
    .upcoming-tasks {
        width: calc(100vw - 28px) !important;
        max-width: calc(100vw - 28px) !important;
        overflow: hidden !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    /* También el wrapper si hay grid 2 col en desktop */
    .dashboard-grid > div,
    .content > div > .card-header { width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
    .card-header { padding: 0 0 10px 0 !important; }
    .upcoming-task {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        padding: 12px 14px !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        border-bottom: 1px solid var(--border);
    }
    .upcoming-task:last-child { border-bottom: none; }
    .upcoming-task-main {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }
    .upcoming-task-title {
        font-weight: 600;
        font-size: 13.5px;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        max-width: 100% !important;
        margin-bottom: 2px;
    }
    .upcoming-task-meta {
        font-size: 11.5px !important;
        color: var(--text-tertiary);
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        max-width: 100% !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px;
    }
    .upcoming-task-meta i { width: 12px; height: 12px; flex-shrink: 0; }
    .upcoming-task .status-tag,
    .upcoming-task > i {
        flex-shrink: 0 !important;
        white-space: nowrap;
        font-size: 10.5px !important;
    }

    /* === MODAL: barra superior con X SIEMPRE visible === */
    .modal-overlay {
        position: fixed !important;
        top: 54px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        padding: 14px !important;
        padding-top: 14px !important;
        align-items: flex-start !important;
        overflow-y: auto !important;
        height: calc(100vh - 54px) !important;
    }
    .modal {
        max-height: calc(100vh - 100px) !important;
        margin-top: 0 !important;
    }
    .modal-header {
        position: sticky !important;
        top: 0 !important;
        background: white !important;
        z-index: 5;
        padding: 14px 16px !important;
        border-bottom: 1px solid var(--border);
    }
    html[data-theme="dark"] .modal-header { background: var(--bg-card) !important; }

    /* === CHAT: estructura fija con scroll SOLO en mensajes === */
    body.chat-mobile-conversacion .chat-layout {
        position: fixed !important;
        top: 54px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 76px !important;
        height: auto !important;
        z-index: 100;
        background: white;
        padding-bottom: 0 !important;
    }
    html[data-theme="dark"] body.chat-mobile-conversacion .chat-layout { background: var(--bg); }
    body.chat-mobile-conversacion .chat-main {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        overflow: hidden !important;
    }
    body.chat-mobile-conversacion .chat-conv-head {
        flex-shrink: 0 !important;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        box-shadow: 0 1px 0 var(--border);
    }
    html[data-theme="dark"] body.chat-mobile-conversacion .chat-conv-head { background: var(--bg-card); }
    body.chat-mobile-conversacion .chat-mensajes {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important;
        padding-bottom: 12px !important;
    }
    body.chat-mobile-conversacion .chat-compose {
        flex-shrink: 0 !important;
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid var(--border);
        padding: 10px !important;
    }
    html[data-theme="dark"] body.chat-mobile-conversacion .chat-compose { background: var(--bg-card); }

    /* Cuando estás en conversación de chat, ocultar floating widgets */
    body.chat-mobile-conversacion #floatingWidgets,
    body.chat-mobile-conversacion #fwTimerActivo,
    body.chat-mobile-conversacion #mobileFAB { display: none !important; }
}
