/* =============================================================
   HSEQ PRO - Estilos del sistema
   Paleta: Naranja #FF8904 como color principal
   ============================================================= */

:root {
    --bg: #0b1120;
    --card: #131c2e;
    --card-hover: #192438;
    --border: #1e2d45;
    --accent: #FF8904;
    --accent-dark: #D97300;
    --warn: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --txt: #e2e8f0;
    --muted: #64748b;
    --subtle: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--txt);
    overflow-x: hidden;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--subtle);
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: linear-gradient(180deg, #0d1526 0%, #111d33 100%);
    border-right: 1px solid var(--border);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 13px;
    text-decoration: none;
    user-select: none;
}

.sidebar-item:hover {
    color: var(--txt);
    background: rgba(255, 137, 4, 0.05);
}

.sidebar-item.active {
    color: var(--accent);
    background: rgba(255, 137, 4, 0.08);
    border-left-color: var(--accent);
}

.sidebar-item i {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.sidebar-item .badge-count {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* --- Main --- */
.main-area {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Topbar --- */
.topbar {
    height: 60px;
    background: rgba(11, 17, 32, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
    flex-shrink: 0;
}

.topbar-title {
    font-weight: 700;
    font-size: 15px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-user .dot {
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* --- Content --- */
.content {
    padding: 24px;
    flex: 1;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.content-header p {
    color: var(--muted);
    font-size: 13px;
}

/* --- Stat Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, var(--card) 0%, #172036 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(255, 137, 4, 0.08);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.15;
}

.stat-card.color-green::after {
    background: var(--accent);
}

.stat-card.color-blue::after {
    background: var(--info);
}

.stat-card.color-amber::after {
    background: var(--warn);
}

.stat-card.color-red::after {
    background: var(--danger);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 12px;
}

.stat-icon.green {
    background: rgba(255, 137, 4, 0.12);
    color: var(--accent);
}

.stat-icon.blue {
    background: rgba(14, 165, 233, 0.12);
    color: var(--info);
}

.stat-icon.amber {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warn);
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.stat-value {
    font-family: 'Outfit';
    font-weight: 800;
    font-size: 28px;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

/* --- Cards --- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 14px;
    font-weight: 700;
}

.card-body {
    padding: 20px;
}

/* --- Tablas --- */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    background: #111a2b;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(30, 45, 69, 0.5);
    font-size: 13px;
    color: #cbd5e1;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: rgba(255, 137, 4, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green {
    background: rgba(255, 137, 4, 0.12);
    color: var(--accent);
}

.badge-amber {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warn);
}

.badge-red {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.badge-blue {
    background: rgba(14, 165, 233, 0.12);
    color: var(--info);
}

.badge-gray {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
}

/* --- Botones --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 16px rgba(255, 137, 4, 0.25);
}

.btn-secondary {
    background: var(--border);
    color: #cbd5e1;
}

.btn-secondary:hover {
    background: var(--subtle);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.22);
}

.btn-warn {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warn);
}

.btn-warn:hover {
    background: rgba(245, 158, 11, 0.22);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* --- Formularios --- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--txt);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 137, 4, 0.1);
}

.form-input::placeholder {
    color: #475569;
}

select.form-input {
    cursor: pointer;
}

textarea.form-input {
    resize: vertical;
    min-height: 70px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 20px;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-lg {
    max-width: 720px;
}

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--border);
    color: var(--txt);
}

.modal-body {
    padding: 22px;
}

/* --- Toasts --- */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.3s ease;
    min-width: 280px;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

.toast-success {
    background: #7C3A00;
    border: 1px solid var(--accent);
    color: #FFD4A8;
}

.toast-error {
    background: #7f1d1d;
    border: 1px solid var(--danger);
    color: #fca5a5;
}

.toast-warn {
    background: #78350f;
    border: 1px solid var(--warn);
    color: #fde68a;
}

.toast-info {
    background: #0c4a6e;
    border: 1px solid var(--info);
    color: #bae6fd;
}

@keyframes toast-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- Login --- */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(255, 137, 4, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(14, 165, 233, 0.04) 0%, transparent 50%),
        var(--bg);
    padding: 20px;
}

.login-card {
    background: linear-gradient(135deg, var(--card), #172036);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 40px 36px;
    width: 400px;
    max-width: 100%;
}

.login-logo {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    margin: 0 auto 20px;
}

.login-logo-img {
    display: block;
    margin: 0 auto 20px;
    height: 64px;
    width: auto;
    object-fit: contain;
}

.login-card h1 {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 28px;
}

.login-hint {
    margin-top: 24px;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--muted);
    line-height: 1.6;
}

.login-hint strong {
    color: var(--accent);
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}

.tab:hover {
    color: var(--txt);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* --- Alertas --- */
.alert {
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 8px;
}

.alert-red {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.alert-amber {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fde68a;
}

.alert-green {
    background: rgba(255, 137, 4, 0.08);
    border: 1px solid rgba(255, 137, 4, 0.2);
    color: #FFD4A8;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #475569;
}

.empty-state i {
    font-size: 42px;
    margin-bottom: 12px;
    display: block;
}

.empty-state p {
    font-size: 13px;
}

/* --- File Drop --- */
.file-drop {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 36px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-drop:hover,
.file-drop.dragover {
    border-color: var(--accent);
    background: rgba(255, 137, 4, 0.03);
}

.file-drop i {
    font-size: 28px;
    color: var(--muted);
    margin-bottom: 10px;
}

.file-drop p {
    font-size: 13px;
    color: var(--muted);
}

.file-drop .hint {
    font-size: 11px;
    color: var(--subtle);
    margin-top: 8px;
}

/* --- Chart bars --- */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 140px;
    padding-top: 10px;
}

.chart-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.chart-bar-fill {
    width: 100%;
    border-radius: 3px 3px 0 0;
    transition: height 0.5s ease;
    min-width: 16px;
}

.chart-bar-label {
    font-size: 10px;
    color: var(--muted);
    white-space: nowrap;
}

.chart-bar-value {
    font-size: 11px;
    font-weight: 600;
}

/* --- Progress bar --- */
.progress {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* --- Grid helpers --- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* --- Flex helpers --- */
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-gap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

.text-xs {
    font-size: 11px;
}

.text-sm {
    font-size: 13px;
}

.text-muted {
    color: var(--muted);
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}

.font-bold {
    font-weight: 700;
}

.hidden {
    display: none !important;
}

/* --- Pregunta de prueba --- */
.pregunta-block {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.pregunta-block .q-text {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
}

.opcion-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
}

.opcion-label:hover {
    background: rgba(255, 137, 4, 0.04);
}

.opcion-label input[type="radio"] {
    accent-color: var(--accent);
}

/* --- Capacitacion card --- */
.cap-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
}

.cap-card:hover {
    border-color: var(--info);
    transform: translateY(-2px);
}

.cap-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(14, 165, 233, 0.1);
    color: var(--info);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.cap-card h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.cap-card p {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
}

.cap-file {
    font-size: 12px;
    color: var(--info);
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* --- Pulse dot animado --- */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}

/* --- Space between items --- */
.space-y-2>*+* {
    margin-top: 8px;
}

.space-y-3>*+* {
    margin-top: 12px;
}

.space-y-4>*+* {
    margin-top: 16px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .content {
        padding: 16px;
    }
}