:root {
    --gospa-primary: #0057FF; /* Blue Industrial Precision */
    --gospa-primary-dark: #0040e0;
    --gospa-secondary: #0d0d1f; /* Dark Navy Deep */
    --gospa-secondary-light: #1A1A2E;
    --gospa-accent: #00D1FF;
    --gospa-bg: #F0F4F8; /* Subtle cool grey */
    --gospa-surface: #FFFFFF;
    --gospa-text: #1E293B;
    --gospa-text-muted: #64748B;
    --gospa-success: #10B981;
    --gospa-warning: #F59E0B;
    --gospa-danger: #EF4444;
    
    /* Effects */
    --gospa-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    --gospa-shadow-hover: 0 12px 40px rgba(0, 87, 255, 0.1);
    --gospa-glass: rgba(255, 255, 255, 0.85);
    --gospa-radius: 16px;
    --gospa-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

html, body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--gospa-text);
    background-color: var(--gospa-bg);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    -webkit-font-smoothing: antialiased;
}

/* Page Transitions */
.content {
    animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* UI Elements - "Stacked Surfaces" Pattern */
.surface-card {
    background: var(--gospa-surface);
    border-radius: var(--gospa-radius);
    padding: 1.5rem;
    box-shadow: var(--gospa-shadow);
    border: 1px solid rgba(0,0,0,0.15); /* Borrador más visible a pedido */
    transition: var(--gospa-transition);
}

.surface-card:hover {
    box-shadow: var(--gospa-shadow-hover);
    transform: translateY(-2px);
}

.form-section {
    background: #FAFCFF;
    border: 1px solid rgba(0, 87, 255, 0.3); /* Contorno de bloque reforzado */
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Sidebar Styling (Desktop) */
.gospa-sidebar {
    background: var(--gospa-secondary);
    color: white;
    width: 280px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    overflow-y: auto;
}

/* Scrollbar para sidebar */
.gospa-sidebar::-webkit-scrollbar { width: 6px; }
.gospa-sidebar::-webkit-scrollbar-track { background: transparent; }
.gospa-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-header {
    padding: 2rem 1.5rem 1rem 1.5rem;
    position: sticky;
    top: 0;
    background: var(--gospa-secondary);
    z-index: 2;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.nav-group-title {
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.4);
    margin: 1.5rem 0 0.5rem 1.5rem;
    font-weight: 600;
}

.sidebar-item {
    padding: 0.85rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--gospa-transition);
    font-size: 0.95rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    background: linear-gradient(90deg, rgba(0, 87, 255, 0.1) 0%, transparent 100%);
    color: white;
}

.sidebar-item.active {
    background: linear-gradient(90deg, rgba(0, 87, 255, 0.2) 0%, transparent 100%);
    color: var(--gospa-accent);
    border-left-color: var(--gospa-accent);
}

.sidebar-item i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--gospa-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(0,0,0,0.05);
    z-index: 1050;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.06);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gospa-text-muted);
    font-size: 0.75rem;
    text-decoration: none;
    gap: 6px;
    font-weight: 500;
    transition: var(--gospa-transition);
}

.bottom-nav-item i {
    font-size: 1.25rem;
}

.bottom-nav-item.active {
    color: var(--gospa-primary);
    transform: translateY(-2px);
}

/* Responsive Logic */
@media (max-width: 1024px) {
    .gospa-sidebar {
        display: none; /* En el futuro, implementar un drawer si se abre con botón */
    }
    .main-content {
        margin-left: 0 !important;
        padding: 1.5rem !important;
        padding-bottom: 100px !important; /* Espacio para bottom nav */
    }
    .bottom-nav {
        display: flex;
    }
    .sticky-panel-desktop {
        position: relative !important;
        top: 0 !important;
    }
}

@media (min-width: 1025px) {
    .main-content {
        margin-left: 280px;
        padding: 2.5rem 3rem;
        min-height: 100vh;
    }
    .sticky-panel-desktop {
        position: sticky;
        top: 2.5rem;
    }
}

/* Layout helpers for forms */
.input-group-text, .form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #94a3b8; /* Gris oscuro para que la caja sea claramente visible */
    padding: 0.6rem 1rem;
    transition: var(--gospa-transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--gospa-primary);
    box-shadow: 0 0 0 3px rgba(0, 87, 255, 0.1);
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gospa-text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Status Badges */
.status-badge {
    padding: 0.4em 1em;
    border-radius: 50rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}

.status-badge.bg-primary { background: rgba(0, 87, 255, 0.1) !important; color: var(--gospa-primary) !important; }
.status-badge.bg-success { background: rgba(16, 185, 129, 0.1) !important; color: var(--gospa-success) !important; }
.status-badge.bg-warning { background: rgba(245, 158, 11, 0.1) !important; color: #D97706 !important; }
.status-badge.bg-secondary { background: rgba(100, 116, 139, 0.1) !important; color: var(--gospa-text-muted) !important; }
.status-badge.bg-danger { background: rgba(239, 68, 68, 0.1) !important; color: var(--gospa-danger) !important; }

/* KPI Widgets */
.kpi-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--gospa-primary);
    line-height: 1.2;
    letter-spacing: -1px;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--gospa-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Glass Buttons */
.btn-precision {
    background: linear-gradient(135deg, var(--gospa-primary) 0%, var(--gospa-primary-dark) 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 87, 255, 0.2);
    transition: var(--gospa-transition);
}

.btn-precision:hover {
    background: linear-gradient(135deg, var(--gospa-primary-dark) 0%, #0030a8 100%);
    box-shadow: 0 6px 20px rgba(0, 87, 255, 0.3);
    color: white;
    transform: translateY(-1px);
}

.btn-precision:disabled {
    background: #CBD5E1;
    box-shadow: none;
    transform: none;
}

/* Header Utilities */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gospa-text);
    margin-bottom: 0.25rem;
    letter-spacing: -0.5px;
}

.page-subtitle {
    color: var(--gospa-text-muted);
    margin: 0;
    font-size: 0.95rem;
}

/* Tabla custom para listas largas */
.table-gospa {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}
.table-gospa th {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--gospa-text-muted);
    padding: 0 1rem 0.5rem 1rem;
    border: none;
    font-weight: 600;
}
.table-gospa td {
    padding: 1rem;
    background: white;
    border-top: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    vertical-align: middle;
}
.table-gospa td:first-child { border-radius: 8px 0 0 8px; border-left: 1px solid #cbd5e1; }
.table-gospa td:last-child { border-radius: 0 8px 8px 0; border-right: 1px solid #cbd5e1; }
.table-gospa tr { transition: transform 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.table-gospa tbody tr:hover { transform: scale(1.005); box-shadow: 0 6px 16px rgba(0,0,0,0.08); cursor: pointer; }

/* Global Notifications (Top-Center) */
.gospa-notif-top {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    width: auto;
    min-width: 350px;
    max-width: 90%;
    animation: gospaNotifSlide 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes gospaNotifSlide {
    0% { transform: translate(-50%, -100%); opacity: 0; }
    100% { transform: translate(-50%, 0); opacity: 1; }
}

.gospa-notif-top .toast {
    background: var(--gospa-glass) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15) !important;
    border: 1px solid rgba(255,255,255,0.4) !important;
}

.gospa-notif-top .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(50%); /* Ajuste para visibilidad en glass light */
}

/* Ajuste automático de altura para campos de texto */
.gospa-autoresize {
    overflow-y: hidden;
    resize: vertical;
    min-height: 60px;
}

