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

:root {
    --nexus-primary: #2563eb;
    --nexus-secondary: #1e293b;
    --nexus-border: #d6deeb;
    --nexus-text: #172033;
    --nexus-muted: #64748b;
    --nexus-sidebar: #e8edf2;
    --nexus-sidebar-soft: #dce4ec;
    --nexus-surface: rgba(255, 255, 255, 0.94);
    --nexus-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

body {
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.10), transparent 22rem),
        linear-gradient(180deg, #f4f7fb 0%, #eef3f9 100%);
    color: var(--nexus-text);
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.35;
}

h1 {
    font-size: 20px;
}

h2 {
    font-size: 18px;
}

h3 {
    font-size: 16px;
}

.content-wrapper {
    background: transparent;
    padding: 10px;
}

.main-sidebar {
    background: linear-gradient(180deg, var(--nexus-sidebar) 0%, var(--nexus-sidebar-soft) 100%);
}

.main-sidebar,
.main-sidebar .brand-link,
.main-sidebar .brand-link .brand-text,
.main-sidebar .nav-header,
.main-sidebar .nav-sidebar .nav-link,
.main-sidebar .nav-sidebar .nav-link p,
.main-sidebar .nav-sidebar .nav-link i {
    color: var(--nexus-text) !important;
}

.brand-link {
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(23, 32, 51, 0.08);
}

.brand-link .brand-text {
    font-weight: 800 !important;
    letter-spacing: -0.03em;
}

.main-sidebar .nav-sidebar .nav-link {
    border-radius: 0.7rem;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.main-sidebar .nav-sidebar .nav-link:hover {
    background: rgba(37, 99, 235, 0.08);
    color: #1744af !important;
}

.main-sidebar .nav-sidebar .nav-link.active {
    background: rgba(37, 99, 235, 0.12);
    color: #1744af !important;
    border-radius: 0.7rem;
}

.main-sidebar .nav-link.is-disabled,
.main-sidebar .nav-link.is-disabled:hover {
    opacity: 0.55;
    cursor: not-allowed;
    background: transparent;
    color: var(--nexus-muted) !important;
}

.main-sidebar .nav-treeview {
    background: rgba(255, 255, 255, 0.36);
    border-radius: 0.8rem;
    margin: 0.25rem 0 0.25rem 0.3rem;
    padding: 0.2rem;
}

.main-header.navbar {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(214, 222, 235, 0.9);
}

.content-header {
    padding: 0.4rem 0.6rem 0;
}

.nexus-shell {
    padding-bottom: 0.4rem;
}

.nexus-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.55rem;
    padding: 0 0 0.45rem;
}

.nexus-kicker {
    display: inline-block;
    margin-bottom: 0.25rem;
    color: var(--nexus-primary);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nexus-version-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 0.35rem;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}

.nexus-page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.nexus-page-subtitle {
    max-width: 52rem;
    color: var(--nexus-muted);
    font-size: 0.8rem;
    line-height: 1.3;
}

.nexus-header-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.module-action-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    max-width: 100%;
}

.module-action-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.module-action-group--base {
    padding-top: 0.35rem;
    border-top: 1px solid rgba(214, 222, 235, 0.95);
}

.nexus-panel,
.nexus-subpanel,
.nexus-empty {
    border: 1px solid rgba(214, 222, 235, 0.95);
    border-radius: 0.9rem;
    background: var(--nexus-surface);
    box-shadow: var(--nexus-shadow);
}

.nexus-panel {
    height: calc(100% - 0.45rem);
    margin-bottom: 0.45rem;
    padding: 0.6rem 0.75rem;
}

.nexus-panel--flush {
    padding: 0;
}

.nexus-panel-primary {
    color: #fff;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 52%, #0ea5e9 100%);
    border-color: transparent;
}

.nexus-panel-primary .nexus-muted,
.nexus-panel-primary .nexus-panel-label {
    color: rgba(255, 255, 255, 0.82);
}

.nexus-panel-label {
    color: var(--nexus-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nexus-metric {
    margin-top: 0.18rem;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
}

.nexus-metric-sm {
    margin-top: 0.15rem;
    font-size: 0.98rem;
    font-weight: 800;
}

.nexus-muted {
    color: var(--nexus-muted);
}

.nexus-section-title {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 700;
}

.nexus-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.55rem;
    margin-bottom: 0.5rem;
}

.nexus-card-head__actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.nexus-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid transparent;
    border-radius: 0.7rem;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nexus-action-btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.nexus-action-btn__icon {
    font-size: 0.82rem;
}

.nexus-action-btn--sm {
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 0.58rem;
}

.nexus-action-btn--primary {
    background: var(--nexus-primary);
    color: #fff;
}

.nexus-action-btn--secondary {
    background: #e8eef8;
    color: #1f3a68;
}

.nexus-action-btn--light {
    background: #fff;
    color: var(--nexus-secondary);
    border-color: rgba(214, 222, 235, 0.95);
}

.nexus-action-btn--danger {
    background: #dc2626;
    color: #fff;
}

.nexus-action-btn--outline-primary,
.nexus-action-btn--outline-secondary,
.nexus-action-btn--outline-danger {
    background: transparent;
}

.nexus-action-btn--outline-primary {
    color: var(--nexus-primary);
    border-color: rgba(37, 99, 235, 0.28);
}

.nexus-action-btn--outline-secondary {
    color: #475569;
    border-color: rgba(100, 116, 139, 0.32);
}

.nexus-action-btn--outline-danger {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.25);
}

.nexus-action-btn[disabled],
.nexus-action-btn[aria-disabled='true'] {
    opacity: 0.55;
    pointer-events: none;
}

.nexus-link {
    color: var(--nexus-primary);
    font-weight: 700;
    font-size: 0.82rem;
}

.nexus-link:hover {
    color: #1d4ed8;
    text-decoration: none;
}

.nexus-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: #e0ebff;
    color: #1848b5;
    font-size: 0.72rem;
    font-weight: 700;
}

.nexus-chip-soft {
    background: #edf2f7;
    color: #334155;
}

.nexus-chip-success {
    background: #dcfce7;
    color: #15803d;
}

.nexus-chip-warning {
    background: #fef3c7;
    color: #b45309;
}

.nexus-kpi-card {
    height: calc(100% - 0.45rem);
    margin-bottom: 0.45rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(214, 222, 235, 0.95);
    background: var(--nexus-surface);
    box-shadow: var(--nexus-shadow);
}

.nexus-kpi-card--accent {
    color: #fff;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 52%, #0ea5e9 100%);
    border-color: transparent;
}

.nexus-kpi-card--accent .nexus-panel-label,
.nexus-kpi-card--accent .nexus-muted,
.nexus-kpi-card--accent .nexus-chip-soft {
    color: rgba(255, 255, 255, 0.86);
    background: rgba(255, 255, 255, 0.14);
}

.nexus-kpi-card__top,
.nexus-kpi-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.nexus-kpi-card__footer {
    margin-top: 0.35rem;
}

.nexus-kpi-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.95rem;
    height: 1.95rem;
    border-radius: 0.75rem;
    background: rgba(37, 99, 235, 0.1);
    color: var(--nexus-primary);
    font-size: 0.8rem;
}

.nexus-kpi-card--accent .nexus-kpi-card__icon {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.kpi-card,
.nexus-kpi-card.kpi-card {
    border-radius: 0.85rem;
}

.kpi-card-primary:not(.nexus-kpi-card--accent),
.nexus-kpi-card.kpi-card-primary:not(.nexus-kpi-card--accent) {
    border-color: rgba(37, 99, 235, 0.22);
}

.kpi-card-primary:not(.nexus-kpi-card--accent) .nexus-kpi-card__icon,
.nexus-kpi-card.kpi-card-primary:not(.nexus-kpi-card--accent) .nexus-kpi-card__icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.kpi-card-warning,
.nexus-kpi-card.kpi-card-warning {
    border-color: rgba(245, 158, 11, 0.32);
}

.kpi-card-warning .nexus-kpi-card__icon,
.nexus-kpi-card.kpi-card-warning .nexus-kpi-card__icon {
    background: #fef3c7;
    color: #b45309;
}

.kpi-card-success,
.nexus-kpi-card.kpi-card-success {
    border-color: rgba(22, 163, 74, 0.24);
}

.kpi-card-success .nexus-kpi-card__icon,
.nexus-kpi-card.kpi-card-success .nexus-kpi-card__icon {
    background: #dcfce7;
    color: #15803d;
}

.kpi-card-danger,
.nexus-kpi-card.kpi-card-danger {
    border-color: rgba(220, 38, 38, 0.24);
}

.kpi-card-danger .nexus-kpi-card__icon,
.nexus-kpi-card.kpi-card-danger .nexus-kpi-card__icon {
    background: #fee2e2;
    color: #b91c1c;
}

.nexus-subpanel {
    padding: 0.55rem 0.65rem;
    height: 100%;
}

.table td,
.table th {
    padding: 6px 8px;
}

.nexus-table thead th {
    border-top: 0;
    border-bottom: 1px solid var(--nexus-border);
    color: var(--nexus-muted);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.nexus-table tbody td {
    border-color: rgba(214, 222, 235, 0.75);
    vertical-align: middle;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    font-size: 0.79rem;
}

.table-compact td,
.table-compact th {
    padding: 5px 7px;
}

.nexus-table tbody tr {
    transition: background-color 0.16s ease;
}

.nexus-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.035);
}

.nexus-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.24rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
}

.status-badge {
    min-width: 5.6rem;
    justify-content: center;
}

.nexus-status-planned {
    background: #dbeafe;
    color: #1d4ed8;
}

.nexus-status-pendiente,
.nexus-status-planificada {
    background: #dbeafe;
    color: #1d4ed8;
}

.nexus-status-in_progress {
    background: #fef3c7;
    color: #b45309;
}

.nexus-status-en_proceso,
.nexus-status-setup {
    background: #fef3c7;
    color: #b45309;
}

.nexus-status-completed {
    background: #dcfce7;
    color: #15803d;
}

.nexus-status-finalizado,
.nexus-status-finalizada,
.nexus-status-activa {
    background: #dcfce7;
    color: #15803d;
}

.nexus-status-cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

.nexus-status-cancelado,
.nexus-status-cancelada,
.nexus-status-anulada,
.nexus-status-detenida,
.nexus-status-inactiva {
    background: #fee2e2;
    color: #b91c1c;
}

.nexus-status-mantenimiento {
    background: #f1f5f9;
    color: #475569;
}

.nexus-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nexus-list-item,
.nexus-insight {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
    padding: 0.45rem 0.55rem;
    border: 1px solid rgba(214, 222, 235, 0.85);
    border-radius: 0.8rem;
    background: #f8fbff;
}

.nexus-insight strong {
    font-size: 1.02rem;
}

.nexus-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.45rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(214, 222, 235, 0.95);
    border-radius: 0.95rem;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 249, 255, 0.92) 100%),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.1), transparent 15rem);
    box-shadow: var(--nexus-shadow);
}

.nexus-hero__title {
    margin: 0;
    font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.35rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.nexus-shortcuts {
    display: grid;
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    gap: 0.4rem;
    min-width: min(100%, 260px);
}

.nexus-shortcut {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(214, 222, 235, 0.95);
    background: #fff;
    color: var(--nexus-text);
    font-weight: 600;
    font-size: 0.75rem;
    text-decoration: none;
}

.nexus-shortcut--primary {
    grid-column: 1 / -1;
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.18);
}

.nexus-shortcut--primary i,
.nexus-shortcut--primary:hover,
.nexus-shortcut--primary:hover i {
    color: #fff;
}

.nexus-shortcut:hover {
    color: var(--nexus-primary);
    text-decoration: none;
    border-color: rgba(37, 99, 235, 0.22);
}

.nexus-shortcut i {
    color: var(--nexus-primary);
}

.nexus-shortcut--primary:hover,
.nexus-shortcut--primary:hover i {
    color: #fff;
    border-color: #1d4ed8;
}

.nexus-stack-panel {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.nexus-empty {
    padding: 0.8rem 0.75rem;
    text-align: center;
}

.nexus-empty.compact {
    padding: 0.55rem;
}

.card-body {
    padding: 8px;
}

.small-box {
    padding: 6px;
}

.small-box h3 {
    font-size: 16px;
}

.btn {
    padding: 4px 10px;
    font-size: 13px;
}

.compact-mode .main-sidebar {
    width: 230px;
}

.compact-mode.sidebar-collapse .main-sidebar,
.compact-mode.sidebar-collapse .main-sidebar::before {
    margin-left: -230px;
}

.compact-mode .content-wrapper,
.compact-mode .main-footer,
.compact-mode .main-header {
    margin-left: 0;
}

.compact-mode .content {
    padding: 0 0.45rem;
}

.compact-mode .row {
    margin-left: -4px;
    margin-right: -4px;
}

.compact-mode .row > [class*='col-'] {
    padding-left: 4px;
    padding-right: 4px;
}

.compact-mode .form-group {
    margin-bottom: 0.45rem;
}

.compact-mode .alert {
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.45rem;
}

.compact-mode .pagination {
    margin-bottom: 0;
}

.production-dashboard-kpis .nexus-kpi-card {
    padding: 0.4rem 0.5rem;
}

.production-dashboard-kpis .nexus-panel-label {
    font-size: 0.6rem;
}

.production-dashboard-kpis .nexus-metric {
    font-size: 1rem;
}

.production-dashboard-kpis .nexus-muted {
    font-size: 0.72rem;
}

.production-dashboard-kpis .nexus-kpi-card__icon {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.72rem;
}

.production-dashboard-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.2rem;
    align-items: center;
    padding: 0.45rem 0.65rem;
    font-size: 13px;
}

.production-dashboard-metric-card {
    min-height: 4.9rem;
}

.production-dashboard-metric-card strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1rem;
}

.production-dashboard-metric-card.is-warning {
    border-color: rgba(245, 158, 11, 0.35);
}

.production-dashboard-metric-card.is-success {
    border-color: rgba(22, 163, 74, 0.28);
}

.production-dashboard-metric-card.is-danger {
    border-color: rgba(220, 38, 38, 0.3);
}

.machine-performance-list {
    display: grid;
    gap: 0.45rem;
}

.machine-performance-card {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: center;
    padding: 0.55rem 0.65rem;
    border: 1px solid rgba(214, 222, 235, 0.85);
    border-radius: 0.8rem;
    background: #f8fbff;
}

.machine-efficiency-track {
    width: 7rem;
    height: 0.35rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.machine-efficiency-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #2563eb;
}

.text-muted-small {
    color: var(--nexus-muted);
    font-size: 0.72rem;
}

.production-dashboard-table td,
.production-dashboard-table th {
    padding: 5px 6px;
    font-size: 13px;
}

.reportes-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
}

.reportes-filter-panel form {
    row-gap: 0.55rem;
}

.reportes-filter-panel label {
    margin-bottom: 0.2rem;
    color: var(--nexus-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.reportes-filter-panel .btn {
    white-space: nowrap;
}

.nexus-panel > .nexus-table {
    min-width: 680px;
}

@media (max-width: 991.98px) {
    .nexus-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nexus-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .module-action-bar {
        align-items: stretch;
        width: 100%;
    }

    .module-action-group {
        justify-content: flex-start;
    }

    .nexus-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .nexus-shortcuts {
        width: 100%;
        min-width: 0;
    }

    .compact-mode .content {
        padding: 0 0.25rem;
    }

    .nexus-panel,
    .nexus-kpi-card {
        padding: 0.55rem 0.65rem;
    }

    .nexus-panel:has(> .nexus-table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .content-wrapper {
        padding: 6px;
    }
}

@media (max-width: 575.98px) {
    .module-action-group {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.15rem;
    }

    .module-action-group .nexus-action-btn {
        flex: 0 0 auto;
    }

    .reportes-subnav {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.2rem;
    }

    .reportes-subnav .btn,
    .reportes-filter-panel .btn {
        flex: 0 0 auto;
    }

    .reportes-filter-panel form .d-flex {
        width: 100%;
        align-items: stretch;
    }

    .reportes-filter-panel form .d-flex .btn {
        flex: 1 1 0;
        min-width: 0;
    }

    .dashboard-kpi-grid .col-6,
    .production-dashboard-kpis .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .status-badge {
        min-width: 0;
    }
}
