:root {
    --sid-bg: #f3f7f4;
    --sid-surface: #ffffff;
    --sid-border: #d7e3da;
    --sid-text: #1f2937;
    --sid-muted: #667085;
    --sid-primary: #198754;
    --sid-primary-dark: #146c43;
    --sid-primary-soft: #e9f7ef;
    --sid-danger-soft: #fdebec;
    --sid-shadow: 0 12px 28px rgba(16, 24, 40, 0.07);
    --sid-radius: 1rem;
    --sid-sidebar-width: 280px;
}

html, body {
    min-height: 100%;
}

body {
    background: var(--sid-bg);
    color: var(--sid-text);
}

.topbar-public {
    background: linear-gradient(90deg, #157347 0%, #198754 100%);
}

.app-public .card,
.app-shell .panel-card,
.app-shell .metric-card {
    border-radius: var(--sid-radius);
}

.app-shell {
    background: linear-gradient(180deg, #f6faf7 0%, #eef4ef 100%);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
}

.app-layout {
    display: flex;
    min-height: calc(100vh - 65px);
}

.sidebar {
    width: var(--sid-sidebar-width);
    flex: 0 0 var(--sid-sidebar-width);
    border-right: 1px solid var(--sid-border);
    background: #f7fbf8;
    position: sticky;
    top: 65px;
    height: calc(100vh - 65px);
    overflow-y: auto;
}

.sidebar-inner {
    padding: 1.25rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}

.sidebar-badge {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #198754 0%, #20a263 100%);
    color: #fff;
    font-weight: 700;
    box-shadow: var(--sid-shadow);
}

.sidebar-title {
    font-weight: 700;
    line-height: 1.15;
}

.sidebar-subtitle {
    color: var(--sid-muted);
    font-size: 0.9rem;
}

.sidebar-nav {
    gap: 0.35rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #344054;
    border-radius: 0.9rem;
    padding: 0.85rem 0.95rem;
    font-weight: 500;
}

.sidebar-nav .nav-link i {
    font-size: 1.05rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link:focus {
    background: #eef7f1;
    color: var(--sid-primary-dark);
}

.sidebar-nav .nav-link.active {
    background: var(--sid-primary-soft);
    color: var(--sid-primary-dark);
    border: 1px solid #cde8d8;
}

.content-area {
    flex: 1 1 auto;
    min-width: 0;
    min-height: calc(100vh - 65px);
    overflow-y: auto;
}

.content-wrap {
    padding: 1rem;
    min-height: 100%;
}

.panel-card__body .table-responsive {
    width: 100%;
    overflow-x: auto;
}

.panel-card__body table {
    min-width: 100%;
}

.page-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.page-title {
    font-size: clamp(1.6rem, 1.2rem + 1vw, 2rem);
    font-weight: 700;
}

.page-subtitle {
    color: var(--sid-muted);
}

.metric-card,
.panel-card {
    background: var(--sid-surface);
    border: 1px solid var(--sid-border);
    box-shadow: var(--sid-shadow);
}

.metric-card {
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 148px;
}

.metric-card--success {
    background: linear-gradient(180deg, #ffffff 0%, #f4fbf6 100%);
}

.metric-label,
.metric-note {
    color: var(--sid-muted);
}

.metric-value {
    font-size: clamp(1.8rem, 1.2rem + 1.2vw, 2.4rem);
    line-height: 1.1;
    font-weight: 800;
    color: #101828;
}

.metric-value--sm {
    font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
}

.panel-card__header {
    padding: 1.15rem 1.15rem 0;
}

.panel-card__body {
    padding: 1rem 1.15rem 1.15rem;
}

.panel-card__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.feature-list,
.role-list {
    padding-left: 1rem;
}

.feature-list li,
.role-list li {
    margin-bottom: 0.55rem;
}

.badge-role {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #edf7f1;
    color: #146c43;
    padding: 0.38rem 0.7rem;
    font-weight: 600;
    font-size: 0.92rem;
}

.form-control,
.btn,
.card,
.navbar,
.offcanvas {
    border-radius: 0.9rem;
}

#sidebarMovil .offcanvas-body {
    background: #f8fbf9;
}

@media (min-width: 992px) {
    .content-wrap {
        padding: 1.5rem;
    }
}

@media (max-width: 991.98px) {
    .app-layout {
        display: block;
        min-height: auto;
    }

    .content-wrap {
        padding: 1rem;
    }
}

@media (max-width: 575.98px) {
    .metric-card {
        min-height: auto;
    }

    .page-toolbar {
        align-items: stretch;
    }

    .page-toolbar .btn {
        width: 100%;
    }
}

.inspection-table th {
    white-space: nowrap;
    font-size: 0.9rem;
}

.inspection-table td,
.inspection-table th {
    vertical-align: top;
}

.criterion-card {
    background: #fff;
    border: 1px solid var(--sid-border);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: var(--sid-shadow);
    margin-bottom: 1rem;
}

.criterion-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.criterion-code {
    font-weight: 700;
    color: #0f5132;
}

.criterion-points {
    font-size: 0.9rem;
    color: var(--sid-muted);
}

.criterion-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.criterion-desc {
    color: var(--sid-muted);
    font-size: 0.94rem;
    margin-bottom: 1rem;
}

.summary-card {
    position: relative;
}

.sticky-summary {
    position: sticky;
    top: 88px;
}

.summary-kpi {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid #edf2ee;
}

.summary-kpi span {
    color: var(--sid-muted);
    font-size: 0.95rem;
}

.summary-kpi strong {
    font-size: 1.05rem;
    font-weight: 800;
}

.traffic-light {
    border-radius: 1rem;
    padding: 0.9rem 1rem;
    color: #fff;
}

.traffic-light__label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.9;
}

.traffic-light--green {
    background: linear-gradient(135deg, #198754 0%, #20a263 100%);
}

.traffic-light--yellow {
    background: linear-gradient(135deg, #d39e00 0%, #f0ad00 100%);
    color: #1f2937;
}

.traffic-light--red {
    background: linear-gradient(135deg, #dc3545 0%, #bb2d3b 100%);
}

@media (max-width: 1399.98px) {
    .sticky-summary {
        position: static;
    }
}

.other-finding-card {
    background: #fcfdfc;
    border: 1px dashed #c9d8cf;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.other-finding-card__title {
    font-size: 0.96rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: #244b35;
}

.traffic-light {
    transition: background 220ms ease, box-shadow 220ms ease, transform 220ms ease;
    min-height: 84px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.traffic-light--empty {
    background: linear-gradient(135deg, #cfd8d3 0%, #b7c3bc 100%);
    color: #173224;
}

.traffic-light--progress-low {
    background: linear-gradient(135deg, #dc3545 0%, #bb2d3b 100%);
    color: #fff;
}

.traffic-light--progress-mid {
    background: linear-gradient(135deg, #f0ad00 0%, #d89a00 100%);
    color: #1f2937;
}

.traffic-light--progress-high {
    background: linear-gradient(135deg, #5fb36b 0%, #2f8f46 100%);
    color: #fff;
}

.metric-card--report {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.metric-sparkline {
    margin-top: 0.35rem;
    height: 32px;
    display: flex;
    align-items: center;
}

.metric-sparkline__svg {
    width: 100%;
    height: 28px;
    overflow: visible;
}

.metric-card--report .metric-note {
    margin-top: 0.15rem;
    display: block;
}

.metric-trend--inline {
    font-weight: 600;
    color: inherit;
}

.metric-trend--positive {
    color: #198754;
}

.metric-trend--negative {
    color: #dc3545;
}

.metric-trend--neutral {
    color: #6c757d;
}

.report-context {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.report-context__item {
    min-width: 0;
}

.report-context__label {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-context__value {
    display: block;
    overflow-wrap: anywhere;
}

.configuration-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.configuration-tabs .nav-link {
    border-radius: 999px;
    padding: 0.65rem 1rem;
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.configuration-tabs .nav-link:hover {
    color: #198754;
    border-color: #198754;
    background: #f3fbf6;
}

.configuration-tabs .nav-link.active {
    color: #fff;
    background: #198754;
    border-color: #198754;
}
