:root {
    --bg-dark: #071927;
    --card-bg: rgba(255, 255, 255, 0.92);
    --card-radius: 16px;
    --primary: #0073ea;
    --theme-color: #004556;
    --theme-text-color: #ffffff;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0d233a;
    color: white;
}

/* MENÚ LATERAL SLIDING (DRAWER) */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.drawer {
    position: fixed;
    top: 0;
    left: -360px;
    width: 330px;
    height: 100%;
    background: #152e48;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    transition: left 0.3s ease;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    box-sizing: border-box;
    overflow-y: auto;
}

.drawer.open {
    left: 0;
}

.btn-toggle-drawer {
    position: fixed;
    top: 15px;
    left: 15px;
    background: #152e48;
    color: white;
    border: 1px solid #32527b;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 900;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-section {
    border-bottom: 1px solid #32527b;
    padding-bottom: 1rem;
}

.drawer-section h4 {
    margin: 0 0 0.6rem 0;
    color: #ffffff;
    font-size: 0.9rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

input,
select,
button,
textarea {
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    border: 1px solid #32527b;
    background: #0d233a;
    color: white;
    font-family: inherit;
    font-size: 0.85rem;
    width: 100%;
    box-sizing: border-box;
}

button {
    background: var(--primary);
    cursor: pointer;
    border: none;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover {
    background: #005bb5;
}

.btn-preview {
    background: #00ca72;
    color: #000;
}

.btn-pdf {
    background: #e11d48;
    color: #fff;
    margin-top: 0.5rem;
}

.btn-pdf:hover {
    background: #be123c;
}

.btn-state {
    background: #f59e0b;
    color: #000;
    margin-top: 0.5rem;
}

.btn-exit-preview {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 0.8rem 1.5rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    display: none;
    z-index: 9999;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 25, 39, 0.85);
    backdrop-filter: blur(5px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.bento-container {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 2rem;
    background: #071829 url('/assets/bg-main.png') center/cover no-repeat;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.header-onepager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.pill-logo-cs {
    background: transparent;
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 55px;
}

.pill-logo-cs img {
    max-height: 50px;
    max-width: 180px;
    object-fit: contain;
}

.pill-client-split {
    display: inline-flex;
    align-items: stretch;
    background: white;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    height: 55px;
}

.pill-split-left {
    background: white;
    padding: 0 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pill-split-left img {
    max-height: 40px;
    max-width: 150px;
    object-fit: contain;
}

.pill-split-right {
    background: var(--theme-color);
    color: var(--theme-text-color);
    padding: 0 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    transition: background 0.3s ease, color 0.3s ease;
}

.header-title {
    text-align: center;
    color: #ffa500;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1px;
}

/* BENTO GRID Layout de 5 Cajas */
.bento-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1.2fr;
    grid-template-rows: auto auto auto;
    gap: 1.5rem;
}

.box-1 { grid-column: 1; grid-row: 1; }
.box-2 { grid-column: 1; grid-row: 2; }
.box-3 { grid-column: 2; grid-row: 1 / span 2; }
.box-4 { grid-column: 3; grid-row: 1 / span 2; }
.box-footer { grid-column: 1 / span 3; grid-row: 3; }

.bento-card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 1.2rem;
    color: #1c2833;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
}

.card-header-title {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.4rem;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
}

.btn-add-item {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    align-self: flex-start;
    margin-bottom: 0.8rem;
}

.data-row {
    margin-bottom: 0.8rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.4rem;
    position: relative;
}

.data-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-val {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    margin-top: 0.2rem;
}

/* SEMÁFORO */
.traffic-light {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.light-verde { background: #d1fae5; color: #065f46; border: 1px solid #10b981; }
.light-amarillo { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.light-rojo { background: #fee2e2; color: #991b1b; border: 1px solid #ef4444; }

.light-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.light-verde .light-dot { background: #10b981; }
.light-amarillo .light-dot { background: #f59e0b; }
.light-rojo .light-dot { background: #ef4444; }

/* TIMELINE */
.timeline {
    position: relative;
    padding-left: 20px;
    margin-top: 0.5rem;
    border-left: 2px solid #cbd5e1;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 3px solid var(--theme-color);
    background: white;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.timeline-badge {
    background: #fef2f2;
    color: var(--theme-color);
    font-weight: bold;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    border: 1px solid #fee2e2;
}

.timeline-resp {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: bold;
}

.timeline-title-text {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.2rem;
}

.timeline-desc-text {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.3;
}

/* TABLA */
.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.custom-table th,
.custom-table td {
    border: 1px solid #cbd5e1;
    padding: 6px 8px;
    text-align: left;
}

.custom-table th {
    background: #f1f5f9;
    color: #334155;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.custom-table input {
    width: 90%;
    padding: 2px 4px;
    background: #fff;
    color: #000;
    border: 1px solid #cbd5e1;
}

.total-row {
    font-weight: bold;
    background: #f8fafc;
}

.break-image {
    width: 100%;
    object-fit: cover;
    border-radius: 8px;
    margin: 0.4rem 0;
}

.btn-inline-add {
    background: #e2e8f0;
    color: #334155;
    border: 1px dashed #94a3b8;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

/* FOOTER PILLS */
.footer-pills-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    gap: 1rem;
}

.pill-footer {
    background: white;
    padding: 0.4rem 1.2rem;
    border-radius: 25px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: #0f172a;
    font-weight: bold;
    font-size: 0.85rem;
    transition: transform 0.2s ease;
}

.pill-footer:hover { transform: translateY(-2px); }

.pill-footer img {
    max-height: 25px;
    max-width: 100px;
    object-fit: contain;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #152e48;
    padding: 1.8rem;
    border-radius: 12px;
    width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.subitems-selector-box {
    max-height: 180px;
    overflow-y: auto;
    background: #0d233a;
    border: 1px solid #32527b;
    border-radius: 8px;
    padding: 0.8rem;
}

/* MODO VISTA PREVIA */
.preview-mode .btn-toggle-drawer,
.preview-mode .btn-add-item,
.preview-mode .btn-remove,
.preview-mode .btn-inline-add,
.preview-mode .editable-input-field {
    display: none !important;
}

.preview-mode .preview-only-text {
    display: block !important;
}

.preview-mode .btn-exit-preview {
    display: block !important;
}

.preview-mode input[type="text"],
.preview-mode input[type="month"] {
    border: none !important;
    background: transparent !important;
    color: #0f172a !important;
    padding: 0 !important;
    font-weight: bold;
}

.preview-only-text {
    display: none;
}

/* SELECTOR DE ACTIVIDADES MODAL */
/* CORRECCIÓN DE ALINEACIÓN Y SANGRÍA EN SELECTOR DE ACTIVIDADES */
#subitemsChecklist,
.subitems-selector-box {
    max-height: 220px;
    overflow-y: auto !important;
    overflow-x: auto !important;
    padding: 10px !important;
    background: #0d233a !important;
    border: 1px solid #32527b !important;
    border-radius: 8px !important;
    text-align: left !important; /* Elimina cualquier alineación previa */
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

#subitemsChecklist label,
.subitems-selector-box label {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 2px 0 !important;
    white-space: nowrap !important;
    width: 100% !important;
    text-align: left !important;
    cursor: pointer;
}

#subitemsChecklist input[type="checkbox"],
.subitems-selector-box input[type="checkbox"] {
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    width: 16px !important;
    height: 16px !important;
    display: inline-block !important;
}