@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

@media print {
    .no-print {
        display: none !important;
    }
}

:root {
    --primary: #5A447E;
    /* Deep Purple */
    --primary-light: #F2EFF7;
    --primary-hover: #4B3869;
    --text-dark: #1E293B;
    --text-main: #475569;
    --text-muted: #94A3B8;
    --bg-main: #FAFAFA;
    --bg-white: #FFFFFF;
    --border-light: #E2E8F0;

    --sidebar-width: 240px;
    --header-height: 80px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-main);
    display: flex;
    height: 100vh;
    /* Fixed height - never overflows */
    overflow: hidden;
    /* Prevent global page scroll */
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    /* Fill the full body height */
    flex-shrink: 0;
    /* Never shrink */
    background-color: var(--bg-white);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow: hidden;
    /* Clip - sidebar-nav scrolls internally */
}

.logo-container {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.logo-container img {
    height: 48px;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0 24px 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: var(--border-light);
    border-radius: 4px;
}

.nav-item {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    text-transform: uppercase;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    border-left-color: var(--primary);
}

.user-profile {
    padding: 20px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-white);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- MAIN CONTENT AREA --- */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.topbar {
    height: var(--header-height);
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.greeting {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.topbar-badge {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-left: 24px;
    border-left: 1px solid var(--border-light);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--text-muted);
}

.topbar-icon {
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s ease;
    position: relative;
}

.topbar-icon:hover {
    color: var(--primary);
}

.icon-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 50%;
}

/* --- ADMIN INDICATOR --- */
.admin-indicator {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #1e293b;
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.admin-indicator.active {
    display: flex;
}

.logout-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #dc2626;
}

.content-area {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* --- GRID LAYOUT FOR HOME (AREAS) --- */
.areas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.area-card {
    height: 380px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.area-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.area-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.area-card:hover img {
    transform: scale(1.05);
}

.area-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(30, 41, 59, 0.95), rgba(30, 41, 59, 0));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 30px;
}

.area-title {
    color: white;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.area-meta {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
}

/* --- PROCESS GALLERY (VENTAS) --- */
.gallery-header {
    margin-bottom: 30px;
}

.gallery-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.gallery-subtitle {
    font-size: 16px;
    color: var(--text-muted);
}

.process-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.process-card {
    background: var(--bg-white);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.process-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.process-icon-area {
    height: 180px;
    background-color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.process-icon-area i {
    font-size: 56px;
    color: #A797C2;
}

.process-info {
    padding: 24px;
    flex: 1;
}

.process-code {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.process-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.process-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.process-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.process-footer i {
    font-size: 16px;
    transition: transform 0.2s, color 0.2s;
}

.process-card:hover .process-footer i {
    color: var(--primary);
    transform: translateX(4px);
}

/* --- FICHA TÃ‰CNICA (LOGÃSTICA) --- */
.ficha-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    width: 100%;
}

.ficha-header-main {
    flex: 1;
}

.ficha-actions {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding-top: 4px; /* Align with title text better */
}

.ficha-actions .btn-secondary {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: var(--text-dark);
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ficha-actions .btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.ficha-title-area h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.ficha-title-area p {
    color: var(--text-muted);
    font-size: 15px;
}

.badge-clave {
    background-color: var(--primary);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.ficha-info-panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.panel {
    background-color: var(--bg-white);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.panel-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.panel-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.4;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title i {
    color: var(--primary);
    background-color: var(--primary-light);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* Flujo */
.flujo-placeholder {
    width: 100%;
    min-height: 300px;
    height: auto;
    background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 40px;
    border: 1px dashed #CBD5E1;
    overflow: hidden;
    padding: 20px;
}

.flujo-placeholder img {
    width: 100%;
    height: auto;
    max-height: 800px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

.flujo-placeholder img:hover {
    transform: scale(1.02);
}

/* 2 Columns */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--text-main);
    font-size: 14px;
}

.list-item i {
    color: var(--primary);
    margin-top: 3px;
}

.list-numbered {
    counter-reset: custom-counter;
}

.list-numbered .list-item {
    align-items: baseline;
    font-weight: 500;
}

.list-numbered .list-item::before {
    counter-increment: custom-counter;
    content: "0" counter(custom-counter);
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
}

.list-bulleted {
    list-style: none;
    padding: 0;
}

.list-bulleted .list-item {
    margin-bottom: 12px;
}

.list-bulleted .list-item i {
    color: var(--primary);
    margin-right: 12px;
    font-size: 14px;
}

.diagram-explanation {
    margin-top: 15px;
    padding: 20px;
    background: #f8fafc;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-dark);
    text-align: left;
    line-height: 1.7;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    margin-bottom: 40px;
}

.data-table th,
.data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.data-table th {
    background-color: var(--bg-main);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table td {
    color: var(--text-dark);
}

.data-table td:first-child {
    font-weight: 600;
}

/* UI Images */
.ui-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 8px;
}

.ui-image-container {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.ui-image-container img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.ui-caption {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin-top: 8px;
    margin-bottom: 40px;
}

/* Ramificaciones */
.ramificaciones-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.rami-card {
    background: white;
    border: 1px solid var(--border-light);
    padding: 24px;
    border-radius: 12px;
}

.rami-card i {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 16px;
}

.rami-title {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 15px;
    margin-bottom: 8px;
}

.rami-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Recursos */
.recursos-list {
    margin-bottom: 40px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    background: white;
}

.recurso-item {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    gap: 16px;
}

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

.recurso-icon {
    width: 40px;
    height: 40px;
    background-color: #FFF1F2;
    color: #E11D48;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.recurso-item:nth-child(2) .recurso-icon {
    background-color: #FFF7ED;
    color: #EA580C;
}

.recurso-info {
    flex: 1;
}

.recurso-title {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
    margin-bottom: 4px;
}

.recurso-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.recurso-link {
    color: var(--text-muted);
    cursor: pointer;
}

.recurso-link:hover {
    color: var(--primary);
}

/* Validation Form */
.validation-area {
    background-color: var(--primary-light);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    margin-bottom: 60px;
}

.validation-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--text-dark);
    font-weight: 500;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(90, 68, 126, 0.1);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--bg-white);
    color: var(--text-main);
    border: 1px solid var(--border-light);
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: var(--bg-main);
}

/* --- CONFIG MODAL --- */
.modal-title {
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title i {
    color: var(--primary);
}

.modal-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    transform: rotate(90deg);
}

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

.config-group {
    margin-bottom: 20px;
}

.config-group-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary-dark);
    font-size: 16px;
}

#config-modal-body {
    flex: 1;
    overflow-y: auto;
    background-color: #f8fafc;
    padding: 30px;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
}

.config-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: var(--primary-light);
}

.config-item:hover {
    background-color: #f8fafc;
}

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

.btn-icon-admin {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    font-size: 14px;
}

.btn-icon-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

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

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    z-index: -1;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #CBD5E1;
    transition: .4s;
    border-radius: 24px;
}

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

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

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

/* Badge Styles */
.proc-badge {
    background: #f1f5f9;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    letter-spacing: 0.5px;
}

.proc-badge-mini {
    background: #f8fafc;
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 11px;
    border: 1px solid #e2e8f0;
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.toast {
    background-color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    border-left: 4px solid var(--primary);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 350px;
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    font-size: 20px;
    color: var(--primary);
}

.toast.success {
    border-left-color: #10B981;
}

.toast.success .toast-icon {
    color: #10B981;
}

.toast.warning {
    border-left-color: #F59E0B;
}

.toast.warning .toast-icon {
    color: #F59E0B;
}

.toast.info {
    border-left-color: #3B82F6;
}

.toast.info .toast-icon {
    color: #3B82F6;
}

.toast-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.toast-title {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 14px;
}

.toast-msg {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.toast-close {
    cursor: pointer;
    color: #CBD5E1;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-muted);
}

/* --- ADMIN TABS --- */
.admin-tabs {
    display: flex;
    background: white;
    padding: 10px 20px 0;
    border-bottom: 1px solid var(--border-light);
    gap: 8px;
    flex-shrink: 0;
}

.admin-tab {
    padding: 14px 20px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px 8px 0 0;
}

.admin-tab:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.admin-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-light);
}

.admin-tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.admin-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- PRINT STYLES --- */
@media print {

    .sidebar,
    .topbar-right,
    #image-modal,
    .toast-container,
    .modal-overlay,
    #config-btn,
    .validation-area button,
    .validation-checkbox {
        display: none !important;
    }

    body,
    html {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        background-color: white !important;
        color: black !important;
    }

    .main-wrapper,
    .content-area {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        position: static !important;
    }

    .panel,
    .grid-2col,
    .data-table,
    .validation-area,
    .section-title {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .section-title {
        page-break-after: avoid;
        break-after: avoid;
    }

    img {
        max-width: 100% !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    @page {
        margin: 1.5cm;
    }
}

/* ===== FICHA INLINE EDITOR PANEL ===== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.fe-section {
    margin-bottom: 22px;
}

.fe-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.fe-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--text-dark);
    background: #fafafa;
    resize: vertical;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.fe-input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(90, 68, 126, 0.08);
}

.fe-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px dashed var(--primary);
    border-radius: 6px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.fe-add-btn:hover {
    background: var(--primary);
    color: white;
}

.ficha-edit-input {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.ficha-edit-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-icon-danger {
    background: none;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    color: #ef4444;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.btn-icon-danger:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

#fe-roles-tbody td,
#fe-kpis-tbody td {
    padding: 4px 5px;
    vertical-align: top;
}

/* --- SPLASH SCREEN (PANTALLA INICIAL) --- */
.splash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-white);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.splash-overlay:not(.active) {
    opacity: 0;
    visibility: hidden;
}

.splash-top-left {
    position: absolute;
    top: 30px;
    left: 40px;
}

.splash-top-left img {
    height: 60px;
    object-fit: contain;
}

.splash-top-right {
    position: absolute;
    top: 30px;
    right: 40px;
}

.splash-top-right img {
    height: 60px;
    object-fit: contain;
}

.splash-content {
    max-width: 800px;
    width: 90%;
    text-align: center;
    color: var(--text-dark);
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.splash-logos-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    margin-bottom: 40px;
}

.splash-logo img {
    max-height: 140px;
    max-width: 300px;
    object-fit: contain;
}

.splash-branding {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.splash-project-badge {
    display: inline-block;
    color: var(--text-dark);
    padding: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.splash-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 40px;
    letter-spacing: 0.5px;
    max-width: 500px;
}

.splash-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

.btn-large {
    padding: 18px 45px;
    font-size: 17px;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(90, 68, 126, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-large:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px rgba(90, 68, 126, 0.3);
}

.splash-footer {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* --- GAPS & INFO MODAL --- */
.gaps-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}

.gap-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--primary);
}

.gap-card::after {
    border-color: var(--primary-light);
}

.gap-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    transition: width 0.3s ease;
}

.gap-card:hover::before {
    width: 8px;
}

.gap-card.status-pendiente::before { background: #F59E0B; }
.gap-card.status-desarrollo::before { background: #3B82F6; }
.gap-card.status-finalizado::before { background: #10B981; }

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

.gap-icon-bg {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.3s ease;
}

.gap-card:hover .gap-icon-bg {
    transform: scale(1.1) rotate(-5deg);
}

.status-pendiente .gap-icon-bg { 
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%); 
    color: #D97706; 
    border: 1px solid #FEF3C7; 
}
.status-desarrollo .gap-icon-bg { 
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%); 
    color: #2563EB; 
    border: 1px solid #DBEAFE; 
}
.status-finalizado .gap-icon-bg { 
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%); 
    color: #059669; 
    border: 1px solid #D1FAE5; 
}

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

.gap-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
}

.gap-desc {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
}

.gap-status-pill {
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.status-pendiente .gap-status-pill { background: #FEF3C7; color: #92400E; }
.status-desarrollo .gap-status-pill { background: #DBEAFE; color: #1E40AF; }
.status-finalizado .gap-status-pill { background: #D1FAE5; color: #065F46; }

.info-previa-box {
    background-color: #FFFFFF;
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    border-left: 6px solid var(--primary);
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-dark);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.info-previa-box:hover {
    transform: translateX(5px);
}

.gap-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 13px;
}

.info-previa-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 14px;
    min-height: 150px;
    resize: vertical;
}

.btn-icon-danger {
    background: #FEF2F2;
    color: #EF4444;
    border: 1px solid #FEE2E2;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-danger:hover {
    background: #FEE2E2;
    color: #DC2626;
}
/* --- RICH TEXT / MARKDOWN STYLING --- */
.panel-value p, .diagram-explanation p {
    margin-bottom: 12px;
}

.panel-value p:last-child, .diagram-explanation p:last-child {
    margin-bottom: 0;
}

.panel-value ul, .panel-value ol,
.diagram-explanation ul, .diagram-explanation ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.panel-value li, .diagram-explanation li {
    margin-bottom: 5px;
}

.panel-value strong, .diagram-explanation strong {
    font-weight: 700;
    color: var(--primary);
}

.panel-value img, .diagram-explanation img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 15px 0;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.panel-value h1, .panel-value h2, .panel-value h3,
.diagram-explanation h1, .diagram-explanation h2, .diagram-explanation h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text-dark);
}

/* --- GAPs UI FIX --- */
.gaps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 24px; margin-bottom: 40px; }
.gap-card { background: white; border-radius: 16px; padding: 24px; padding-left: 30px; border: 1px solid var(--border-light); position: relative; overflow: hidden; transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1); display: flex; flex-direction: column; gap: 16px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03); }

/* --- GLOBAL MODALS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* --- FULLSCREEN MODAL --- */
.modal-content.modal-fullscreen {
    max-width: 1100px;
    width: 95%;
    max-height: 90vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-fullscreen .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.modal-content.modal-fullscreen .modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-content.modal-fullscreen .modal-close {
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.modal-content.modal-fullscreen .modal-close:hover {
    color: var(--primary);
}

/* --- CONFIG MODAL SPECIFIC --- */
#config-modal .modal-content {
    max-width: 900px;
    width: 95%;
    padding: 0;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

#config-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 0 20px 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.admin-tab {
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.admin-tab:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.admin-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(90, 68, 126, 0.3);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

/* --- MARKDOWN RENDERED CONTENT STYLES --- */
.panel-value h1,
.panel-value h2,
.panel-value h3,
.panel-value h4,
.panel-value h5,
.panel-value h6,
.diagram-explanation h1,
.diagram-explanation h2,
.diagram-explanation h3,
.diagram-explanation h4,
.diagram-explanation h5,
.diagram-explanation h6 {
    color: var(--text-dark);
    font-weight: 700;
    line-height: 1.3;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.panel-value h1:first-child,
.diagram-explanation h1:first-child,
.panel-value h2:first-child,
.diagram-explanation h2:first-child,
.panel-value h3:first-child,
.diagram-explanation h3:first-child {
    margin-top: 0;
}

.panel-value h1,
.diagram-explanation h1 { font-size: 1.6em; }
.panel-value h2,
.diagram-explanation h2 { font-size: 1.35em; }
.panel-value h3,
.diagram-explanation h3 { font-size: 1.15em; }
.panel-value h4,
.diagram-explanation h4 { font-size: 1em; }

.panel-value p,
.diagram-explanation p {
    margin-bottom: 0.75em;
    line-height: 1.7;
}

.panel-value p:last-child,
.diagram-explanation p:last-child {
    margin-bottom: 0;
}

.panel-value blockquote,
.diagram-explanation blockquote {
    border-left: 4px solid var(--primary);
    background: rgba(90, 68, 126, 0.06);
    padding: 12px 16px;
    margin: 0.75em 0;
    border-radius: 0 8px 8px 0;
    color: var(--text-main);
    font-style: italic;
}

.panel-value blockquote p,
.diagram-explanation blockquote p {
    margin-bottom: 0.3em;
}

.panel-value blockquote p:last-child,
.diagram-explanation blockquote p:last-child {
    margin-bottom: 0;
}

.panel-value ul,
.panel-value ol,
.diagram-explanation ul,
.diagram-explanation ol {
    padding-left: 1.5em;
    margin: 0.5em 0;
}

.panel-value li,
.diagram-explanation li {
    margin-bottom: 0.35em;
    line-height: 1.6;
}

.panel-value li ul,
.panel-value li ol,
.diagram-explanation li ul,
.diagram-explanation li ol {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}

.panel-value hr,
.diagram-explanation hr {
    border: none;
    border-top: 2px solid var(--border-light);
    margin: 1.2em 0;
}

.panel-value strong,
.diagram-explanation strong {
    font-weight: 700;
    color: var(--text-dark);
}

.panel-value em,
.diagram-explanation em {
    font-style: italic;
}

.panel-value code,
.diagram-explanation code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
    color: #c7254e;
}

.panel-value pre,
.diagram-explanation pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.75em 0;
    font-size: 0.9em;
    line-height: 1.5;
}

.panel-value pre code,
.diagram-explanation pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.panel-value a,
.diagram-explanation a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.panel-value a:hover,
.diagram-explanation a:hover {
    color: var(--primary-hover);
}

.panel-value img,
.diagram-explanation img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5em 0;
}

.panel-value table,
.diagram-explanation table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75em 0;
    font-size: 0.95em;
}

.panel-value table th,
.panel-value table td,
.diagram-explanation table th,
.diagram-explanation table td {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    text-align: left;
}

.panel-value table th,
.diagram-explanation table th {
    background: var(--bg-main);
    font-weight: 600;
}
