:root {
    --v2-bg: #f4f7fb;
    --v2-surface: #ffffff;
    --v2-surface-soft: #f8fafc;
    --v2-primary: #0057a8;
    --v2-primary-dark: #0f2f57;
    --v2-accent: #20b15a;
    --v2-warning: #f59e0b;
    --v2-danger: #dc3545;
    --v2-text: #1f2937;
    --v2-muted: #64748b;
    --v2-border: #e2e8f0;
    --v2-shadow: 0 14px 36px rgba(15, 47, 87, .08);
    --v2-radius: 14px;
}

html {
    min-height: 100%;
}

body {
    background: var(--v2-bg);
    color: var(--v2-text);
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--v2-primary);
}

a:hover,
a:focus {
    color: var(--v2-primary-dark);
}

.navbar-fixed-top {
    background: rgba(255, 255, 255, .94);
    border: 0;
    box-shadow: 0 8px 26px rgba(15, 47, 87, .08);
    backdrop-filter: blur(12px);
}

.brand-v2 {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 260px;
    height: 50px;
    padding: 7px 14px !important;
    overflow: visible;
    color: var(--v2-primary-dark) !important;
    letter-spacing: .1px;
}

.brand-logo-box {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    background: #fff;
    border: 1px solid var(--v2-border);
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(15, 47, 87, .08);
}

.brand-logo-box img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    line-height: 1.1;
}

.brand-copy strong {
    color: var(--v2-primary-dark);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.02em;
    white-space: nowrap;
}

.brand-copy small {
    margin-top: 2px;
    color: var(--v2-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.navbar-top-links > li > a {
    color: var(--v2-muted);
    transition: all .18s ease;
}

.navbar-top-links > li > a:hover,
.navbar-top-links > li > a:focus {
    color: var(--v2-primary);
    background: var(--v2-surface-soft);
}

.navbar-static-side {
    background: #ffffff;
    border-right: 1px solid var(--v2-border);
    box-shadow: 8px 0 22px rgba(15, 47, 87, .06);
}

.sidebar-collapse {
    padding: 14px 12px;
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 12px;
    padding: 12px;
    color: var(--v2-primary-dark);
    border: 1px solid var(--v2-border);
    border-radius: 16px;
    background: linear-gradient(135deg, #f8fbff 0%, #eef7ff 100%);
}

.sidebar-profile strong,
.sidebar-profile small {
    display: block;
}

.sidebar-profile small {
    color: var(--v2-muted);
}

.profile-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, var(--v2-primary), var(--v2-accent));
    overflow: hidden;
}

.profile-avatar img {
    position: absolute;
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
}

.navbar-static-side ul li {
    border-bottom: 0;
}

#side-menu > li > a {
    min-height: 42px;
    margin: 3px 0;
    padding: 10px 12px;
    color: #334155;
    border-radius: 12px;
    transition: all .18s ease;
    white-space: nowrap;
    font-weight: 600;
}

#side-menu > li > a i {
    width: 22px;
    color: #64748b;
    text-align: center;
}

#side-menu > li > a:hover,
#side-menu > li > a:focus,
#side-menu > li.active > a {
    color: var(--v2-primary);
    background: #eaf4ff;
    box-shadow: inset 4px 0 0 var(--v2-accent);
}

#side-menu > li > a:hover i,
#side-menu > li.active > a i {
    color: var(--v2-primary);
}

.sidebar-search {
    padding: 0 0 12px;
}

.sidebar-search .form-control,
.sidebar-search .btn {
    height: 40px;
    border-color: rgba(255, 255, 255, .14);
}

.sidebar-search .form-control {
    color: #fff;
    background: rgba(255, 255, 255, .10);
}

.sidebar-search .form-control::placeholder {
    color: rgba(255, 255, 255, .58);
}

.sidebar-search .btn {
    color: #fff;
    background: rgba(255, 255, 255, .16);
}

#page-wrapper {
    background: var(--v2-bg);
}

@media(min-width:768px) {
    .navbar-static-side {
        width: 250px;
        margin-top: 51px;
    }

    #page-wrapper {
        margin-left: 250px;
        border-left: 0;
        padding: 16px 26px 32px;
    }
}

.page-title-v2 {
    margin: 8px 0 14px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #ffffff 0%, #eef7ff 100%);
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    box-shadow: var(--v2-shadow);
}

.page-title-v2 .eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--v2-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.page-title-v2 h1 {
    margin: 0;
    color: var(--v2-primary-dark);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.03em;
}

.panel,
.tab-content,
.login-content,
.table-responsive,
.navbar.navbar-default:not(.navbar-fixed-top) {
    border: 1px solid var(--v2-border) !important;
    border-radius: var(--v2-radius);
    background: var(--v2-surface);
    box-shadow: var(--v2-shadow);
}

.panel {
    overflow: hidden;
}

.panel-default > .panel-heading,
.panel-primary > .panel-heading {
    color: var(--v2-primary-dark);
    background: var(--v2-surface-soft);
    border-color: var(--v2-border);
    font-weight: 700;
}

.nav-tabs {
    border-bottom: 0;
    margin-bottom: 10px;
}

.nav-tabs > li > a,
.nav-tabs > a,
.nav-tabs > button {
    margin-right: 8px;
    border: 1px solid var(--v2-border) !important;
    border-radius: 999px !important;
    background: #fff;
    color: var(--v2-muted);
    transition: all .18s ease;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus,
.nav-tabs > a:hover,
.nav-tabs > button:hover {
    color: #fff;
    background: var(--v2-primary);
    border-color: var(--v2-primary) !important;
}

.table {
    margin-bottom: 0;
    background: #fff;
}

.table > thead > tr > th {
    color: var(--v2-primary-dark);
    background: #f1f5f9;
    border-bottom: 1px solid var(--v2-border);
    font-size: 12px;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.table > tbody > tr > td,
.table > tfoot > tr > th {
    vertical-align: middle;
    border-color: #edf2f7;
}

.table-striped > tbody > tr:nth-child(odd) > td,
.table-striped > tbody > tr:nth-child(odd) > th {
    background-color: #fbfdff;
}

.table-hover > tbody > tr:hover > td,
.table-hover > tbody > tr:hover > th,
tr.info > td {
    background-color: #eaf4ff !important;
}

.dataTables_filter input,
.dataTables_length select,
.form-control {
    border-color: #cbd5e1;
    border-radius: 10px;
    box-shadow: none;
}

.form-control:focus {
    border-color: var(--v2-primary);
    box-shadow: 0 0 0 3px rgba(0, 87, 168, .14);
}

.btn {
    min-height: 38px;
    border-radius: 10px;
    font-weight: 700;
    transition: all .18s ease;
}

.btn-primary {
    background: var(--v2-primary);
    border-color: var(--v2-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--v2-primary-dark);
    border-color: var(--v2-primary-dark);
}

.btn-success {
    background: var(--v2-accent);
    border-color: var(--v2-accent);
}

.btn-warning {
    background: var(--v2-warning);
    border-color: var(--v2-warning);
}

.btn-danger {
    background: var(--v2-danger);
    border-color: var(--v2-danger);
}

.btn-outline {
    background: #fff;
    border-color: var(--v2-border);
}

.label {
    border-radius: 999px;
    padding: .35em .65em;
}

.progress {
    height: 12px;
    border-radius: 999px;
    box-shadow: inset 0 1px 2px rgba(15, 47, 87, .08);
}

.progress-bar {
    border-radius: 999px;
}

.alert {
    border-radius: var(--v2-radius);
    border: 0;
    box-shadow: var(--v2-shadow);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.modal-content {
    border: 0;
    border-radius: var(--v2-radius);
    box-shadow: 0 24px 60px rgba(15, 47, 87, .22);
}

.modal-header {
    border-bottom-color: var(--v2-border);
    background: var(--v2-surface-soft);
    border-radius: var(--v2-radius) var(--v2-radius) 0 0;
}

.login-page {
    background:
        radial-gradient(circle at top left, rgba(32, 177, 90, .16), transparent 30%),
        radial-gradient(circle at top right, rgba(0, 87, 168, .18), transparent 34%),
        var(--v2-bg) !important;
}

.login-header {
    border-radius: 18px !important;
}

.login-logo {
    border-radius: 18px !important;
}

.dashboard-v2 .dashboard-summary {
    margin-bottom: 18px;
}

.summary-card {
    display: block;
    min-height: 96px;
    margin-bottom: 14px;
    padding: 14px 16px;
    color: var(--v2-text);
    background: #fff;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    box-shadow: var(--v2-shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}

.summary-card:hover,
.summary-card:focus {
    color: var(--v2-text);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 18px 44px rgba(15, 47, 87, .12);
}

.summary-icon {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-bottom: 8px;
    color: #fff;
    border-radius: 12px;
}

.summary-primary { background: var(--v2-primary); }
.summary-danger { background: var(--v2-danger); }
.summary-warning { background: var(--v2-warning); }
.summary-success { background: var(--v2-accent); }

.summary-label {
    display: block;
    color: var(--v2-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.summary-card strong {
    display: block;
    margin-top: 4px;
    color: var(--v2-primary-dark);
    font-size: 20px;
    line-height: 1.1;
}

.dashboard-grid {
    display: flex;
    flex-wrap: wrap;
}

.dashboard-grid > [class*="col-"] {
    display: flex;
}

.dashboard-panel {
    width: 100%;
    min-height: 0;
    margin-bottom: 18px;
}

.dashboard-panel .panel-heading {
    padding: 12px 16px;
}

.dashboard-panel .panel-body {
    padding: 16px;
}

.dashboard-scroll {
    overflow: auto;
    height: 250px;
    padding: 0;
}

#indicador-ejecucion a {
    display: block;
    padding: 10px 12px;
    margin-bottom: 8px;
    color: var(--v2-text);
    background: var(--v2-surface-soft);
    border: 1px solid var(--v2-border);
    border-radius: 12px;
}

#indicador-cumplimiento,
#indicador-tiempos,
#indicador-noconforme {
    min-height: 230px;
}

#form-tiempos,
#form-noconforme {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--v2-border);
}

#indicador-ejecucion a:hover {
    text-decoration: none;
    background: #eaf4ff;
}

#alertas-contador {
    position: relative;
    top: -8px;
    margin-left: -4px;
}

.dropdown-alerts small {
    color: var(--v2-muted);
}

.ordenes-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.ordenes-toolbar .btn {
    min-height: 36px;
}

.ordenes-toolbar .btn.active {
    color: #fff;
    background: var(--v2-primary);
    border-color: var(--v2-primary);
    box-shadow: none;
}

.filtro-fechas {
    margin-bottom: 14px;
}

.filtro-fechas .form-group {
    margin-right: 10px;
    margin-bottom: 8px;
}

.filtro-fechas label {
    margin-right: 6px;
}

.filtro-fechas-nota {
    margin: 6px 0 0;
}

.color-chip {
    display: inline-block;
    width: 28px;
    height: 18px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    vertical-align: middle;
}

.colores-crud-actions {
    padding-top: 25px;
}

.inventario-detalle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -6px 0 12px;
    padding: 11px 14px;
    background: #f8fbff;
    border: 1px solid var(--v2-border);
    border-left: 4px solid var(--v2-primary);
    border-radius: 10px;
}

.inventario-detalle-label {
    display: block;
    margin-bottom: 2px;
    color: var(--v2-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.inventario-detalle-header strong {
    color: var(--v2-text);
}

.inventory-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: -6px 0 14px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
    border: 1px solid var(--v2-border);
    border-radius: 14px;
}

.inventory-summary-header span,
.inventory-summary-card span {
    display: block;
    color: var(--v2-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.inventory-summary-header h2 {
    margin: 3px 0 0;
    color: var(--v2-text);
    font-size: 22px;
    font-weight: 800;
}

.inventory-summary-cards {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.inventory-summary-card {
    padding: 14px;
    background: #fff;
    border: 1px solid var(--v2-border);
    border-radius: 14px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .06);
}

.inventory-summary-card.primary {
    background: var(--v2-primary);
    border-color: var(--v2-primary);
}

.inventory-summary-card.primary span,
.inventory-summary-card.primary strong {
    color: #fff;
}

.inventory-summary-card strong {
    display: block;
    margin-top: 6px;
    color: var(--v2-text);
    font-size: 22px;
    font-weight: 800;
}

.actividades-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
    border: 1px solid var(--v2-border);
    border-radius: 16px;
}

.actividades-hero span {
    color: var(--v2-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.actividades-hero h1 {
    margin: 4px 0;
    color: var(--v2-text);
    font-size: 28px;
    font-weight: 800;
}

.actividades-hero p {
    margin: 0;
    color: var(--v2-muted);
}

.actividades-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actividades-lista {
    display: grid;
    gap: 10px;
}

.actividad-card {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 14px;
    padding: 14px 16px;
    text-align: left;
    background: #fff;
    border: 1px solid var(--v2-border);
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
}

.actividad-card:hover,
.actividad-card:focus {
    border-color: rgba(0, 94, 184, .35);
    background: #f8fbff;
}

.actividad-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: var(--v2-primary);
    background: #eef6ff;
    border-radius: 12px;
}

.actividad-main {
    flex: 1;
}

.actividad-main strong,
.actividad-main small,
.actividad-progress {
    display: block;
}

.actividad-main strong {
    color: var(--v2-text);
    font-size: 17px;
}

.actividad-main small,
.actividad-progress,
.actividad-meta {
    color: var(--v2-muted);
}

.actividad-main small {
    font-size: 14px;
    line-height: 1.45;
}

.actividad-meta {
    min-width: 180px;
    text-align: right;
    font-size: 14px;
}

.actividad-meta small,
.actividad-meta b,
.actividad-meta em {
    display: block;
    font-style: normal;
    line-height: 1.45;
}

.actividad-meta b {
    color: var(--v2-text);
    font-size: 15px;
}

.actividad-detalles-inner {
    padding: 8px 0 2px;
    max-width: 1120px;
    margin: 0 auto;
}

.actividad-producto a {
    display: block;
    margin-bottom: 8px;
    padding: 10px 12px;
    color: var(--v2-text);
    background: #fff;
    border: 1px solid var(--v2-border);
    border-radius: 12px;
}

.actividad-producto a:hover {
    text-decoration: none;
    background: #f8fbff;
}

.actividad-producto-img {
    display: inline-block;
    margin-right: 10px;
    padding: 3px;
    background: #fff;
    border: 1px solid var(--v2-border);
    border-radius: 8px;
    vertical-align: middle;
}

.actividad-producto-img img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.actividad-cantidad {
    float: right;
    padding: 4px 8px;
    color: #fff;
    background: var(--v2-primary);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

@media(max-width:767px) {
    body {
        padding-top: 52px;
    }

    .navbar-static-side {
        background: #fff;
    }

    #page-wrapper {
        padding: 14px;
    }

    .inventario-detalle-header {
        align-items: stretch;
        flex-direction: column;
    }

    .inventory-summary-header {
        align-items: stretch;
        flex-direction: column;
    }

    .inventory-summary-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .actividades-hero,
    .actividad-card {
        align-items: stretch;
        flex-direction: column;
    }

    .actividad-meta {
        min-width: 0;
        text-align: left;
    }

    .actividad-detalles-inner {
        padding-left: 0;
    }
}
