/* ===================================================
   VARIABLES DE SISTEMA: AZUL REY, DORADO Y BLANCO
   =================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* Tipografía institucional (igual que el panel Admin): títulos en Outfit */
h1, h2, h3, h4, h5, h6 {
    font-family: "Outfit", sans-serif;
}

:root {
    --azul-rey: #003366;
    --azul-rey-vibrante: #0047AB;
    --azul-noche: #02182b;
    --azul-claro: #e6f0fa;
    --dorado: #d4af37;
    --dorado-claro: #fbf5e6;
    --dorado-hover: #b8972e;
    --blanco: #ffffff;
    --gris-fondo: #f4f6fa;
    --text-main: #0f1e36;
    --text-muted: #5c6b84;
    --border-color: #d1dcec;
    
    /* Estados Semafóricos */
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    
    --radius: 10px;
    --shadow-sm: 0 2px 6px rgba(0, 51, 102, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 35, 71, 0.12);
    --shadow-gold: 0 4px 14px rgba(212, 175, 55, 0.25);
}

/* ===================================================
   RESET Y REGLAS BASE
   =================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

body {
    background-color: #051426;
    background-image: 
        radial-gradient(at 0% 0%, rgba(5, 20, 38, 0.9) 0px, transparent 55%),
        radial-gradient(at 100% 0%, rgba(212, 175, 55, 0.12) 0px, transparent 40%),
        radial-gradient(at 50% 100%, rgba(2, 132, 199, 0.16) 0px, transparent 50%),
        linear-gradient(180deg, #051426 0%, #003366 40%, #00264d 75%, #051426 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-main);
    line-height: 1.5;
    padding-bottom: 60px;
    overflow-x: hidden;
}

.container > h2, .container > h3 {
    color: #ffffff;
}

.hidden {
    display: none !important;
}

/* ===================================================
   ENCABEZADO INSTITUCIONAL
   =================================================== */
header {
    background: linear-gradient(135deg, var(--azul-noche) 0%, var(--azul-rey) 65%, var(--azul-rey-vibrante) 100%);
    color: var(--blanco);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3.5px solid var(--dorado);
    box-shadow: 0 4px 15px rgba(0, 20, 45, 0.25);
}

header h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--blanco);
}

header h1 span {
    font-weight: 300;
    font-size: 14px;
    color: var(--dorado);
}

.btn-profile-trigger {
    background: rgba(255, 255, 255, 0.12);
    color: var(--blanco);
    border: 1.5px solid var(--dorado);
    padding: 6px 14px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-profile-trigger:hover {
    background: rgba(212, 175, 55, 0.2);
    box-shadow: var(--shadow-gold);
}

.avatar-nav {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--dorado);
    background: var(--blanco);
}

.container {
    max-width: 1150px;
    margin: 24px auto;
    padding: 0 16px;
}

/* ===================================================
   HERO GEOMÉTRICO (AZUL REY Y DORADO)
   =================================================== */
.hero-geometric {
    position: relative;
    background: linear-gradient(135deg, #041224 0%, #0b4a9b 50%, #696e11 100%);
    border-radius: var(--radius);
    padding: 35px 30px;
    color: var(--blanco);
    margin-bottom: 25px;
    overflow: hidden;
    border: 1.5px solid var(--dorado);
    box-shadow: 0 12px 30px rgba(0, 30, 60, 0.25);
}

.hero-geometric::before {
    content: "";
    position: absolute;
    top: -60px;
    right: -50px;
    width: 260px;
    height: 260px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), transparent 70%);
    border: 2px solid rgba(212, 175, 55, 0.5);
    transform: rotate(35deg) skewX(-10deg);
    border-radius: 26px;
    pointer-events: none;
}

.hero-geometric::after {
    content: "";
    position: absolute;
    bottom: -80px;
    left: 40%;
    width: 200px;
    height: 200px;
    background: linear-gradient(45deg, rgba(0, 71, 171, 0.35), transparent 70%);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    transform: rotate(45deg);
    border-radius: 20px;
    pointer-events: none;
}

/* ===================================================
   PANELES Y TARJETAS
   =================================================== */
.panel {
    background: var(--blanco);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    border-top: 3.5px solid var(--azul-rey);
    position: relative;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--azul-rey);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.card-link {
    background: var(--blanco);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-top: 4px solid var(--azul-rey);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.card-link:hover {
    transform: translateY(-5px);
    border-color: var(--dorado);
    box-shadow: 0 14px 28px rgba(0, 40, 80, 0.12), 0 0 14px rgba(212, 175, 55, 0.25);
}

.card-link h3 {
    color: var(--azul-rey);
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 700;
}

.card-link p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===================================================
   FORMULARIOS, INPUTS Y BOTONES
   =================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-group {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--azul-rey);
    margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    color: var(--text-main);
    background: var(--blanco);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--dorado);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.22);
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--azul-rey) 0%, var(--azul-noche) 100%);
    color: var(--blanco);
    border: 1px solid var(--azul-rey);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--azul-rey-vibrante) 0%, var(--azul-rey) 100%);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.btn-accent {
    background: linear-gradient(135deg, #e69500 0%, #cc7a00 100%);
    color: var(--blanco);
    border: 1px solid #b36b00;
}
.btn-accent:hover {
    background: linear-gradient(135deg, #ffaa00 0%, #e69500 100%);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background: var(--azul-claro);
    color: var(--azul-rey);
}

.btn-success-outline {
    background: transparent;
    border: 1.5px solid var(--success);
    color: var(--success);
    font-weight: 700;
}
.btn-success-outline:hover {
    background: var(--success-light);
}

/* ===================================================
   PANTALLA DE ACCESO / MODAL GEOMÉTRICO
   =================================================== */
.overlay {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 100vw !important; height: 100vh !important;
    background: rgba(2, 24, 43, 0.78) !important;
    backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 10000; padding: 15px;
}

#main-auth-overlay, #admin-auth-overlay {
    background-color: #011224 !important;
    background-image: 
        radial-gradient(at 85% 15%, rgba(212, 175, 55, 0.25) 0px, transparent 55%),
        radial-gradient(at 15% 85%, rgba(0, 71, 171, 0.45) 0px, transparent 60%),
        linear-gradient(135deg, rgba(2, 24, 43, 0.96) 0%, rgba(0, 51, 102, 0.9) 100%),
        repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 40px, transparent 40px, transparent 80px),
        repeating-linear-gradient(-60deg, rgba(212, 175, 55, 0.04) 0px, rgba(212, 175, 55, 0.04) 40px, transparent 40px, transparent 80px) !important;
    z-index: 99990 !important;
}

.box-container {
    background: var(--blanco);
    border-radius: 12px;
    padding: 28px;
    max-width: 420px;
    width: 100%;
    border-top: 4px solid var(--dorado);
    box-shadow: 0 16px 40px rgba(0, 15, 35, 0.35);
}

.btn-admin-float {
    position: absolute;
    bottom: 25px;
    right: 25px;
    background: linear-gradient(135deg, var(--azul-rey) 0%, #001f3f 100%);
    color: var(--blanco);
    padding: 12px 22px;
    border-radius: 50px;
    border: 2px solid var(--dorado);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    z-index: 99999;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-admin-float:hover {
    transform: scale(1.04);
    box-shadow: var(--shadow-gold);
}

/* ===================================================
   TABLEROS DE CONTROL INDIVIDUALES
   =================================================== */
.tableros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 16px;
    margin-top: 15px;
}

.tablero-card {
    background: var(--blanco);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--dorado);
}

.tablero-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--azul-claro);
    padding-bottom: 8px;
}

.tablero-header h4 {
    margin: 0;
    font-size: 15px;
    color: var(--azul-rey);
}

.tab-buttons {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.tab-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: var(--azul-rey);
    color: var(--blanco);
    border-color: var(--azul-rey);
    box-shadow: var(--shadow-sm);
}

.tablero-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tablero-item {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-ok {
    background: #ecfdf5;
    border-left: 4px solid var(--success);
    color: #065f46;
}

.item-pending {
    background: #fef2f2;
    border-left: 4px solid var(--danger);
    color: #991b1b;
}

/* ===================================================
   TABLAS Y ELEMENTOS UI
   =================================================== */
.table-responsive {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--blanco);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

th, td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--azul-claro);
    font-weight: 700;
    color: var(--azul-rey);
}

tr:hover {
    background-color: #f8fafc;
}

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
}

.bg-green { background: var(--success-light); color: var(--success); }
.bg-yellow { background: var(--warning-light); color: #92400e; }
.bg-red { background: var(--danger-light); color: var(--danger); }

.semaforo-card {
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
}
.semaforo-card.rojo {
    background: var(--danger-light);
    color: #991b1b;
    border-left: 4px solid var(--danger);
}
.semaforo-card.amarillo {
    background: var(--warning-light);
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.chart-box {
    position: relative;
    height: 240px;
    width: 100%;
}

/* ===================================================
   DRAWER LATERAL DE PERFIL
   =================================================== */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(2, 24, 43, 0.6);
    z-index: 99980;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1; visibility: visible;
}

.profile-sidebar {
    position: fixed;
    top: 0; right: -420px;
    width: 380px; max-width: 92vw; height: 100vh;
    background: var(--blanco);
    box-shadow: -6px 0 25px rgba(0, 25, 55, 0.2);
    z-index: 99985;
    padding: 24px;
    overflow-y: auto;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    border-left: 3px solid var(--dorado);
}

.profile-sidebar.open {
    right: 0;
}

.profile-avatar-img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--dorado);
    box-shadow: var(--shadow-gold);
    background: var(--azul-claro);
    margin-bottom: 8px;
}

.profile-info-card {
    background: var(--azul-claro);
    border: 1px solid #c2d8f2;
    border-radius: var(--radius);
    padding: 14px;
    font-size: 13px;
    margin-bottom: 18px;
}
.profile-info-card p {
    margin-bottom: 5px;
    color: var(--text-main);
}
.profile-info-card strong {
    color: var(--azul-rey);
}

/* ===================================================
   CANVAS DE FIRMA Y ACORDEÓN
   =================================================== */
canvas.pad-firma, #drawer-firma-canvas {
    border: 1.5px dashed var(--dorado);
    border-radius: 6px;
    background: #fdfdfd;
    touch-action: none;
    width: 100%;
}

.accordion-card {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
    background: var(--blanco);
}

.accordion-btn {
    background: #f8fafc;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
    border-left: 4px solid var(--azul-rey);
}
.accordion-btn:hover {
    background: var(--azul-claro);
}

.foto-falencia-box {
    background: #fff1f2;
    border: 1px dashed var(--danger);
    border-radius: 6px;
    padding: 12px;
    margin-top: 10px;
}