﻿/* =========================================
   1. ESTILOS MAESTROS (RECUPERADOS DE V72.1 - LA BONITA)
   ========================================= */
:root {
    --brand: #003366;
    /* PM Advisor Navy Blue */
    --brand-2: #00ADEF;
    /* PM Advisor Cyan */
    --ok: #B3D235;
    /* PM Advisor Lime Green */
    --nok: #ef4444;
    --warning: #f59e0b;
    --bg-body: #F8FAFC;
    /* Light Mode Workspace */
    --text-main: #1e293b;
    /* Dark text for light mode */
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    --risk-low: #86efac;
    --risk-med: #fde047;
    --risk-high: #fca5a5;
    --header-gray: #ffffff;
    --light-blue: #f1f5f9;
    --rag-gray: #e2e8f0;

    /* Colores EspecÃ­ficos MÃ³dulos */
    --kb-bg: #f8fafc;
    --kb-col-bg: #e2e8f0;
    --kb-card-bg: #ffffff;
    --prio-high: #ef4444;
    --prio-med: #f59e0b;
    --prio-low: #B3D235;
    --st-card-bg: #ffffff;
    --st-border: var(--border-color);

    /* === DESIGN TOKENS â€” BORDES Y SEPARADORES === */
    --border-color: #cbd5e1;          /* Color estÃ¡ndar para TODOS los bordes (Oscurecido) */
    --border-color-strong: #94a3b8;    /* Color para bordes que necesitan mÃ¡s Ã©nfasis (Oscurecido) */
    --border-width: 1px;               /* Grosor estÃ¡ndar */
    --border-width-section: 1.5px;     /* Grosor para contenedores principales */
    --border-radius-sm: 6px;           /* Border radius pequeÃ±o (inputs, badges) */
    --border-radius-md: 10px;          /* Border radius medio (tarjetas, secciones) */
    --border-radius-lg: 14px;          /* Border radius grande (modales, cards principales) */
    
    /* === DESIGN TOKENS â€” SOMBRAS === */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);       /* Sombra sutil para tarjetas */
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);        /* Sombra media para secciones */
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.12);       /* Sombra grande para modales */
    
    /* === DESIGN TOKENS â€” TIPOGRAFÃA (escala reducida) === */
    --fs-xs: 0.75rem;     /* 12px â€” labels muy pequeÃ±os, badges */
    --fs-sm: 0.8rem;      /* ~13px â€” texto secundario, notas */
    --fs-base: 0.875rem;  /* 14px â€” texto principal del body */
    --fs-md: 1rem;        /* 16px â€” subtÃ­tulos de secciÃ³n */
    --fs-lg: 1.25rem;     /* 20px â€” tÃ­tulos de secciÃ³n */
    --fs-xl: 1.5rem;      /* 24px â€” tÃ­tulos de pestaÃ±a */
    --fs-kpi: 1.8rem;     /* ~29px â€” valores grandes en tarjetas KPI */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    padding-bottom: 0;
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
}

/* Forzar herencia tipogrÃ¡fica en elementos de formulario */
input, select, textarea, button, table, th, td {
    font-family: inherit;
}

/* =========================================
   APP SHELL â€” Sidebar + Content Layout
   ========================================= */
#app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

#app-sidebar {
    width: 240px;
    min-width: 240px;
    height: 100vh;
    background: #0b1a2e;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, min-width 0.25s ease;
    overflow: hidden;
    position: relative;
    z-index: 998;
    flex-shrink: 0;
}

#app-sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

#app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    background-color: var(--bg-body);
}

/* ===== SIDEBAR STYLES ===== */
.sidebar-brand {
    padding: 16px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #00b8d4, #0091ea);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-brand-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    line-height: 1.2;
}
.sidebar-brand-version {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    line-height: 1.2;
}
.sidebar-brand-text {
    transition: opacity 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-project-selector {
    padding: 10px 12px;
    margin: 8px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}
.sidebar-project-selector:hover {
    background: rgba(255,255,255,0.08);
}
.sidebar-project-health {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    flex-shrink: 0;
}
.sidebar-project-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.sidebar-project-label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    display: block;
    line-height: 1;
}
.sidebar-project-id {
    font-size: 13px;
    color: #fff;
    font-weight: 500;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}
.sidebar-section-label {
    font-size: 10px;
    font-weight: 500;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 6px 8px 4px;
    margin-top: 8px;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}
.sidebar-section-label:first-child {
    margin-top: 4px;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    margin: 1px 0;
    transition: background 0.15s, color 0.15s;
    user-select: none;
}
.sidebar-item:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
}
.sidebar-item.active {
    background: rgba(0,184,212,0.12);
    color: #4dd0e1;
}
.sidebar-item.active .sidebar-item-label {
    font-weight: 500;
}
.sidebar-icon {
    flex-shrink: 0;
}
.sidebar-item-label {
    font-size: 13px;
    white-space: nowrap;
    transition: opacity 0.2s ease;
    overflow: hidden;
}
.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.06);
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    width: 100%;
    cursor: pointer;
    color: rgba(255,255,255,0.4);
    font-size: 12px;
    transition: background 0.15s;
}
.sidebar-collapse-btn:hover {
    background: rgba(255,255,255,0.1);
}
#sidebar-collapse-icon {
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

/* Estado colapsado del sidebar */
#app-sidebar.collapsed .sidebar-brand-text,
#app-sidebar.collapsed .sidebar-project-details,
#app-sidebar.collapsed .sidebar-project-chevron,
#app-sidebar.collapsed .sidebar-section-label,
#app-sidebar.collapsed .sidebar-item-label {
    opacity: 0;
    pointer-events: none;
    width: 0;
}
#app-sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 16px 12px 12px;
}
#app-sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 8px;
}
#app-sidebar.collapsed .sidebar-collapse-btn {
    justify-content: center;
    padding: 8px;
}
#app-sidebar.collapsed .sidebar-project-selector {
    justify-content: center;
}
#app-sidebar.collapsed #sidebar-collapse-icon {
    transform: rotate(180deg);
}

/* Ocultar el drawer/overlay antiguo y el hamburger */
.hamburger-btn {
    display: none !important;
}
.sidebar-overlay {
    display: none !important;
}
#main-nav.nav-bar {
    display: none !important;
}
.health-bar {
    display: none !important;
}

/* Ocultar sidebar en login/selector (controlado vÃ­a JS con clase en body) */
body.mode-login #app-shell,
body.mode-selector #app-shell {
    display: none;
}

/* Mobile: sidebar como drawer overlay */
@media (max-width: 767px) {
    #app-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        z-index: 9999;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    }
    #app-sidebar.mobile-open {
        left: 0;
    }
    #app-sidebar.collapsed {
        width: 240px;
        min-width: 240px;
    }
    /* En mobile, mostrar hamburger dentro del header */
    .hamburger-btn {
        display: flex !important;
    }
    /* Mobile overlay */
    .mobile-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 9998;
        display: none;
    }
    .mobile-sidebar-overlay.active {
        display: block;
    }
}

/* Clase para bloquear el scroll SOLO en el login */
body.mode-login {
    height: 100vh;
    overflow: hidden;
    padding-bottom: 0;
}

/* =========================================
   2. HEADER & NAV (DISEÃ‘O GRID 4 COLUMNAS FIX)
   ========================================= */
header {
    background: linear-gradient(#003366, #001E3C);
    background-size: cover;
    color: #ffffff;
    /* Altura fija: el header NUNCA crece verticalmente sin importar el largo del nombre del proyecto */
    height: 80px;
    min-height: 80px;
    max-height: 80px;
    padding: 0 2%;
    display: grid;
    /* LogoL (80px) | TÃ­tulo (flex) | Botones (mÃ­n 340px garantizados) | LogoR (80px) */
    /* minmax(340px,auto) asegura que los 5 botones del header SIEMPRE sean visibles */
    grid-template-columns: 80px minmax(0, 1fr) minmax(340px, auto) 80px;
    align-items: center;
    gap: 15px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--brand-2);
    flex-shrink: 0;
    /* overflow: clip solo recorta verticalmente sin afectar hijos con overflow propio */
    overflow: hidden;
}

/* =========================================
   HEADER â€” TÃTULO DEL PROYECTO (fluid typography)
   Garantiza consistencia visual en TODOS los dispositivos:
   desktop (1920px), laptop HP (1366px), tablet, mobile.
   clamp(min, preferred, max) escala suavemente sin saltos.
   ========================================= */
#p-title {
    font-size: clamp(0.9rem, 1.4vw, 1.4rem);
    font-weight: 700;
    line-height: 1.25;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin: 0;
    letter-spacing: -0.01em;
}

#p-sub {
    font-size: clamp(0.65rem, 0.85vw, 0.8rem);
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    letter-spacing: 0.01em;
}

.logo-container {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    margin: 0 auto;
}

.logo-container:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.2);
}

.logo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.user-profile-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    font-size: 0.8rem;
    margin-right: 10px;
    overflow: hidden;       /* contenido nunca desborda el grid del header */
    min-width: 0;
    max-width: 100%;
}

/* =========================================
   HEADER â€” BOTONES DE ACCIÃ“N (anti-wrap)
   CRÃTICO: los botones NUNCA hacen wrap a una
   segunda fila. Con overflow:hidden en el header,
   cualquier fila extra quedarÃ­a oculta y cortarÃ­a
   botones crÃ­ticos como "Cerrar SesiÃ³n".
   Todos los botones se mantienen en UNA SOLA FILA.
   Si el espacio es muy justo, se activa scroll
   horizontal para acceder a todos.
   ========================================= */
.user-profile-box > div:not(.user-name-display) {
    flex-wrap: nowrap !important;    /* Anula el inline style flex-wrap:wrap */
    overflow-x: auto;                /* Scroll horizontal si hay muchos botones */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;           /* Oculta scrollbar visual (sigue siendo funcional) */
    max-width: 100%;
    align-items: center;
}
.user-profile-box > div:not(.user-name-display)::-webkit-scrollbar {
    display: none;                   /* Chrome/Safari: oculta scrollbar visual */
}

.user-name-display {
    font-weight: bold;
    color: white;
    margin-bottom: 4px;
}

.btn-logout {
    background: var(--brand-2);
    border: none;
    color: #fff;
    font-weight: bold;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.2s;
    box-shadow: 0 2px 4px rgba(0, 173, 239, 0.3);
}

.btn-logout:hover {
    background: #0090c0;
    color: white;
    transform: translateY(-1px);
}

.btn-session-logout {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.2s;
}

.btn-session-logout:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
}

/* BotÃ³n Guardar */
.btn-save {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.btn-save:hover {
    background: rgba(34, 197, 94, 0.35);
    border-color: rgba(34, 197, 94, 0.6);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Indicador de estado de guardado */
.save-indicator {
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 600;
    color: #86efac;
    opacity: 0;
    transition: opacity 0.4s ease;
    white-space: nowrap;
    pointer-events: none;
}
.save-indicator.visible {
    opacity: 1;
}

/* SIDEBAR (FLOATING) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

.nav-bar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: rgba(0, 51, 102, 0.95);
    /* Dark Navy sidebar */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(0, 173, 239, 0.2);
    /* Cyan hint */
    z-index: 9999;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    overflow-y: auto;
}

.nav-bar.open {
    left: 0;
}

.sidebar-header {
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--brand-2);
    /* Yellow title in dark sidebar */
}

.btn-close-sidebar {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #64748b;
}

.nav-tab {
    padding: 15px 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: #cbd5e1;
    /* Light gray text */
    background: transparent;
    border: none;
    border-radius: 0;
    text-align: left;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    user-select: none;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--brand-2);
    padding-left: 30px;
}

.nav-tab.active {
    background: rgba(0, 173, 239, 0.15);
    color: var(--brand-2);
    border-left: 4px solid var(--brand-2);
}

.hamburger-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-tab[draggable="true"] {
    cursor: grab;
}

.nav-tab[draggable="true"]:active {
    cursor: grabbing;
}

.nav-tab.dragging {
    opacity: 0.5;
    background: var(--brand-2);
    color: white;
    transform: scale(0.95);
}

.nav-tab.drag-over {
    border-top: 2px solid var(--brand-2);
    /* Changed to top border for vertical list */
}

.health-bar {
    background: var(--white);
    padding: 8px 5%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--ok);
}

/* =========================================
   3. VISTAS Y COMPONENTES (RECUPERADOS)
   ========================================= */
.view-section {
    display: none;
    padding-bottom: 40px;
    animation: fadeIn 0.3s ease-in-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



.text-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 0 2%;
    margin-bottom: 20px;
}

.text-box {
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--brand-2);
}

.text-box h3 {
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: var(--brand-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.text-area-pro {
    width: 100%;
    border: none;
    resize: vertical;
    font-size: 0.9rem;
    color: var(--text-main);
    min-height: 70px;
    outline: none;
    background: transparent;
}

.editing-active .text-area-pro {
    background: #fffde7;
    border-bottom: 1px dashed #cbd5e1;
}

section {
    padding: 10px 2%;
    margin-bottom: 10px;
}

.sec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-left: 4px solid var(--brand);
    padding-left: 10px;
}

.sec-header h2 {
    font-size: 1.1rem;
    color: #334155;
}

/* ESTILOS DE TABLA (CRÃTICOS) */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    table-layout: fixed;
}

th {
    background: var(--light-blue); /* Updated as per instructions */
    padding: 10px 12px;
    text-align: left;
    font-size: var(--fs-xs); /* Updated */
    border-bottom: 2px solid var(--border-color-strong); /* Updated */
    text-transform: uppercase;
    color: var(--brand); /* Updated */
    font-weight: 700;
    letter-spacing: 0.05em;
}

td {
    padding: 8px 12px;
    border-bottom: var(--border-width) solid var(--border-color); /* Updated */
    font-size: var(--fs-base); /* Updated */
    vertical-align: middle;
    word-wrap: break-word;
}

/* Hover en filas */
table tbody tr:hover {
    background: #f8fafc;
}

/* HOJAS DE DOCUMENTOS (CHARTER, ETC) */
.charter-sheet {
    background: white;
    padding: 30px;
    margin: 0 2% 20px 2%; /* Added bottom margin for separation */
    box-shadow: var(--shadow-md); /* Replaced var(--shadow) with var(--shadow-md) */
    border: var(--border-width-section) solid var(--border-color); /* Replaced 1px solid #ccc */
    border-radius: var(--border-radius-lg); /* Added rounded corners */
    width: 96%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden; /* Recommended in prompt for containers */
}

.charter-doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--brand);
    padding-bottom: 15px;
}

.client-logo-box {
    width: 150px;
    height: 80px;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: 0.2s;
    overflow: hidden;
}

.client-logo-box:hover {
    background: #f1f5f9;
    border-color: var(--brand);
}

.client-logo-placeholder {
    font-size: 0.7rem;
    color: #94a3b8;
    text-align: center;
    font-weight: bold;
}

.charter-title {
    font-size: 1.8rem;
    color: var(--brand);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    flex: 1;
}

.charter-block {
    margin-bottom: 20px;
    border: var(--border-width-section) solid var(--border-color); /* Replaced 2px solid #94a3b8 */
    border-radius: var(--border-radius-md); /* Added rounded corners */
    overflow: hidden; /* Keep content inside bounds */
}

.charter-header {
    background-color: var(--header-gray);
    padding: 8px;
    font-weight: 800;
    color: #1e293b;
    font-size: var(--fs-xs); /* Replaced 0.75rem */
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color-strong); /* Replaced 2px solid #94a3b8 */
    text-align: center;
    letter-spacing: 0.5px;
}

.charter-row {
    display: flex;
    border-bottom: 2px solid #cbd5e1;
    flex-wrap: wrap;
}

.charter-row:last-child {
    border-bottom: none;
}

.charter-field {
    flex: 1;
    border-right: 2px solid #cbd5e1;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.charter-field:last-child {
    border-right: none;
}

.c-label {
    background: #f1f5f9;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    border-bottom: 2px solid #cbd5e1;
}

.c-input {
    flex: 1;
    padding: 8px;
    border: none;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    background: transparent;
    min-height: 35px;
}

.c-input-area {
    flex: 1;
    padding: 8px;
    border: none;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    background: transparent;
    min-height: 80px;
    resize: vertical;
}

.editing-active .c-input,
.editing-active .c-input-area {
    background-color: #fffde7;
}

.financial-bg .c-label {
    background: #dcfce7;
    color: #166534;
}

.signatures-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.sig-box {
    border-right: 1px solid #94a3b8;
    border-bottom: 1px solid #94a3b8;
    padding: 20px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.sig-box:nth-child(2n) {
    border-right: none;
}

.sig-line {
    border-top: 1px solid #333;
    margin-top: 40px;
    padding-top: 5px;
    font-size: 0.8rem;
    font-weight: bold;
    text-align: center;
}

/* KPIs & Risk */
.risk-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    overflow-x: auto;
}

/* â”€â”€ Tabla de Riesgos â€” distribuciÃ³n profesional â”€â”€ */
#t-risk {
    table-layout: auto;
    width: 100%;
}

/* Headers centrados y compactos */
#t-risk th {
    text-align: center;
    vertical-align: middle;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 10px 6px;
    white-space: normal;
    word-wrap: break-word;
}

/* Celdas centradas verticalmente */
#t-risk td {
    vertical-align: middle;
    padding: 8px 6px;
}

/* Selects centrados y de ancho completo */
#t-risk td select,
#t-risk td .risk-select {
    width: 100%;
    text-align: center;
    text-align-last: center;
    box-sizing: border-box;
}

/* Celdas editables (Riesgo, Plan, Responsable) â€” wrap vertical, alineadas arriba */
#t-risk td[contenteditable="true"],
#t-risk td[contenteditable=""] {
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    min-height: 40px;
}

/* Badge de Nivel de Riesgo centrado */
#t-risk td:nth-child(5) {
    text-align: center;
    vertical-align: middle;
}

/* Columna Eliminar centrada */
#t-risk td:last-child {
    text-align: center;
    vertical-align: middle;
}

/* Badge styling */
#t-risk .risk-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 28px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
}


.heatmap-box {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2px;
    height: 180px;
    margin-top: 10px;
    background: #e2e8f0;
}

.hm-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.5);
    position: relative;
}

.hm-cell.active-risk::after {
    content: attr(data-count);
    position: absolute;
    font-size: 1rem;
    color: #1e293b;
    font-weight: 800;
}

.hm-green {
    background-color: var(--risk-low);
}

.hm-yellow {
    background-color: var(--risk-med);
}

.hm-red {
    background-color: var(--risk-high);
}

/* UTILS & STYLES FOR DYNAMIC FORMS */
.cc-dynamic-table {
    width: 100%;
    font-size: 0.8rem;
    margin-top: 0;
}

.cc-dynamic-table th {
    background: var(--light-blue);
    text-align: center;
    border: var(--border-width) solid var(--border-color-strong);
    padding: 8px;
}

.cc-dynamic-table td {
    border: var(--border-width) solid var(--border-color);
    padding: 0;
}

.cc-input-cell {
    width: 100%;
    border: none;
    padding: 8px;
    background: transparent;
    outline: none;
    text-align: center;
    font-family: inherit;
}

.cc-select-cell {
    width: 100%;
    border: none;
    padding: 8px;
    background: transparent;
    outline: none;
    font-family: inherit;
}

.cc-btn-add {
    background: var(--brand);
    color: white;
    border: none;
    padding: 6px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    float: right;
    margin: 2px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.cc-btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    filter: brightness(1.08);
}

.cc-btn-remove {
    color: var(--nok);
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    border: none;
    background: transparent;
}

/* Row action buttons â€” workplan */
.wp-row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.wp-row-actions button {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 0.7rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s ease;
    color: #64748b;
}

.wp-row-actions button:hover {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    transform: scale(1.1);
}

.wp-row-actions .wp-btn-delete {
    color: var(--nok);
}

.wp-row-actions .wp-btn-delete:hover {
    background: var(--nok);
    border-color: var(--nok);
    color: #fff;
}

.wp-row-actions .wp-btn-insert:hover {
    background: var(--ok);
    border-color: var(--ok);
}

/* â”€â”€ Select de tipo estilizado (badge) â”€â”€ */
.wp-type-select {
    width: 100%;
    border: none;
    padding: 6px 8px;
    outline: none;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 8px 5px;
    padding-right: 18px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.wp-type-select:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}
.wp-type-select:focus {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* â”€â”€ Row entregable (violeta) â”€â”€ */
.row-entregable {
    background-color: #faf5ff;
    font-weight: 700;
}
.row-entregable input {
    font-weight: 700;
    color: #6d28d9;
}

/* â”€â”€ BotÃ³n â–¾ (split-button acoplado al âž•) â”€â”€ */
.wp-btn-insert-menu {
    font-size: 0.55rem !important;
    padding: 0 4px !important;
    min-width: 14px !important;
    width: 14px !important;
    margin-left: -4px !important;
    border-radius: 0 4px 4px 0 !important;
    border-left: 1px solid rgba(0,0,0,0.08) !important;
    background: #eef7ee !important;
    color: #22c55e !important;
}
.wp-row-actions .wp-btn-insert {
    border-radius: 4px 0 0 4px !important;
}
.wp-btn-insert-menu:hover {
    background: var(--ok) !important;
    border-color: var(--ok) !important;
    color: #fff !important;
}

/* â”€â”€ MenÃº contextual de inserciÃ³n (dropdown premium) â”€â”€ */
.wp-insert-menu {
    position: fixed;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    min-width: 220px;
    padding: 6px;
    animation: wpMenuFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wpMenuFadeIn {
    from { opacity: 0; transform: translateY(6px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header del menÃº */
.wp-insert-menu-header {
    padding: 6px 10px 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 4px;
}

/* Items del menÃº */
.wp-insert-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}
.wp-insert-menu-item:hover {
    background: #f0f7ff;
}

/* Icono emoji */
.wp-insert-menu-icon {
    font-size: 1rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f8fafc;
    flex-shrink: 0;
}
.wp-insert-menu-item:hover .wp-insert-menu-icon {
    background: #e0ecff;
}

/* Texto (label + descripciÃ³n) */
.wp-insert-menu-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}
.wp-insert-menu-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
}
.wp-insert-menu-desc {
    font-size: 0.65rem;
    color: #94a3b8;
    line-height: 1.2;
}
.wp-insert-menu-item:hover .wp-insert-menu-label {
    color: var(--brand);
}

/* Dot indicador de tipo */
.wp-insert-menu-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* =========================================
   DYNAMIC TABLES â€” SCOPED REDESIGN
   Solo aplica a tablas dentro de #change-form-view
   y #minutes-form-view
   ========================================= */
#change-form-view .charter-block>.cc-dynamic-table,
#minutes-form-view .charter-block>.cc-dynamic-table {
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-top: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* A) Headers â€” Navy con texto blanco */
#change-form-view .cc-dynamic-table th,
#minutes-form-view .cc-dynamic-table th {
    background: var(--brand);
    color: #ffffff;
    padding: 12px 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.72rem;
    font-weight: 700;
    border: none;
    border-bottom: 2px solid rgba(0, 173, 239, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

#change-form-view .cc-dynamic-table th:last-child,
#minutes-form-view .cc-dynamic-table th:last-child {
    border-right: none;
}

/* Columna "Total" resaltada (4ta columna en AnÃ¡lisis de Costo) */
#change-form-view .cc-dynamic-table thead tr th:nth-child(4) {
    background: var(--brand-2);
    border-left: 2px solid rgba(255, 255, 255, 0.3);
    border-right: 2px solid rgba(255, 255, 255, 0.3);
}

/* B) Celdas â€” Bordes sutiles y hover moderno */
#change-form-view .cc-dynamic-table td,
#minutes-form-view .cc-dynamic-table td {
    border: none;
    border-bottom: 1px solid #cbd5e1;
    border-right: 1px solid #cbd5e1;
    padding: 0;
    vertical-align: middle;
}

#change-form-view .cc-dynamic-table td:last-child,
#minutes-form-view .cc-dynamic-table td:last-child {
    border-right: none;
}

#change-form-view .cc-dynamic-table tbody tr:hover,
#minutes-form-view .cc-dynamic-table tbody tr:hover {
    background: #f8fafc;
}

#change-form-view .cc-dynamic-table tbody tr:last-child td,
#minutes-form-view .cc-dynamic-table tbody tr:last-child td {
    border-bottom: none;
}

/* C) Inputs y Selects â€” MÃ¡s padding y focus visual */
#change-form-view .cc-input-cell,
#minutes-form-view .cc-input-cell {
    padding: 10px 8px;
    font-weight: 600;
    color: #0f172a;
    transition: background 0.2s;
}

#change-form-view .cc-select-cell,
#minutes-form-view .cc-select-cell {
    padding: 10px 8px;
    cursor: pointer;
    font-weight: 600;
    color: #0f172a;
    transition: background 0.2s;
}

#change-form-view .cc-input-cell:focus,
#change-form-view .cc-select-cell:focus,
#minutes-form-view .cc-input-cell:focus,
#minutes-form-view .cc-select-cell:focus {
    background: #fffde7;
}

/* D) Tfoot â€” Costo Total ejecutivo */
#change-form-view .cc-dynamic-table tfoot td {
    border-top: 2px solid var(--border-color);
    border-bottom: none;
}

#change-form-view .cc-dynamic-table tfoot td[colspan] {
    text-align: right;
    font-weight: 800;
    padding: 14px 12px;
    color: var(--brand);
    background: #f8fafc;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

#change-form-view .cc-dynamic-table tfoot #cc-grand-total {
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 800;
    font-size: 1.1rem;
    text-align: center;
    border-top: 2px solid var(--brand-2);
    padding: 14px 12px;
}

/* E) BotÃ³n eliminar â€” Circle button */
#change-form-view .cc-btn-remove,
#minutes-form-view .cc-btn-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    color: #ef4444;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.2s;
    margin: 0 auto;
}

#change-form-view .cc-btn-remove:hover,
#minutes-form-view .cc-btn-remove:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

/* F) Charter-header con botÃ³n â€” Flexbox para contener el botÃ³n dentro */
#change-form-view .charter-header,
#minutes-form-view .charter-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#change-form-view .charter-header .btn-action,
#minutes-form-view .charter-header .btn-action {
    position: absolute;
    right: 8px;
    float: none;
}

/* G) Date inputs â€” Ancho mÃ­nimo para que las fechas no se corten */
#change-form-view .cc-dynamic-table input[type="date"],
#minutes-form-view .cc-dynamic-table input[type="date"] {
    min-width: 130px;
}

/* AlineaciÃ³n F. Compromiso en Minutas */
#minutes-form-view .t-min-agree th:nth-child(6),
#minutes-form-view .t-min-agree td:nth-child(6),
#minutes-form-view .t-min-task th:nth-child(4),
#minutes-form-view .t-min-task td:nth-child(4) {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

#t-payments-pro {
    table-layout: auto;
}

#t-payments-pro td {
    vertical-align: top;
    word-break: break-word;
}

#t-payments-pro textarea {
    width: 100%;
    border: none;
    padding: 8px;
    background: transparent;
    outline: none;
    text-align: center;
    font-family: inherit;
    font-size: inherit;
    resize: vertical;
    min-height: 35px;
    overflow: hidden;
    word-wrap: break-word;
    box-sizing: border-box;
}

.btn-action {
    padding: 8px 15px;
    border-radius: 6px;
    border: none;
    font-weight: 800;
    /* Bolder */
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #000 !important;
    /* Force black text */
    background: var(--brand-2) !important;
    /* Force Brainko Yellow */
}

.btn-action:hover {
    background: #0090c0 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
}

.btn-del {
    color: var(--nok);
    cursor: pointer;
    font-size: 1.1rem;
}

.pg-container {
    background: #e2e8f0;
    border-radius: 10px;
    height: 6px;
    margin-top: 6px;
    overflow: hidden;
}

.pg-bar {
    background: var(--brand-2);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
}

/* LECCIONES APRENDIDAS */
.lessons-header-row th {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.th-meta {
    background: #64748b;
}

.th-good {
    background: #22c55e;
}

.th-bad {
    background: #ef4444;
}

.th-analysis {
    background: #8b5cf6;
}

.lesson-area {
    min-width: 150px;
    min-height: 80px;
    font-size: 0.8rem;
    padding: 8px;
    border: 1px solid transparent;
    background: transparent;
    width: 100%;
    font-family: inherit;
    overflow: hidden;
    line-height: 1.4;
    box-sizing: border-box;
}

/* STEERING COMMITTEE (DISPLAY STYLES - REJILLA 4 COLUMNAS) */
.st-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2%;
    display: grid;
    gap: 20px;
}

.st-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: var(--border-width-section) solid var(--border-color);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.st-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.st-card h3 {
    font-size: 0.85rem;
    margin-bottom: 15px;
    color: var(--brand);
    text-transform: uppercase;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color); /* Updated */
    padding-bottom: 5px;
    letter-spacing: 0.5px;
}

.st-header {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: white;
    border-radius: var(--border-radius-md);
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
}

.st-proj-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.st-proj-meta {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 5px;
}

.st-edit-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.st-kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.st-kpi-card {
    text-align: center;
    border: var(--border-width) solid var(--border-color); /* Updated */
    border-radius: var(--border-radius-md); /* Updated */
    background: var(--white); /* Updated */
    box-shadow: var(--shadow-sm); /* Updated */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 130px;
    padding-bottom: 12px;
    transition: box-shadow 0.2s ease, transform 0.2s ease; /* Updated */
}

.st-kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.st-kpi-card > :last-child {
    margin-top: auto;
}

.st-kpi-val {
    font-size: var(--fs-kpi); /* Updated */
    font-weight: 800;
    color: var(--brand);
    margin: 5px 0;
}

.st-kpi-sub {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
}

.st-badge {
    padding: 5px 15px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.8rem;
    display: inline-block;
    color: white;
    width: 110px;
    text-align: center;
}

.bg-green {
    background: var(--ok);
}

.bg-yellow {
    background: var(--warning);
}

.bg-red {
    background: var(--nok);
}

.st-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.st-grid-risk {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.st-text-content {
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.6;
    max-height: 150px;
    overflow-y: auto;
}

/* Rich text lists inside Steering text containers (Charter Quill content) */
.st-text-content ul,
.st-text-content ol {
    padding-left: 20px;
    margin: 4px 0;
}

.st-text-content ul {
    list-style: disc;
}

.st-text-content ol {
    list-style: decimal;
}

.st-text-content li {
    padding: 2px 0;
    display: list-item;
}

.st-text-content p {
    margin: 4px 0;
}

.st-list {
    list-style: none;
    padding: 0;
}

.st-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    display: flex;
    gap: 10px;
}

.st-icon {
    font-weight: bold;
}

.st-icon-check {
    color: var(--ok);
}

.st-icon-alert {
    color: var(--warning);
}

.st-heatmap-container {
    display: flex;
    justify-content: center;
}

.st-mini-heatmap {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2px;
    width: 150px;
    height: 150px;
}

.st-hm-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}

.st-hm-cell.active {
    color: #1e293b;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.st-fin-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    align-items: center;
}

.st-fin-box {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

/* KANBAN */
.kb-container {
    padding: 20px 2%;
    overflow-x: auto;
    min-height: 70vh;
}

.kb-board {
    display: flex;
    gap: 15px;
    min-width: 1200px;
    height: 100%;
    align-items: flex-start;
}

.kb-col {
    background: var(--kb-col-bg);
    border-radius: var(--border-radius-md); /* Updated */
    border: var(--border-width) solid var(--border-color); /* Updated */
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.kb-col-header {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    color: #475569;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.kb-col-count {
    background: #e2e8f0;
    color: #64748b;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.kb-col-body {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 100px;
}

.kb-card {
    background: var(--kb-card-bg);
    border-radius: var(--border-radius-sm); /* Updated */
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm); /* Updated */
    border: var(--border-width) solid var(--border-color); /* Updated */
    cursor: grab;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid transparent;
}

.kb-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.kb-card:active {
    cursor: grabbing;
}

.kb-card-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e293b;
    margin-bottom: 5px;
    line-height: 1.3;
}

.kb-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 0.7rem;
    color: #64748b;
}

.kb-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.prio-high {
    border-left-color: var(--prio-high) !important;
}

.prio-med {
    border-left-color: var(--prio-med) !important;
}

.prio-low {
    border-left-color: var(--prio-low) !important;
}

.kb-tag-high {
    background: #fee2e2;
    color: #991b1b;
}

.kb-tag-med {
    background: #fef9c3;
    color: #854d0e;
}

.kb-tag-low {
    background: #dcfce7;
    color: #166534;
}

.kb-col-blocked {
    background: #fef2f2;
    border-color: #fee2e2;
}

.kb-col-blocked .kb-col-header {
    background: #fee2e2;
    color: #991b1b;
}

.kb-date.overdue {
    color: var(--nok);
    font-weight: 800;
}

.kb-date.fulfilled {
    color: var(--ok);
    font-weight: 800;
}

.kb-col-header {
    position: relative;
}

.kb-col-header-label {
    cursor: pointer;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kb-col-header-label:hover {
    color: var(--brand);
}

.kb-col-header input.kb-col-rename {
    border: 1px solid var(--brand-2);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    flex: 1;
    min-width: 0;
    outline: none;
}

.kb-col-delete {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: 0.2s;
    margin-left: 4px;
}

.kb-col-delete:hover {
    color: var(--nok);
    transform: scale(1.2);
}

.kb-add-col {
    min-width: 260px;
    min-height: 100px;
    border: 2px dashed var(--border-color-strong); /* Updated */
    border-radius: var(--border-radius-md); /* Updated */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.9rem;
    transition: 0.2s;
    flex-shrink: 0;
}

.kb-add-col:hover {
    border-color: var(--brand-2);
    color: var(--brand);
    background: rgba(0, 173, 239, 0.05);
}

.kb-col-drag-over {
    border: 2px dashed var(--brand-2) !important;
    background: rgba(0, 173, 239, 0.05) !important;
}

.kb-col[draggable="true"] {
    cursor: grab;
}

.kb-col[draggable="true"]:active {
    cursor: grabbing;
}

/* WORKPLAN */
.wp-dashboard {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.wp-metric-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.wp-donut {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: conic-gradient(var(--brand) 0%, #e2e8f0 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--brand);
    position: relative;
}

.wp-donut::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    background: white;
    border-radius: 50%;
}

.wp-donut span {
    position: relative;
    z-index: 1;
}

.wp-stat-num {
    font-size: 1.4rem;
    font-weight: 800;
    color: #334155;
}

.wp-stat-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
}

.wp-toolbar {
    padding: 10px 15px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
}

.btn-toolbar {
    background: white;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.2s;
    white-space: nowrap;
}

.btn-toolbar:hover {
    background: #f1f5f9;
    border-color: var(--brand);
    color: var(--brand);
}

.btn-primary-tool {
    background: var(--brand-2);
    color: #000;
    border-color: var(--brand-2);
    font-weight: 800;
}

.btn-primary-tool:hover {
    background: #0090c0;
    color: white;
    border-color: #0090c0;
}

.wp-table {
    width: 100%;
    border-collapse: collapse;
}

.wp-table th {
    background: #f1f5f9;
    color: #64748b;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 10px;
    border-bottom: 2px solid var(--border-color);
    border-right: 1px solid #e2e8f0;
    text-align: left;
}

.wp-table th:last-child {
    border-right: none;
}

.wp-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid #f1f5f9;
    font-size: 0.85rem;
    vertical-align: middle;
}

.wp-table td:last-child {
    border-right: none;
}

/* â”€â”€ Column Resize Handles â€” Drag-to-Resize â”€â”€ */
.wp-table th {
    position: relative;
    overflow: visible;
    user-select: none;
}

.col-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 15;
    background: transparent;
    transition: background 0.15s ease;
}

.col-resize-handle:hover {
    background: var(--brand-2);
    opacity: 0.7;
}

.col-resize-handle.col-resize-dragging {
    background: var(--brand);
    opacity: 0.9;
    width: 3px;
    right: -1px;
}

/* Global cursor override during column drag */
body.col-resize-active {
    cursor: col-resize !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

body.col-resize-active * {
    cursor: col-resize !important;
}

/* Text overflow for resizable columns â€” clean truncation */
.wp-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

.wp-table td .cc-input-cell,
.wp-table td .wp-type-select {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================
   GANTT EJECUTIVO â€” Cronograma Visual
   ========================================= */
.gantt-exec-container {
    background: var(--white);
    margin: 0;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

/* Gantt inside Steering Committee â€” match st-card look */
#gantt-steering-chart {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-bottom: 0;
}

.gantt-exec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.gantt-exec-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--brand);
    display: flex;
    align-items: center;
    gap: 8px;
}

.gantt-exec-title-icon {
    font-size: 1.1rem;
}

.gantt-exec-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.7rem;
    color: #64748b;
}

.gantt-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.gantt-legend-swatch {
    width: 14px;
    height: 8px;
    border-radius: 3px;
}

.gantt-legend-swatch.fase {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.gantt-legend-swatch.avance {
    background: var(--ok);
    opacity: 0.55;
}

.gantt-legend-diamond {
    width: 8px;
    height: 8px;
    background: var(--brand);
    transform: rotate(45deg);
    border-radius: 1px;
}

.gantt-legend-today-line {
    width: 14px;
    height: 0;
    border-top: 2px dashed var(--nok);
}

/* Timeline area */
.gantt-exec-timeline {
    position: relative;
    background: #fafbfc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 18px 16px 8px;
    min-height: 60px;
    overflow: visible;
}

/* Date range labels */
.gantt-date-range {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Vertical grid lines for months */
.gantt-grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #e2e8f0;
    z-index: 1;
}

/* Fase bars */
.gantt-bar-row {
    position: relative;
    height: 38px;
    margin-bottom: 8px;
    z-index: 2;
}

.gantt-bar {
    position: absolute;
    height: 34px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 2px 6px rgba(0, 51, 102, 0.2);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: visible;
    display: flex;
    align-items: center;
    min-width: 4px;
}

.gantt-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.35);
    z-index: 10;
}

.gantt-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--ok);
    opacity: 0.45;
    border-radius: 6px 0 0 6px;
    transition: width 0.4s ease;
}

.gantt-bar-label {
    position: relative;
    z-index: 2;
    padding: 0 12px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    width: 100%;
}

.gantt-bar-pct {
    font-weight: 800;
    font-size: 0.68rem;
    margin-left: 5px;
    opacity: 0.9;
}

/* Milestone diamonds */
.gantt-milestone-row {
    position: relative;
    height: 40px;
    margin-bottom: 2px;
    z-index: 2;
}

.gantt-milestone-wrap {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    cursor: pointer;
    z-index: 3;
}

.gantt-milestone-wrap:hover .gantt-milestone-diamond {
    background: var(--brand-2);
    box-shadow: 0 3px 8px rgba(0,173,239,0.4);
    transform: rotate(45deg) scale(1.2);
}

.gantt-milestone-diamond {
    width: 14px;
    height: 14px;
    background: var(--brand);
    transform: rotate(45deg);
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,51,102,0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

.gantt-milestone-name {
    margin-top: 4px;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--brand);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    pointer-events: none;
}

.gantt-milestone-wrap:hover .gantt-milestone-tip {
    display: block;
}

.gantt-milestone-tip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    margin-bottom: 6px;
    z-index: 20;
    pointer-events: none;
}

.gantt-milestone-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #1e293b;
}

/* TODAY line â€” RED dashed */
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 2.5px dashed var(--nok);
    z-index: 5;
    pointer-events: none;
}

.gantt-today-badge {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--nok);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 0 0 6px 6px;
    white-space: nowrap;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 6px rgba(239,68,68,0.35);
    animation: ganttTodayPulse 2.5s ease-in-out infinite;
}

@keyframes ganttTodayPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Month axis */
.gantt-month-axis {
    display: flex;
    position: relative;
    height: 22px;
    margin-top: 6px;
    border-top: 1px solid var(--border-color);
    padding-top: 4px;
}

.gantt-month-label {
    position: absolute;
    font-size: 0.62rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transform: translateX(-50%);
}

/* Tooltip */
.gantt-tooltip {
    display: none;
    position: absolute;
    background: #1e293b;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    line-height: 1.5;
    z-index: 20;
    pointer-events: none;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
    white-space: nowrap;
    top: -55px;
    left: 50%;
    transform: translateX(-50%);
}

.gantt-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1e293b;
}

.gantt-bar:hover .gantt-tooltip {
    display: block;
}

/* Empty state */
.gantt-exec-empty {
    text-align: center;
    padding: 30px 20px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-style: italic;
}

/* Print optimization */
@media print {
    .gantt-exec-container {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .gantt-today-badge {
        animation: none;
    }
}

.indent-0 {
    padding-left: 5px !important;
}

.indent-1 {
    padding-left: 30px !important;
    border-left: 3px solid var(--brand-2);
}

.indent-2 {
    padding-left: 55px !important;
    border-left: 3px solid #cbd5e1;
}

.indent-3 {
    padding-left: 80px !important;
    border-left: 3px solid #cbd5e1;
}

.row-macro {
    background-color: #f8fafc;
    font-weight: 700;
}

.row-macro input {
    font-weight: 700;
    color: #1e293b;
}

.row-milestone {
    background-color: #fff7ed;
    font-weight: 700;
}

.row-milestone input {
    font-weight: 700;
    color: #92400e;
}

.row-subtask {
    color: #64748b;
}

.row-subtask input {
    color: #64748b;
    font-size: 0.8rem;
}

/* â”€â”€ Collapse/Expand toggle chevrons â”€â”€ */
.wp-wbs-cell {
    display: flex;
    align-items: center;
    gap: 2px;
}

.wp-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0.6rem;
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 0.15s ease;
    user-select: none;
}

.wp-toggle-fase {
    background: var(--brand);
    color: #fff;
    font-size: 0.55rem;
}
.wp-toggle-fase:hover {
    background: var(--brand-2);
    transform: scale(1.15);
}

.wp-toggle-task {
    background: #e2e8f0;
    color: #475569;
    font-size: 0.5rem;
}
.wp-toggle-task:hover {
    background: #cbd5e1;
    transform: scale(1.15);
}

/* Hidden rows with smooth transition */
.wp-row-hidden {
    display: none;
}

/* â”€â”€ Scrollbar siempre visible â€” dual-axis scroll â”€â”€ */
.wp-table-scroll {
    overflow-x: scroll !important;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
    min-height: 350px;
    scrollbar-color: #94a3b8 #f1f5f9;
    scrollbar-width: thin;
    position: relative;
}
.wp-table-scroll::-webkit-scrollbar {
    height: 10px;
    width: 8px;
}
.wp-table-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}
.wp-table-scroll::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 6px;
    border: 2px solid #f1f5f9;
}
.wp-table-scroll::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Sticky header inside scrollable workplan */
.wp-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f1f5f9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* â”€â”€ Toolbar collapse/expand buttons â”€â”€ */
.btn-toolbar-collapse {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
    font-size: 0.72rem !important;
}
.btn-toolbar-collapse:hover {
    background: #e2e8f0 !important;
    color: #1e293b !important;
}

/* â”€â”€ BotÃ³n ðŸ“Œ Enviar a Kanban â”€â”€ */
.wp-btn-kanban {
    font-size: 0.7rem !important;
    padding: 2px 4px !important;
    min-width: 22px !important;
    border: 1px solid #c4b5fd !important;
    background: #ede9fe !important;
    color: #7c3aed !important;
    border-radius: 4px !important;
    cursor: pointer;
    transition: all 0.15s ease;
}
.wp-btn-kanban:hover {
    background: #7c3aed !important;
    border-color: #7c3aed !important;
    color: #fff !important;
    transform: scale(1.1);
}

/* Estado "ya enviada" */
.wp-btn-kanban-sent {
    background: #dcfce7 !important;
    border-color: #86efac !important;
    color: #16a34a !important;
    font-weight: 700;
}
.wp-btn-kanban-sent:hover {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #fff !important;
}

/* â”€â”€ Toast de confirmaciÃ³n â”€â”€ */
.wp-toast {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    transition: bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wp-toast-show {
    bottom: 30px;
}

.rag-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    width: fit-content;
}

.rag-green {
    background: #dcfce7;
    color: #166534;
}

.rag-amber {
    background: #fef9c3;
    color: #854d0e;
}

.rag-red {
    background: #fee2e2;
    color: #991b1b;
}

.rag-grey {
    background: #f1f5f9;
    color: #64748b;
}

.rag-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.rag-green .rag-icon {
    background: #166534;
}

.rag-amber .rag-icon {
    background: #854d0e;
}

.rag-red .rag-icon {
    background: #991b1b;
}

.rag-grey .rag-icon {
    background: #94a3b8;
}

input[type="date"],
select,
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="time"],
input[type="datetime-local"] {
    border: 1px solid transparent;
    background: transparent;
    width: 100%;
    border-radius: 4px;
    padding: 4px;
    font-family: inherit;
    font-size: inherit;
}

.editing-active input[type="date"],
.editing-active select,
.editing-active input[type="number"],
.editing-active input[type="time"],
.editing-active input[type="datetime-local"] {
    border: var(--border-width) solid var(--border-color-strong); /* Updated */
    background: #fff;
}

/* LEGAL - FILE CHIP */
.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0f2fe;
    color: #0284c7;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: bold;
    border: 1px solid #bae6fd;
    cursor: default;
}

.btn-attach {
    background: #f1f5f9;
    color: #64748b;
    border: 1px dashed #cbd5e1;
    padding: 4px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.2s;
}

.btn-attach:hover {
    background: #e2e8f0;
    border-color: var(--brand);
    color: var(--brand);
}

/* CLOSURE CHECKLIST STYLING */
.cl-check-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.cl-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #334155;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    transition: 0.2s;
    border: 1px solid transparent;
}

.cl-check-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.cl-check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
    cursor: pointer;
}

/* =========================================
   4. ESTILOS LOGIN & SELECTOR (OVERLAYS)
   ========================================= */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-split-left {
    width: 40%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.login-split-right {
    width: 60%;
    height: 100%;
    background: linear-gradient(#003366, #002244);
    background-size: cover;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 80px;
    color: white;
    box-shadow: inset 15px 0 25px rgba(0, 0, 0, 0.1);
}

#selector-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #003366;
    background: linear-gradient(135deg, #003366 0%, #003050 40%, #004070 100%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 10000;
    flex-direction: column;
    padding: 40px;
    overflow-y: auto;
    overflow-x: hidden;
}

.login-card {
    width: 100%;
    max-width: 420px;
    text-align: left;
}

.login-title {
    font-size: 2.2rem;
    color: var(--brand);
    margin-bottom: 5px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.login-sub {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 40px;
}

.login-input {
    width: 100%;
    padding: 14px 14px 14px 50px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: 0.2s;
    box-sizing: border-box;
    background: #f8fafc !important;
    color: #1e293b !important;
}

.login-input:focus {
    border-color: var(--brand-2) !important;
    box-shadow: 0 0 0 3px rgba(0, 173, 239, 0.1) !important;
    background: #ffffff !important;
}

.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus,
.login-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #f8fafc inset !important;
    -webkit-text-fill-color: #1e293b !important;
    transition: background-color 5000s ease-in-out 0s;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
    width: 100%;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #64748b;
    font-size: 1.2rem;
    user-select: none;
}

.toggle-password:hover {
    color: var(--brand-2);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--brand-2);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1.05rem;
    transition: 0.2s;
    box-shadow: 0 4px 10px rgba(0, 173, 239, 0.3);
    margin-top: 10px;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    background: #008fcc;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 173, 239, 0.4);
}

/* Testimonial / Inspirational Quote Side */
.login-quote {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 25px;
    max-width: 600px;
    letter-spacing: -1px;
}

.login-quote-sub {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 550px;
    line-height: 1.6;
    font-weight: 400;
}

.selector-container {
    width: 90%;
    max-width: 1500px;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
}

.selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    color: var(--brand);
    /* Text dark */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.selector-grid {
    display: flex;
    flex-direction: row;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 40px 10px 60px 10px; /* Increased top and bottom padding to avoid clipping on hover */
    scroll-behavior: smooth;
    flex: 1;
    align-items: stretch;
}

/* Scrollbar sutil */
.selector-grid::-webkit-scrollbar {
    height: 6px;
}
.selector-grid::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}
.selector-grid::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.project-card {
    background: var(--white);
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    /* Added a faint white border and a complex shadow: outer drop shadow + inner white glow */
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.9);
    min-width: 280px;
    max-width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    /* Sin max-height: permitir que se muestre toda la informaciÃ³n del proyecto */
}

/* EFECTO HOVER: La tarjeta CRECE Y BRILLA MÃS */
.project-card:hover {
    transform: scale(1.06);
    border-color: rgba(255,255,255, 0.9);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5), inset 0 2px 8px rgba(255, 255, 255, 1);
    z-index: 10;
}

.project-card.dragging-card {
    opacity: 0.5;
    transform: scale(0.95);
    border: 2px dashed var(--brand-2);
}

/* Scroll vertical en el body de la tarjeta cuando el contenido excede el espacio */
.pc-body {
    overflow-y: auto;
    min-height: 0; /* Necesario para que flex + overflow funcione */
}

.pc-body::-webkit-scrollbar {
    width: 4px;
}
.pc-body::-webkit-scrollbar-track {
    background: transparent;
}
.pc-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}
.pc-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

.pc-title {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--brand);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.pc-meta {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 15px;
}

.pc-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--brand);
    /* Navy badge background */
    color: white;
    /* White text */
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid #334155;
}

.pc-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-open {
    background: var(--brand-2);
    /* Brainko Yellow */
    color: #000;
    /* Black text for contrast */
    box-shadow: 0 2px 4px rgba(0, 173, 239, 0.2);
}

.btn-open:hover {
    background: #0090c0;
    color: white;
}

.btn-del-proj {
    background: #fee2e2;
    color: #991b1b;
}

#settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.08);
    z-index: 1001;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.settings-header {
    padding: 25px;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #0f172a;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-body {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.settings-section h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.st-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.st-input-group {
    margin-bottom: 15px;
}

.st-input-group label {
    display: block;
    font-size: 0.8rem;
    color: #334155;
    margin-bottom: 5px;
    font-weight: 500;
}

.st-input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: 0.2s;
    color: #1e293b;
}

.st-input-group input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.btn-st {
    padding: 10px 15px;
    font-size: 0.9rem;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-st-primary {
    background: var(--brand-2);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 4px 6px rgba(0, 173, 239, 0.2);
}

.btn-st-primary:hover {
    background: #0090c0;
    color: white;
    transform: translateY(-2px);
}

.btn-st-secondary {
    background: white;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.btn-st-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #1e293b;
}

.btn-st-danger-ghost {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.btn-st-danger-ghost:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
}

.color-picker-wrapper:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

#settings-panel.open {
    right: 0;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    z-index: 999;
}

#settings-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 75px;
    height: 75px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    filter: drop-shadow(0 4px 8px rgba(0, 51, 102, 0.4));
    transition: transform 0.3s, filter 0.3s;
    overflow: visible;
    touch-action: none;
    user-select: none;
}

#settings-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

#settings-btn:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 6px 12px rgba(0, 173, 239, 0.5));
}

/* â”€â”€ Superman Cape â”€â”€ */
.advisor-cape {
    position: absolute;
    width: 38px;
    height: 50px;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #dc2626 0%, #991b1b 70%, #7f1d1d 100%);
    clip-path: polygon(15% 0%, 85% 0%, 100% 100%, 0% 100%);
    border-radius: 0 0 8px 8px;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    transform-origin: top center;
    transition: opacity 0.3s ease;
}

/* â”€â”€ Flying State â”€â”€ */
#settings-btn.flying {
    cursor: grabbing;
    filter: drop-shadow(0 8px 24px rgba(0, 173, 239, 0.7))
            drop-shadow(0 0 16px rgba(77, 208, 225, 0.5));
    transition: filter 0.15s ease;
}

#settings-btn.flying:hover {
    transform: none;
}

#settings-btn.flying .advisor-cape {
    opacity: 1;
    animation: capeFlutter 0.4s ease-in-out infinite alternate;
}

@keyframes capeFlutter {
    0% {
        transform: translateX(-50%) skewX(-6deg) rotate(-3deg) scaleY(1);
    }
    25% {
        transform: translateX(-50%) skewX(4deg) rotate(2deg) scaleY(1.08);
    }
    50% {
        transform: translateX(-50%) skewX(-3deg) rotate(-1deg) scaleY(0.95);
    }
    75% {
        transform: translateX(-50%) skewX(5deg) rotate(3deg) scaleY(1.05);
    }
    100% {
        transform: translateX(-50%) skewX(-5deg) rotate(-2deg) scaleY(1.02);
    }
}

/* â”€â”€ Landing State (bounce on drop) â”€â”€ */
#settings-btn.landing {
    animation: advisorLand 0.5s ease-out;
}

#settings-btn.landing .advisor-cape {
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

@keyframes advisorLand {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.18) rotate(0deg); }
    50%  { transform: scale(0.92); }
    70%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* =========================================
   5. ESTILOS DE IMPRESIÃ“N (GRID CORREGIDO)
   ========================================= */
/* =========================================
   QUILL RICH TEXT STYLES (STEERING NARRATIVE)
   ========================================= */
.rt-editor-container {
    font-size: 0.9rem !important;
    background: white;
    min-height: 120px;
    height: auto;
    resize: vertical;
    overflow-y: auto;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    border: 1px solid #ccc;
    border-top: none;
}

.ql-toolbar.ql-snow {
    border: 1px solid #ccc !important;
    border-radius: 6px 6px 0 0;
    background: #F8F9FA;
    padding: 4px 8px !important;
}

.ql-container.ql-snow {
    border: none !important;
}

.ql-editor {
    min-height: 100px;
}

#view-charter .rt-editor-container {
    min-height: 100px;
}
#view-charter .rt-editor-container .ql-editor {
    min-height: 80px;
}

.st-rich-text ul { padding-left: 20px; margin: 4px 0; }
.st-rich-text ol { padding-left: 20px; margin: 4px 0; }
.st-rich-text li { margin-bottom: 4px; }
.st-rich-text p { margin: 0 0 8px 0; white-space: normal; }
.st-rich-text p:last-child { margin-bottom: 0; }

/* Filas automÃ¡ticas del Plan de Trabajo */
.auto-task-row, .auto-hito-row {
    background: linear-gradient(90deg, rgba(0, 173, 239, 0.03) 0%, transparent 100%);
}
.auto-task-row td:first-child, .auto-hito-row td:first-child {
    border-left: 3px solid var(--brand-2);
}

/* Filas de tareas atrasadas */
.overdue-row {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.05) 0%, transparent 100%);
}
.overdue-row td:first-child {
    border-left: 3px solid var(--nok);
}

/* Filas de tareas completadas esta semana */
.completed-row {
    background: linear-gradient(90deg, rgba(179, 210, 53, 0.1) 0%, transparent 100%);
}
.completed-row td:first-child {
    border-left: 3px solid var(--ok);
}

@media print {

    .nav-bar,
    #app-sidebar,
    #settings-btn,
    #settings-panel,
    .btn-action,
    .st-edit-btn,
    .btn-logout,
    .btn-session-logout,
    .cc-btn-remove,
    .cc-btn-add,
    .ql-toolbar {
        display: none !important;
    }

    #app-shell {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    #app-content {
        overflow: visible !important;
        height: auto !important;
    }

    #login-overlay {
        display: none !important;
    }

    #selector-overlay {
        display: none !important;
    }

    /* Cuando el reporte del portafolio estÃ¡ activo, NO ocultar el selector overlay al imprimir */
    body.printing-portfolio-report #selector-overlay {
        display: flex !important;
        position: static !important;
        background: white !important;
        overflow: visible !important;
        min-height: auto !important;
    }

    body.printing-portfolio-report #selector-overlay .selector-header {
        display: none !important;
    }

    body.printing-portfolio-report #selector-overlay .selector-container {
        width: 100% !important;
        max-width: 100% !important;
        min-height: auto !important;
        background: white !important;
    }

    body.printing-portfolio-report #project-grid {
        display: none !important;
    }

    body.printing-portfolio-report #portfolio-report-view {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    .per-toolbar,
    #drill-return-btn {
        display: none !important;
    }

    .per-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: var(--brand) !important;
    }

    .per-kpi-card,
    .per-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .per-table {
        min-width: 100% !important;
        font-size: 0.7rem;
    }

    .per-sem-badge,
    .per-dim-badge,
    .per-dot,
    .bg-green,
    .bg-yellow,
    .bg-red {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        background: white;
        margin: 0;
        padding: 0;
        padding-top: 20px;
        width: 100%;
        overflow: visible !important;
        height: auto !important;
    }

    .view-section {
        display: none !important;
        margin: 0;
        padding: 0;
    }

    .view-section.active {
        display: block !important;
    }

    header {
        background: var(--brand) !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        margin-bottom: 20px;
        border-bottom: 2px solid #ccc;
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
    }

    .user-profile-box {
        display: none !important;
    }

    .logo-container {
        border: none;
        background: transparent;
    }

    .table-container {
        overflow: visible !important;
        box-shadow: none;
        border: 1px solid #ccc;
        display: block;
        width: 100%;
        break-inside: avoid;
    }

    table,
    .wp-table,
    .st-table,
    .cc-dynamic-table {
        min-width: 100% !important;
        width: 100% !important;
        table-layout: auto !important;
        font-size: 0.65rem;
    }

    /* Print: Dynamic table header/tfoot colors */
    #change-form-view .cc-dynamic-table th,
    #minutes-form-view .cc-dynamic-table th {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: var(--brand) !important;
        color: #ffffff !important;
    }

    #change-form-view .cc-dynamic-table thead tr th:nth-child(4) {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: var(--brand-2) !important;
    }

    #change-form-view .cc-dynamic-table tfoot td[colspan] {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #change-form-view .cc-dynamic-table tfoot #cc-grand-total {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: #e0f2fe !important;
    }

    ::-webkit-scrollbar {
        display: none;
    }

    /* REJILLA STEERING EN IMPRESIÃ“N */
    .st-container {
        display: block;
    }

    .st-kpi-row {
        display: grid !important;
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 15px !important;
        margin-bottom: 15px;
    }

    .st-grid-2 {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 15px !important;
        margin-bottom: 15px;
    }

    .st-grid-risk {
        display: grid !important;
        grid-template-columns: 2fr 1fr !important;
        gap: 15px !important;
        margin-bottom: 15px;
    }

    .st-fin-row {
        display: grid !important;
        grid-template-columns: 1fr 2fr !important;
        gap: 15px !important;
        margin-bottom: 15px;
        align-items: center;
    }

    .st-card {
        break-inside: avoid;
        border: 1px solid #ccc;
        box-shadow: none;
        padding: 10px !important;
    }

    .st-card canvas {
        max-height: 200px !important;
        width: 100% !important;
    }

    #change-list-view.hidden-print,
    #minutes-list-view.hidden-print,
    #kb-board-view.hidden-print,
    #steering-dash-view.hidden-print {
        display: none !important;
    }

    #change-form-view.visible-print,
    #minutes-form-view.visible-print,
    #kb-form-view.visible-print,
    #steering-edit-view.visible-print {
        display: block !important;
    }

    @page {
        size: landscape;
        margin: 10mm;
    }
}

/* --- ESTILOS USER STORIES MODULE --- */
.prio-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    display: inline-block;
    vertical-align: middle;
}

.p-must {
    background-color: #ef4444;
}

.p-should {
    background-color: #f97316;
}

.p-could {
    background-color: #3b82f6;
}

.p-wont {
    background-color: #94a3b8;
}

.status-pill {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
    display: inline-block;
    white-space: nowrap;
}

.s-Propuesta {
    background: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
}

.s-Refinamiento {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

.s-DevReady {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.s-EnProgreso {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.s-Completada {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.s-QA {
    background: #ffedd5;
    color: #9a3412;
    border-color: #fed7aa;
}

.s-UAT {
    background: #fef9c3;
    color: #854d0e;
    border-color: #fde047;
}
/* STAKEHOLDERS TAB REFINEMENT */
#t-stake {
    border-collapse: collapse;
    width: 100%;
}
#t-stake th {
    background: var(--brand);
    color: white;
    padding: 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
}
#t-stake td {
    border: 1px solid var(--border-color);
    padding: 0;
    vertical-align: top;
}
#t-stake td input, 
#t-stake td select, 
#t-stake td textarea {
    width: 100%;
    border: none;
    background: transparent;
    padding: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    color: var(--text-main);
    resize: vertical;
}
#t-stake td input:focus, 
#t-stake td select:focus, 
#t-stake td textarea:focus {
    background: #f8fafc;
    box-shadow: inset 2px 0 0 var(--brand-2);
}
/* =========================================
   PORTFOLIO EXECUTIVE REPORT STYLES
   ========================================= */

/* Contenedor principal del reporte */
#portfolio-report-view {
    display: none;
    width: 95%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 0 60px;
    animation: fadeIn 0.3s ease-in-out;

    /* Escala tipogrÃ¡fica ampliada para modo presentaciÃ³n */
    --fs-xs: 0.85rem;
    --fs-sm: 0.95rem;
    --fs-base: 1.05rem;
    --fs-kpi: 2.4rem;
}

/* Header ejecutivo con gradiente */
.per-header {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: white;
    border-radius: var(--border-radius-lg);
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.per-header-left h2 {
    font-size: 2.1rem;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: 0.5px;
}

.per-header-left .per-meta {
    font-size: var(--fs-sm);
    opacity: 0.85;
}

.per-health-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.per-health-indicator:hover {
    transform: scale(1.05);
}

.per-health-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    transition: transform 0.2s;
}

.per-health-indicator:hover .per-health-dot {
    transform: scale(1.15);
}

/* KPIs del portafolio */
.per-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.per-kpi-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.per-kpi-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 15px;
    text-align: center;
    border: var(--border-width-section) solid var(--border-color);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.per-kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--brand-2);
}

.per-kpi-label {
    font-size: var(--fs-xs);
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 6px;
}

.per-kpi-value {
    font-size: var(--fs-kpi);
    font-weight: 800;
    color: var(--brand);
}

.per-kpi-sub {
    font-size: var(--fs-xs);
    color: #64748b;
    margin-top: 4px;
}

.per-sem-badges {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.per-sem-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
}

.per-sem-badge:hover {
    transform: scale(1.1);
}

/* Tabla resumen de proyectos */
.per-table-container {
    background: white;
    border-radius: var(--border-radius-lg);
    border: var(--border-width-section) solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    margin-bottom: 20px;
}

.per-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.per-table th {
    background: var(--light-blue);
    padding: 10px 8px;
    text-align: center;
    font-size: var(--fs-xs);
    text-transform: uppercase;
    color: var(--brand);
    font-weight: 700;
    border-bottom: 2px solid var(--border-color-strong);
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.per-table th:first-child {
    text-align: left;
    padding-left: 15px;
}

.per-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--fs-base);
    text-align: center;
    vertical-align: middle;
}

.per-table td:first-child {
    text-align: left;
    padding-left: 15px;
}

.per-table tbody tr:hover {
    background: #f8fafc;
}

/* Clickeable links en la tabla */
.per-link {
    color: var(--brand-2);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.per-link:hover {
    text-decoration: underline;
    color: var(--brand);
}

/* Dot de salud */
.per-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    cursor: pointer;
    transition: transform 0.2s;
}

.per-dot:hover {
    transform: scale(1.3);
}

/* Badge T/$ en tabla */
.per-dim-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    display: inline-block;
}

.per-dim-badge:hover {
    transform: scale(1.1);
}

/* Cards de riesgos y logros */
.per-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.per-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 18px;
    border: var(--border-width-section) solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.per-card h3 {
    font-size: var(--fs-sm);
    color: var(--brand);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.03em;
}

/* Riesgo row en Top 5 */
.per-risk-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.per-risk-row:last-child {
    border-bottom: none;
}

.per-risk-row:hover {
    background: #f8fafc;
    border-radius: 4px;
}

.per-risk-name {
    font-weight: 600;
    font-size: var(--fs-sm);
}

.per-risk-project {
    font-size: var(--fs-xs);
    color: #64748b;
    cursor: pointer;
}

.per-risk-project:hover {
    color: var(--brand-2);
    text-decoration: underline;
}

/* Logros item */
.per-achievement-item {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    font-size: var(--fs-sm);
}

.per-proj-label {
    font-weight: 700;
    color: var(--brand);
    cursor: pointer;
    transition: color 0.2s;
}

.per-proj-label:hover {
    color: var(--brand-2);
    text-decoration: underline;
}

/* Toolbar del reporte */
.per-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

/* BotÃ³n flotante de retorno */
#drill-return-btn {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--brand-2);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 1100;
    box-shadow: 0 4px 15px rgba(0, 173, 239, 0.4);
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s;
}

#drill-return-btn:hover {
    background: #0090c0;
}

#drill-return-btn.visible {
    top: 12px;
}

/* Highlight temporal para drill-down interno */
.drill-highlight {
    background: rgba(0, 173, 239, 0.12) !important;
    transition: background 1.5s ease;
}

.drill-highlight-fade {
    background: transparent !important;
}

/* =========================================
   ISSUE 4 FIX: Stakeholder contenteditable placeholder
   ========================================= */
.td-placeholder:empty::before {
    content: '...';
    color: #94a3b8;
    opacity: 0.6;
    font-style: italic;
    pointer-events: none;
}

.td-placeholder {
    min-height: 30px;
    padding: 6px 8px;
    text-align: left;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.td-placeholder:focus {
    outline: 2px solid var(--brand-2);
    outline-offset: -2px;
    background: #fffde7;
}

/* =========================================
   ISSUE 5 FIX: Minutes tables â€” textarea auto-grow
   ========================================= */
#minutes-form-view .cc-dynamic-table textarea,
.t-min-agree textarea,
.t-min-task textarea,
.t-min-att textarea {
    width: 100%;
    border: none;
    padding: 10px 8px;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    color: #0f172a;
    resize: none;
    overflow: hidden;
    min-height: 38px;
    box-sizing: border-box;
    word-wrap: break-word;
    white-space: pre-wrap;
}

#minutes-form-view .cc-dynamic-table textarea:focus {
    background: #fffde7;
}


/* PM Advisor styles → ver css/advisor.css */
/* Gantt + Dependencies + Gauge Widgets → ver css/gantt.css */

