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

:root {
    --brand-primary: #1e3a8a;
    --brand-secondary: #3b82f6;
    --brand-accent: #f59e0b;
    --brand-dark: #0f172a;
    --muted: #6b7280;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.18);
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    background: #f4f5f7;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 24px;
    width: 100%;
    flex: 1;
}

/* ========== HEADER ========== */

.site-header {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 32px;
}

.header-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-container {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}

.logo-container::before {
    content: '';
    position: absolute;
    inset: -4px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary), var(--brand-accent));
    border-radius: 50%;
    opacity: 0.15;
    animation: rotate-gradient 8s linear infinite;
}

@keyframes rotate-gradient {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.header-left .logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fff;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
    position: relative;
    z-index: 1;
    border: 3px solid #fff;
}

.header-titles p {
    margin: 0 0 4px 0;
    color: var(--muted);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.header-titles h1 {
    margin: 0;
    color: var(--brand-dark);
    font-size: 24px;
    line-height: 1.3;
    font-weight: 900;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.main-nav {
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(15, 23, 42, 0.04);
    padding: 6px;
    border-radius: 12px;
}

.main-nav a {
    color: #374151;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.main-nav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 10px;
}

.main-nav a span {
    position: relative;
    z-index: 1;
}

.main-nav a.active {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.main-nav a.active::before {
    opacity: 1;
}

.main-nav a:hover:not(.active) {
    transform: translateY(-2px);
    background: rgba(59, 130, 246, 0.1);
    color: var(--brand-secondary);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
}

/* Mobile burger menu */
.burger {
    display: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 8px;
    position: relative;
    z-index: 10;
}

.burger .bar {
    display: block;
    width: 26px;
    height: 3px;
    background: var(--brand-primary);
    margin: 5px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.main-nav.open {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 12px 0;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

@media (max-width: 720px) {
    .header-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 16px;
    }

    .burger {
        display: block;
    }

    .main-nav {
        display: none;
    }

    .main-nav a {
        padding: 12px 16px;
    }

    .header-left {
        width: 100%;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
        align-items: center;
    }

    .main-nav {
        width: 100%;
        justify-content: flex-start;
        flex-direction: column;
        align-items: stretch;
    }

    .main-nav a {
        text-align: center;
    }
}

/* Burger open X transform */
.burger[aria-expanded="true"] .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.burger[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.burger[aria-expanded="true"] .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Footer */
.footer {
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    padding: 20px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    margin-top: 40px;
}

.footer p {
    margin: 8px 0;
}

.footer a {
    color: #2563eb;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer-content-center {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
}

h1 {
    margin-top: 0;
}

.upload-box {
    background: #ffffff;
    padding: 48px 40px;
    border-radius: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
    margin: 60px auto 24px;
    max-width: 800px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.upload-box form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: stretch;
}

.upload-box label,
label {
    font-weight: 600;
}

.btn {
    padding: 12px 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background: linear-gradient(135deg, #6d28d9, #9333ea);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    margin-left: 0;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    width: auto;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.small {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
}

.btn.btn-secondary {
    background: #6b7280;
}

.btn.btn-secondary:hover {
    background: #4b5563;
}

.btn.btn-secondary.small {
    padding: 6px 12px;
    font-weight: 700;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    margin-bottom: 24px;
}


/* ========== MODERN FILTER CARD ========== */

.filter-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 24px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #3b82f6);
    background-size: 200% 100%;
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.filter-card:hover {
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.2),
        0 3px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, 0.3);
}

/* Filter Header */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

.filter-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.filter-icon i {
    color: #ffffff;
    font-size: 16px;
}

.filter-card:hover .filter-icon {
    transform: rotate(5deg) scale(1.05);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.filter-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.2px;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.filter-badge i {
    font-size: 10px;
}

/* Filter Form */
.filter-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.filter-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 12px;
    color: #1e40af;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.input-label i {
    color: #3b82f6;
    font-size: 12px;
}

.date-input {
    padding: 9px 12px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--brand-dark);
    background: #ffffff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.date-input:hover {
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.1);
}

.date-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15),
        0 3px 10px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-filter-apply,
.btn-filter-clear {
    flex: 1;
    min-width: 140px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.btn-filter-apply {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    border: none;
    box-shadow: 0 3px 12px rgba(59, 130, 246, 0.3);
}

.btn-filter-apply::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-filter-apply:hover::before {
    left: 100%;
}

.btn-filter-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgba(59, 130, 246, 0.4);
}

.btn-filter-apply:active {
    transform: translateY(0);
}

.btn-filter-clear {
    background: #ffffff;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.btn-filter-clear:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #374151;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.btn-filter-clear:active {
    transform: translateY(0);
}

/* Filter Active Info */
.filter-active-info {
    margin-top: 14px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-left: 3px solid #10b981;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.1);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

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

.filter-info-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.filter-info-icon i {
    color: #ffffff;
    font-size: 13px;
}

.filter-info-text {
    flex: 1;
    font-size: 13px;
    color: #065f46;
    line-height: 1.5;
    font-weight: 500;
}

.filter-info-text strong {
    font-weight: 800;
    color: #047857;
}

/* Responsive Design */
@media (max-width: 640px) {
    .filter-card {
        padding: 14px 16px;
    }

    .filter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .filter-badge {
        align-self: flex-start;
    }

    .filter-inputs {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        flex-direction: column;
    }

    .btn-filter-apply,
    .btn-filter-clear {
        width: 100%;
        min-width: auto;
    }
}


.card-title {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 4px;
}

.card-value {
    font-size: 24px;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
}

th {
    background: #f9fafb;
    text-align: left;
}

/* ========== SECTION HEADERS MODERNO ========== */

.section-header {
    margin-top: 48px;
    margin-bottom: 24px;
    padding: 12px 18px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.65));
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(30, 58, 138, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
}

.section-header::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary), transparent);
    opacity: 0.5;
}

/* Header content layout */
.section-header .header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.section-header .header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.section-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: var(--brand-dark);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.25px;
}

.section-title i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
    font-size: 18px;
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.07);
}

.section-title span {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.3px;
    margin-top: 6px;
    opacity: 0.9;
}

/* small action button used in the header */
.section-header .btn-sm {
    background: transparent;
    border: 1px solid rgba(30, 58, 138, 0.08);
    color: var(--brand-primary);
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
}

.section-header .btn-sm:hover {
    background: rgba(59, 130, 246, 0.06);
}

.error {
    color: #b91c1c;
    margin-bottom: 12px;
}

.success {
    color: #15803d;
    margin-bottom: 12px;
}

.chart-container {
    width: 100%;
    height: 400px;
}

nav a {
    margin-right: 12px;
    text-decoration: none;
    color: #4b5563;
}

nav a.active {
    font-weight: 700;
    color: #2563eb;
}

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

input[type="number"],
input[type="date"] {
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.message {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
}

.message.warning {
    background: #fef3c7;
    color: #92400e;
}

.hint {
    font-size: 13px;
    color: #6b7280;
    margin-top: 6px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.chart-container canvas {
    width: 100%;
    height: 100%;
    background: #ffffff;
    /* fondo blanco para export/captura */
    border-radius: 8px;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kpi-section {
    margin-bottom: 16px;
}

.card table {
    width: 100%;
}

.card table th,
.card table td {
    text-align: left;
}

/* Responsive wrapper for tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Ensure consistent header/cell appearance in Puntuaciones */
.puntuaciones-page .modern-table thead th {
    font-weight: 700;
    font-size: 15px;
}

.puntuaciones-page .modern-table td.operario {
    font-weight: 600;
    color: #1f2937;
}

.nav-links {
    margin-bottom: 16px;
}

.center-alert {
    text-align: center;
}

/* Top 3 Layout */
.top3-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .top3-container {
        grid-template-columns: 1fr;
    }
}

/* ========== CARD IMPROVEMENTS ========== */

.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    border: 1px solid #f0f0f0;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* ========== CHART STYLING ========== */

.chart-container {
    width: 100%;
    height: 400px;
    margin: 16px 0;
}

.chart-container canvas {
    width: 100%;
    height: 100%;
}

/* ========== SCORE CARD STYLING ========== */

.score-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

.score-table {
    width: 100%;
    border-collapse: collapse;
}

.score-table thead {
    background: #bfdbfe;
}

.score-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #1e3a8a;
    border: none;
    background: none;
}

.score-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
    font-size: 14px;
}

.score-table tbody tr:hover {
    background-color: #f9fafb;
}

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

/* ========== MODERN TABLE (REUSABLE) ========== */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    border: 1px solid #e8eef6;
    border-radius: 8px;
    overflow: hidden;
}

.modern-table thead {
    background: #bfdbfe;
}

/* Page scope for Puntuaciones — enforce unified look within that page */
.puntuaciones-page .modern-table thead {
    background: #bfdbfe;
}

.puntuaciones-page .modern-table th {
    color: #1e3a8a;
}

.puntuaciones-page .modern-table td {
    color: #374151;
}

/* Make table headers appear full-bleed inside the card area (touch left/right edges) */
.card .table-responsive {
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
}

.card .modern-table {
    border-radius: 8px;
    margin-left: 0;
    margin-right: 0;
    border: 1px solid #e8eef6;
    /* keep subtle boundary */
}

/* Ensure rounded corners at the top of the table match the card */
.card .modern-table thead th:first-child {
    border-top-left-radius: 8px;
}

.card .modern-table thead th:last-child {
    border-top-right-radius: 8px;
}

/* Prevent the top border from adding a double-bottom look on thead */
.puntuaciones-page .card .modern-table thead th {
    border-bottom: 1px solid #e6eefc;
}

/* Align the table with the card content vertically */
.card .table-responsive {
    padding-top: 0;
    padding-bottom: 16px;
}

.modern-table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 15px;
    color: #1e3a8a;
    border-bottom: 1px solid #e6eefc;
    background-clip: padding-box;
    /* helps rounding with separate borders */
}

.modern-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #eef2f6;
    color: #374151;
}

.modern-table tbody tr:hover {
    background-color: #fbfdff;
}

.modern-table thead th:first-child {
    border-top-left-radius: 8px;
}

.modern-table thead th:last-child {
    border-top-right-radius: 8px;
}

/* Posición column style (numeric) */
.modern-table th.pos,
.modern-table td.pos {
    text-align: center;
    font-weight: 800;
    color: #102a43;
    width: 80px;
}

.modern-table td.score,
.modern-table th.score {
    text-align: right;
    font-weight: 700;
    color: #234e9a;
    /* darker brand color */
}

/* Slight rounded card boundary for large table */
.card .modern-table {
    border-radius: 6px;
}

.modern-table td.operario {
    vertical-align: top;
    font-weight: 600;
}

.card .modern-table th.pos,
.card .modern-table td.pos {
    text-align: center;
}

@media (max-width: 720px) {

    .modern-table th,
    .modern-table td {
        padding: 12px 10px;
    }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Modal for details */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    width: 90%;
    max-width: 900px;
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

.modal-content #modalClose {
    position: absolute;
    right: 12px;
    top: 12px;
    background: transparent;
    border: 0;
    height: 100%;
}

/* ========== SCORE CARD STYLING ========== */

.score-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

.score-table {
    width: 100%;
    border-collapse: collapse;
}

.score-table thead {
    background: #bfdbfe;
}

.score-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #1e3a8a;
    border: none;
    background: none;
}

.score-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
    font-size: 14px;
}

.score-table tbody tr:hover {
    background-color: #f9fafb;
}

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

/* ========== MODERN TABLE (REUSABLE) ========== */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    border: 1px solid #e8eef6;
    border-radius: 8px;
    overflow: hidden;
}

.modern-table thead {
    background: #bfdbfe;
}

/* Page scope for Puntuaciones — enforce unified look within that page */
.puntuaciones-page .modern-table thead {
    background: #bfdbfe;
}

.puntuaciones-page .modern-table th {
    color: #1e3a8a;
}

.puntuaciones-page .modern-table td {
    color: #374151;
}

/* Make table headers appear full-bleed inside the card area (touch left/right edges) */
.card .table-responsive {
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
}

.card .modern-table {
    border-radius: 8px;
    margin-left: 0;
    margin-right: 0;
    border: 1px solid #e8eef6;
    /* keep subtle boundary */
}

/* Ensure rounded corners at the top of the table match the card */
.card .modern-table thead th:first-child {
    border-top-left-radius: 8px;
}

.card .modern-table thead th:last-child {
    border-top-right-radius: 8px;
}

/* Prevent the top border from adding a double-bottom look on thead */
.puntuaciones-page .card .modern-table thead th {
    border-bottom: 1px solid #e6eefc;
}

/* Align the table with the card content vertically */
.card .table-responsive {
    padding-top: 0;
    padding-bottom: 16px;
}

.modern-table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 15px;
    color: #1e3a8a;
    border-bottom: 1px solid #e6eefc;
    background-clip: padding-box;
    /* helps rounding with separate borders */
}

.modern-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #eef2f6;
    color: #374151;
}

.modern-table tbody tr:hover {
    background-color: #fbfdff;
}

.modern-table thead th:first-child {
    border-top-left-radius: 8px;
}

.modern-table thead th:last-child {
    border-top-right-radius: 8px;
}

/* Posición column style (numeric) */
.modern-table th.pos,
.modern-table td.pos {
    text-align: center;
    font-weight: 800;
    color: #102a43;
    width: 80px;
}

.modern-table td.score,
.modern-table th.score {
    text-align: right;
    font-weight: 700;
    color: #234e9a;
    /* darker brand color */
}

/* Slight rounded card boundary for large table */
.card .modern-table {
    border-radius: 6px;
}

.modern-table td.operario {
    vertical-align: top;
    font-weight: 600;
}

.card .modern-table th.pos,
.card .modern-table td.pos {
    text-align: center;
}

@media (max-width: 720px) {

    .modern-table th,
    .modern-table td {
        padding: 12px 10px;
    }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Modal for details */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    width: 90%;
    max-width: 900px;
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

.modal-content #modalClose {
    position: absolute;
    right: 12px;
    top: 12px;
    background: transparent;
    border: 0;
    font-weight: 700;
    font-size: 18px;
    cursor: pointer;
}

@media (max-width: 720px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }

    .section-header .header-actions {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        margin-top: 8px;
    }
}

/* ========== EXPORT DROPDOWN MENU ========== */

.export-dropdown {
    position: relative;
    display: inline-block;
}

.btn-export-toggle {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.2);
}

.btn-export-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.btn-export-toggle i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.export-dropdown.active .btn-export-toggle i {
    transform: rotate(180deg);
}

.export-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 180px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.export-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}

.export-option:last-child {
    border-bottom: none;
}

.export-option:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.04));
    color: var(--brand-secondary);
}

.export-option i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.export-option:first-child {
    border-radius: 8px 8px 0 0;
}

.export-option:last-child {
    border-radius: 0 0 8px 8px;
}

/* ========== PRINT STYLES ========== */

@media print {

    /* Ocultar elementos no necesarios */
    .site-header,
    .footer,
    .main-nav,
    .section-header .header-actions,
    .btn,
    .btn-sm,
    .export-dropdown,
    .filter-card,
    .chart-container,
    canvas {
        display: none !important;
    }

    /* Optimizar página para impresión */
    body {
        background: #ffffff;
        margin: 0;
        padding: 20px;
    }

    .page {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }

    .section-header {
        box-shadow: none;
        border: none;
        background: transparent;
        page-break-after: avoid;
    }

    .section-title {
        color: #0f172a;
        font-size: 18px;
    }

    .section-title i {
        display: none;
    }

    /* Asegurar que las tablas se vean bien */
    table {
        page-break-inside: avoid;
        border-collapse: collapse;
    }

    th,
    td {
        border: 1px solid #cbd5e1;
        padding: 8px;
    }

    th {
        background-color: #f1f5f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Evitar saltos de página dentro de filas */
    tr {
        page-break-inside: avoid;
    }
}

/* ========== FILE UPLOAD MODERN INTERFACE ========== */

.file-upload-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .file-upload-container {
        gap: 12px;
    }
}

.file-upload-zone {
    position: relative;
    background: #fafbfc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 24px 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    overflow: hidden;
}

.file-upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 14px;
}

.file-upload-zone:hover {
    border-color: var(--brand-secondary);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}

.file-upload-zone:hover::before {
    opacity: 0.03;
}

.file-upload-zone.dragover {
    border-color: var(--brand-accent);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(245, 158, 11, 0.2);
}

.file-upload-zone.dragover::before {
    opacity: 0.05;
}

.file-upload-zone.has-file {
    border-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-style: solid;
}

.file-upload-zone.has-file::before {
    background: linear-gradient(135deg, #10b981, #059669);
    opacity: 0.03;
}

.file-upload-zone.error {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

.upload-icon {
    position: relative;
    z-index: 1;
    margin-bottom: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    flex-shrink: 0;
}

.upload-icon i {
    font-size: 24px;
    color: #6366f1;
    transition: all 0.3s ease;
    display: block;
}

.file-upload-zone:hover .upload-icon {
    background: rgba(99, 102, 241, 0.15);
}

.file-upload-zone:hover .upload-icon i {
    transform: scale(1.05);
    color: var(--brand-primary);
}

.file-upload-zone.dragover .upload-icon {
    background: rgba(245, 158, 11, 0.15);
}

.file-upload-zone.dragover .upload-icon i {
    transform: scale(1.1);
    color: var(--brand-accent);
}

.file-upload-zone.has-file .upload-icon {
    background: rgba(16, 185, 129, 0.1);
}

.file-upload-zone.has-file .upload-icon i {
    color: #10b981;
}

.file-upload-zone.error .upload-icon {
    background: rgba(239, 68, 68, 0.1);
}

.file-upload-zone.error .upload-icon i {
    color: #ef4444;
}

.upload-content {
    position: relative;
    z-index: 1;
    flex: 1;
}

.upload-content h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--brand-dark);
    letter-spacing: -0.2px;
}

.upload-content p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    font-weight: 400;
}

.file-upload-zone:hover .upload-content h4 {
    color: var(--brand-primary);
}

.file-upload-zone:hover .upload-content p {
    color: #475569;
}

.file-preview {
    position: relative;
    z-index: 1;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.file-preview i.fa-check-circle {
    color: #10b981;
    font-size: 20px;
    flex-shrink: 0;
}

.file-preview .file-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview .file-size {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
}

.remove-file {
    background: #ef4444;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-weight: 700;
}

.remove-file:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.upload-box form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.upload-box-header {
    text-align: center;
    margin-bottom: 32px;
}

.upload-box-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-box-icon i {
    font-size: 36px;
    color: #6366f1;
}

.upload-box-title {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px 0;
    letter-spacing: -0.5px;
}

.upload-box-description {
    font-size: 14px;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

.upload-box .form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    border-left: 4px solid #ef4444;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message i {
    font-size: 18px;
}

.success-message {
    background: #d1fae5;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    border-left: 4px solid #10b981;
    display: flex;
    align-items: center;
    gap: 8px;
}

.success-message i {
    font-size: 18px;
}

/* Responsive styles for upload box */
@media (max-width: 768px) {
    .upload-box {
        padding: 32px 24px;
        margin: 40px auto 24px;
    }

    .upload-box-icon {
        width: 64px;
        height: 64px;
    }

    .upload-box-icon i {
        font-size: 28px;
    }

    .upload-box-title {
        font-size: 20px;
    }

    .upload-box-description {
        font-size: 13px;
    }

    .file-upload-zone {
        flex-direction: column;
        text-align: center;
        padding: 20px 16px;
    }

    .upload-content {
        text-align: center;
    }

    .btn {
        padding: 12px 24px;
        font-size: 14px;
    }
}