:root {
    --production-sidebar-width: 250px;
    --production-header-height: 80px;
    --production-primary: #5955d1;
    --production-heading: #0c243c;
    --production-text: #696981;
    --production-muted: #97a1c0;
    --production-border: #eeeef3;
    --production-soft: #f7f7fb;
    --production-page: #fdfdff;
}

body.app-shell-body {
    background: var(--production-page);
    color: var(--production-text);
}

.page-layout {
    min-height: 100vh;
}

.auth-shell {
    background: linear-gradient(135deg, #fdfdff 0%, #f2f2f6 45%, #f5f5fc 100%);
}

.auth-card {
    width: min(1080px, 100%);
    background: #fff;
    border: 1px solid var(--production-border);
    border-radius: 10px !important;
}

.auth-side-panel {
    background: linear-gradient(155deg, #0c243c 0%, #5955d1 58%, #7008e7 100%);
}

.app-production-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--production-sidebar-width);
    background: #fff;
    border-right: 1px solid var(--production-border);
    z-index: 1040;
    transition: left .3s ease, transform .3s ease;
    box-shadow: 0 30px 30px 10px rgba(0, 0, 0, .02);
}

.production-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.production-brand {
    height: var(--production-header-height);
    display: flex;
    align-items: center;
    padding: 15px 22px;
    border-bottom: 1px solid var(--production-border);
}

.production-brand-link {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 14px;
    text-decoration: none;
}

.production-brand-logo-wrap,
.production-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    flex: 0 0 42px;
}

.production-brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--production-border);
    background: #fff;
}

.production-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--production-primary);
    font-weight: 700;
    letter-spacing: 0;
}

.production-brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: .32rem;
}

.production-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.production-brand-text strong {
    color: var(--production-heading);
    font-size: 1.08rem;
    line-height: 1.15;
    white-space: nowrap;
}

.production-brand-text small {
    color: var(--production-text);
    font-size: .86rem;
    line-height: 1.3;
}

.production-nav {
    flex: 1;
    padding: 8px 15px 20px;
    overflow-y: auto;
}

.production-menubar {
    list-style: none;
    padding: 0;
    margin: 0;
}

.production-menubar > li {
    display: block;
}

.production-menubar .menu-heading {
    color: var(--production-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    padding: 16px 0 9px 0;
    margin: 0;
}

.production-menubar .menu-item + .menu-item {
    margin-top: 5px;
}

.production-menubar .menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border-radius: 8px;
    padding: 9px 0;
    color: var(--production-heading);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: color .18s ease, background-color .18s ease, padding .18s ease;
}

.production-menubar .menu-link > i {
    display: inline-flex;
    width: 18px;
    justify-content: center;
    color: var(--production-text);
    font-size: 18px;
    line-height: 1;
}

.production-menubar .menu-link:hover,
.production-menubar .menu-link.active {
    color: var(--production-primary);
}

.production-menubar .menu-link:hover > i,
.production-menubar .menu-link.active > i {
    color: var(--production-primary);
}

.app-header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--production-sidebar-width);
    width: auto;
    height: var(--production-header-height);
    padding-left: 0;
    margin-left: 0;
    z-index: 1030;
    background: var(--production-page);
    border-bottom: 1px solid var(--production-border);
    backdrop-filter: none;
}

.app-header-inner {
    width: 100%;
    height: 100%;
    min-height: var(--production-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.app-header-start h6,
.app-page-head h3,
.card-header h6 {
    color: var(--production-heading);
    font-weight: 700;
}

.app-header-start small,
.app-page-head p {
    color: var(--production-text) !important;
}

.app-header-end {
    display: flex;
    align-items: center;
}

.app-toggler {
    width: 32px;
    height: 32px;
    margin: 0 12px 0 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--production-border);
    border-radius: 8px !important;
    background: #fff;
    color: var(--production-heading);
    box-shadow: 0 3px 10px rgba(12, 36, 60, .04);
}

.app-wrapper {
    margin-left: var(--production-sidebar-width);
    margin-top: var(--production-header-height);
    padding: 35px 35px 30px;
    min-height: calc(100vh - var(--production-header-height));
    background: var(--production-page);
}

.app-page-head {
    min-height: 42px;
    margin-bottom: 24px;
}

.app-page-head h3 {
    font-size: 1.55rem;
}

.card {
    border: 1px solid var(--production-border);
    border-radius: 8px;
    box-shadow: none;
}

.card-header {
    padding: 18px 20px 10px;
    background: #fff;
}

.card-body {
    padding: 20px;
}

.metric-card {
    position: relative;
    overflow: hidden;
    min-height: 132px;
    border: 1px solid var(--production-border) !important;
    border-radius: 8px;
    background: #fff;
}

.metric-card::after {
    content: "";
    position: absolute;
    right: -22px;
    bottom: -26px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    opacity: .9;
}

.metric-card .card-body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 22px;
}

.metric-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.metric-card .metric-label,
.metric-card span {
    color: var(--production-heading);
    font-size: .88rem;
    font-weight: 700;
}

.metric-card h3,
.metric-card.mini strong,
.metric-card.comparison strong {
    display: block;
    color: var(--production-heading);
    font-size: 1.42rem;
    font-weight: 800;
    line-height: 1.08;
    word-break: normal;
    overflow-wrap: normal;
}

.metric-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bs-primary-bg-subtle);
    color: var(--production-primary) !important;
    flex: 0 0 30px;
}

.metric-icon i {
    line-height: 1;
}

.metric-card-danger .metric-icon,
.metric-card-danger::after {
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger) !important;
}

.metric-card-warning .metric-icon,
.metric-card-warning::after {
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning) !important;
}

.metric-card-success .metric-icon,
.metric-card-success::after {
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success) !important;
}

.metric-card-info .metric-icon,
.metric-card-info::after {
    background: var(--bs-info-bg-subtle);
    color: var(--bs-info) !important;
}

.metric-card-dark .metric-icon,
.metric-card-dark::after {
    background: var(--bs-dark-bg-subtle);
    color: var(--bs-dark) !important;
}

.metric-card.mini,
.metric-card.comparison {
    padding: 18px 20px;
}

.metric-card.mini strong,
.metric-card.comparison strong {
    margin-top: .35rem;
    font-size: 1.24rem;
}

.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    flex-wrap: wrap;
}

.dashboard-toolbar-meta {
    margin-right: .25rem;
}

.dashboard-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem;
    flex-wrap: wrap;
}

.dashboard-range-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--bs-info-bg-subtle);
    color: var(--bs-info);
    font-weight: 700;
}

.quick-range-group {
    padding: 4px;
    border-radius: 999px;
    background: var(--bs-light);
}

.quick-range-group .btn {
    min-width: 78px;
    border: 0;
    border-radius: 999px !important;
    color: var(--production-heading);
    font-weight: 700;
}

.quick-range-group .btn.btn-primary {
    color: var(--production-heading);
    background: #fff;
    box-shadow: 0 3px 10px rgba(12, 36, 60, .06);
}

.quick-range-group .btn.btn-outline-secondary {
    background: transparent;
}

.filter-toggle-btn,
.btn {
    border-radius: 8px;
    font-weight: 700;
}

.filter-toggle-btn {
    min-width: 118px;
    color: var(--production-heading);
    border-color: var(--production-border);
    background: #fff;
}

.filters-dropdown-menu {
    width: min(420px, calc(100vw - 32px));
    border: 1px solid var(--production-border);
    border-radius: 8px;
    box-shadow: 0 .26rem 1.126rem rgba(45, 42, 60, .12);
}

.form-label {
    color: var(--production-heading);
    font-weight: 700;
}

.form-control,
.form-select {
    min-height: 38px;
    border-color: var(--production-border);
    border-radius: 8px;
    font-weight: 600;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--production-primary);
    box-shadow: 0 0 0 .1rem rgba(89, 85, 209, .16);
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 12px 14px;
}

.table thead th {
    background: var(--bs-light);
    color: #000;
    font-weight: 800;
    border-bottom: 0;
    white-space: nowrap;
}

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

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

.table tbody td {
    color: var(--production-text);
    font-weight: 600;
}

.table tbody tr:hover td {
    background: #fbfbff;
}

.badge {
    border-radius: 6px;
    padding: .45rem .72rem;
    font-weight: 800;
}

.status-abierto {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

.status-cerrado {
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success);
}

.status-cancelado {
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger);
}

.table-report th,
.table-report td {
    min-width: 120px;
    vertical-align: middle;
}

.report-form-shell .card {
    box-shadow: none;
}

.detail-list dt {
    color: var(--production-muted);
}

.company-logo-preview {
    max-width: 220px;
    max-height: 80px;
    object-fit: contain;
}

.pagination {
    gap: 6px;
}

.page-link {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px !important;
    font-weight: 700;
}

.app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 36, 60, .36);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease;
    z-index: 1035;
}

@media (max-width: 1199.98px) {
    .app-production-sidebar {
        left: -260px;
    }

    body.sidebar-open .app-production-sidebar {
        left: 0;
    }

    body.sidebar-open .app-sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }

    .app-header {
        left: 0;
    }

    .app-wrapper {
        margin-left: 0;
    }
}

@media (max-width: 991.98px) {
    .app-wrapper {
        padding: 24px 20px 28px;
    }

    .app-header-inner {
        padding: 0 18px;
    }

    .app-page-head {
        align-items: flex-start !important;
    }

    .dashboard-toolbar {
        width: 100%;
        justify-content: stretch;
    }

    .dashboard-toolbar-meta,
    .dashboard-toolbar-actions,
    .quick-range-group,
    .filter-toggle-btn {
        width: 100%;
    }

    .dashboard-toolbar-actions {
        align-items: stretch;
    }

    .quick-range-group {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filters-dropdown-menu {
        width: calc(100vw - 40px);
    }
}

@media (max-width: 575.98px) {
    .app-wrapper {
        padding: 18px 12px 24px;
    }

    .app-page-head h3 {
        font-size: 1.25rem;
    }

    .metric-card h3 {
        font-size: 1.25rem;
    }
}

.production-donut-wrap {
    max-width: 230px;
}

.production-donut-legend {
    color: var(--production-text);
    font-weight: 700;
}

.production-donut-legend strong {
    min-width: 44px;
    color: var(--production-heading);
}

.chart-dot {
    display: inline-flex;
    width: 13px;
    height: 13px;
    border-radius: 999px;
    flex: 0 0 13px;
}

.production-chart-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: #fff;
    border-top: 1px solid var(--production-border);
    color: var(--production-text);
    font-weight: 700;
}

.production-chart-footer strong {
    color: var(--production-heading);
    font-size: 1.05rem;
}

.production-bar-chart-body {
    height: 340px;
}

.comparison-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.comparison-hero {
    overflow: hidden;
    position: relative;
}

.comparison-hero::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -120px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(89, 85, 209, .14), rgba(2, 180, 250, .08));
}

.comparison-hero .card-body {
    position: relative;
    z-index: 1;
}

.comparison-hero .btn {
    white-space: nowrap;
}

.comparison-eyebrow {
    display: inline-flex;
    color: var(--production-primary);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 7px;
}

.comparison-summary-card {
    position: relative;
    overflow: hidden;
}

.comparison-summary-card::after {
    content: "";
    position: absolute;
    right: -34px;
    bottom: -42px;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: #f2f2fb;
}

.comparison-summary-card .card-body {
    position: relative;
    z-index: 1;
}

.comparison-summary-card span,
.comparison-summary-card small {
    display: block;
    color: var(--production-text);
    font-weight: 700;
}

.comparison-summary-card strong {
    display: block;
    color: var(--production-heading);
    font-size: 1.32rem;
    line-height: 1.2;
    margin-top: 12px;
    word-break: break-word;
}

.comparison-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: var(--production-primary);
    background: rgba(89, 85, 209, .1);
    margin-bottom: 14px;
}

.comparison-delta,
.comparison-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--bs-light);
    color: var(--production-primary);
    font-weight: 800;
}

.comparison-delta {
    margin-top: 12px;
}

.comparison-positive {
    color: var(--bs-success) !important;
}

.comparison-negative {
    color: var(--bs-danger) !important;
}

.comparison-driver-table td:last-child {
    min-width: 240px;
}

.comparison-insight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.comparison-insight {
    min-height: 154px;
    padding: 18px;
    border: 1px solid var(--production-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 28px rgba(45, 42, 60, .03);
}

.comparison-insight span {
    display: block;
    color: var(--production-text);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.comparison-insight strong {
    display: block;
    color: var(--production-heading);
    font-size: 1.1rem;
    line-height: 1.2;
    margin-bottom: 10px;
}

.comparison-insight p {
    color: var(--production-text);
    font-weight: 600;
    line-height: 1.45;
    margin: 0;
}

.comparison-insight-primary {
    background: linear-gradient(135deg, rgba(89, 85, 209, .12), #fff 58%);
}

.comparison-insight-success {
    background: linear-gradient(135deg, rgba(34, 176, 126, .12), #fff 58%);
}

.comparison-insight-warning {
    background: linear-gradient(135deg, rgba(253, 187, 31, .16), #fff 58%);
}

.comparison-insight-danger {
    background: linear-gradient(135deg, rgba(255, 64, 28, .12), #fff 58%);
}

.comparison-insight-info {
    background: linear-gradient(135deg, rgba(2, 180, 250, .12), #fff 58%);
}

.comparison-insight-dark {
    background: linear-gradient(135deg, rgba(12, 36, 60, .1), #fff 58%);
}

.comparison-driver-list {
    display: grid;
    gap: 10px;
}

.comparison-driver-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--production-soft);
}

.comparison-driver-item strong,
.comparison-driver-item b {
    display: block;
    color: var(--production-heading);
    font-size: .95rem;
}

.comparison-driver-item span {
    display: block;
    color: var(--production-text);
    font-weight: 700;
    margin-top: 4px;
}

.comparison-table-card .card-body {
    padding-top: 18px;
}

.comparison-table {
    min-width: 1320px;
}

.comparison-table th,
.comparison-table td {
    font-size: .88rem;
}

.comparison-table td:first-child {
    min-width: 180px;
}

.inventory-chart-body,
.inventory-radar-body,
.waste-chart-body,
.waste-radar-body {
    height: 360px;
    position: relative;
}

.inventory-radar-body,
.waste-radar-body {
    display: flex;
    flex-direction: column;
}

.inventory-chart-body canvas,
.waste-chart-body canvas {
    max-height: 320px;
}

.inventory-radar-body canvas,
.waste-radar-body canvas {
    flex: 0 0 300px;
    max-height: 300px;
}

.inventory-radar-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding-top: 8px;
    color: var(--production-text);
    font-weight: 700;
}

.inventory-radar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.inventory-radar-legend i {
    display: inline-flex;
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.inventory-table-card .card-body {
    padding-top: 18px;
}

@media (max-width: 1199.98px) {
    .comparison-insight-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .comparison-actions,
    .comparison-actions .btn {
        width: 100%;
    }

    .comparison-hero .btn {
        width: 100%;
    }

    .comparison-driver-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .production-bar-chart-body {
        height: 300px;
    }
}
