:root {
    /* Colors */
    --primary: #6A1B9A;
    /* Purple */
    --primary-light: #9C27B0;
    --primary-dark: #4A148C;
    --success: #2E7D32;
    /* Green */
    --success-light: #43A047;
    --danger: #D32F2F;
    --warning: #F57C00;
    --na-color: #757575;

    --bg-color: #F8F9FA;
    --surface: #FFFFFF;
    --text-main: #212121;
    --text-muted: #757575;
    --border-color: rgba(0, 0, 0, 0.08);

    --sidebar-width: 260px;
    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: transparent;
    /* Permite ver el canvas */
    overflow-x: hidden;
    height: 100vh;
}

/* Background Canvas */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-color: var(--bg-color);
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    backdrop-filter: blur(2px);
    /* Ligero desenfoque sobre el canvas */
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.03);
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
}

.logo-container img {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
}

#no-logo-text {
    font-size: 24px;
    color: var(--primary);
    font-weight: 700;
    line-height: 1.2;
}

#no-logo-text i {
    font-size: 32px;
    margin-bottom: 5px;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.sidebar-header p {
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.nav-item i {
    width: 24px;
    margin-right: 10px;
    font-size: 18px;
}

.nav-item:hover,
.nav-item.active {
    background-color: rgba(106, 27, 154, 0.05);
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.user-info i {
    font-size: 32px;
    color: var(--primary-light);
    margin-right: 12px;
}

.user-info span {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.user-info small {
    color: var(--text-muted);
    font-size: 12px;
}

.sync-status {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f0f0f0;
    color: #666;
}

.sync-status.online {
    background: rgba(46, 125, 50, 0.1);
    color: var(--success);
}

.sync-status.offline {
    background: rgba(211, 47, 47, 0.1);
    color: var(--danger);
}

.sync-status i {
    margin-right: 8px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    padding: 0 40px 40px 40px;
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
}

#menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary);
    cursor: pointer;
}

.mobile-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
    padding-top: 40px;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    margin-bottom: 30px;
}

.view-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.view-header p {
    color: var(--text-muted);
    font-size: 15px;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 25px;
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-main);
}

.chart-container-pie {
    position: relative;
    height: 220px;
    width: 100%;
}

.chart-container-bar {
    position: relative;
    height: 300px;
    width: 100%;
}

.global-score {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.global-score h2 {
    font-size: 36px;
    font-weight: 700;
    color: var(--success);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(106, 27, 154, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(106, 27, 154, 0.3);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-light);
}

.btn-secondary {
    background-color: #E0E0E0;
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #BDBDBD;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-main);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    font-size: 14px;
    vertical-align: middle;
}

/* Audit Form Styles */
.section-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    background: #fff;
}

.section-header {
    background: rgba(106, 27, 154, 0.05);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.section-header:hover {
    background: rgba(106, 27, 154, 0.08);
}

.section-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--primary-dark);
}

.section-body {
    padding: 20px;
    display: none;
}

.section-body.open {
    display: block;
    border-top: 1px solid var(--border-color);
}

.inciso-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 0;
    border-bottom: 1px dashed var(--border-color);
}

.inciso-row:last-child {
    border-bottom: none;
}

.inciso-text {
    flex: 1;
    padding-right: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.inciso-id {
    font-weight: 600;
    color: var(--primary);
    margin-right: 5px;
}

.inciso-controls {
    display: flex;
    gap: 10px;
    min-width: 200px;
    justify-content: flex-end;
}

.eval-btn {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

.eval-btn:hover {
    background: #f0f0f0;
}

.eval-btn[data-val="1"].selected {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.eval-btn[data-val="0"].selected {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.eval-btn[data-val="na"].selected {
    background: var(--na-color);
    color: white;
    border-color: var(--na-color);
}

.findings-box {
    margin-top: 15px;
    padding: 15px;
    background: #FFF5F5;
    border-left: 4px solid var(--danger);
    border-radius: 4px;
    display: none;
}

/* Utils */
.mb-20 {
    margin-bottom: 20px;
}

.pb-20 {
    padding-bottom: 20px;
}

/* Responsive */
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        height: 100%;
    }

    .sidebar.open {
        left: 0;
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        padding: 0 15px 30px 15px;
    }

    .view {
        padding-top: 20px;
    }

    .inciso-row {
        flex-direction: column;
    }

    .inciso-controls {
        margin-top: 15px;
        justify-content: flex-start;
        width: 100%;
    }
}

/* Login */
.login-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
    z-index: 1000;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 400px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.login-logo {
    margin-bottom: 25px;
}

.login-logo h2 {
    font-size: 22px;
    color: var(--primary-dark);
    margin-top: 15px;
}

.login-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
}

.login-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.1);
}

/* Modales */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.modal-content textarea,
.modal-content input,
.modal-content select {
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 15px;
}

.modal-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-main);
}