:root {
    --spi-navy: #173653;
    --spi-blue: #245c83;
    --spi-muted: #65758a;
    --bs-primary: #245c83;
    --bs-primary-rgb: 36, 92, 131;
    --bs-body-color: #24364b;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
body.spi-app { background: #f3f6fa; min-height: 100vh; }
a { text-underline-offset: .18em; }
.spi-navbar { min-height: 4.5rem; }
.spi-navbar .navbar-brand { color: var(--spi-navy); font-size: 1.2rem; }
.spi-page { min-width: 0; }
.spi-page > .container { max-width: 100%; }
.spi-page .card { margin-bottom: 1.25rem; border-color: #dfe6ef !important; box-shadow: 0 2px 7px rgb(23 54 83 / 4%); }
.spi-page .card-header { background: #fff; padding: 1rem 1.25rem; border-bottom-color: #e7edf4; font-weight: 600; }
.spi-page .card-body { padding: 1.25rem; }
.spi-page h1 { font-size: clamp(1.35rem, 2vw, 1.8rem); }
.spi-page h2 { font-size: 1.4rem; }
.spi-page h3 { font-size: 1.2rem; }
.spi-page .btn { --bs-btn-font-size: .875rem; }
.btn-primary { --bs-btn-bg: #245c83; --bs-btn-border-color: #245c83; --bs-btn-hover-bg: #1b496a; --bs-btn-hover-border-color: #1b496a; --bs-btn-active-bg: #173653; }
.spi-page label { margin-bottom: .35rem; }
.spi-page .form-control, .spi-page .form-select { font-size: .925rem; }
.spi-invalid .form-control, .spi-invalid .form-select { border-color: var(--bs-danger); }
.spi-invalid .form-text { color: var(--bs-danger); }
.form-horizontal .row { align-items: center; }
.table { --bs-table-bg: transparent; font-size: .875rem; vertical-align: middle; }
.table > thead { background: #edf2f8; color: #304863; }
.table > thead > tr > th { padding-top: .8rem; padding-bottom: .8rem; }
.table > :not(caption) > * > * { border-bottom-color: #e4eaf1; }
.table .btn { margin-bottom: .25rem; }
.table-responsive { margin-bottom: 1rem; }
.dataTables_wrapper { width: 100%; min-width: 0; }
.dataTables_wrapper .dataTables_filter input { width: min(100%, 17rem); }
.dataTables_wrapper .dataTables_length select { min-width: 4.5rem; }
.dataTables_wrapper .pagination { flex-wrap: wrap; gap: .15rem; }
.dataTables_wrapper .dt-buttons { margin-bottom: .75rem; }
.badge:empty { display: none; }
.badge { vertical-align: middle; }
.modal-header .btn-close { margin-left: auto; }
.modal-body { overflow-wrap: anywhere; }
.modal-dialog-scrollable .modal-body { overflow-y: auto; }
.modal textarea { max-width: 100%; }
.spi-sidebar { width: 15.5rem; position: fixed; inset: 0 auto 0 0; z-index: 1040; background: var(--spi-navy); color: #fff; overflow-y: auto; transition: transform .2s ease; }
.spi-sidebar-brand { display: flex; align-items: center; gap: .8rem; color: #fff; text-decoration: none; padding: 1.8rem 1.25rem; font-weight: 700; letter-spacing: .04em; }
.spi-sidebar-brand:hover { color: #fff; }
.spi-brand-mark { display: inline-grid; place-items: center; width: 3rem; height: 3rem; background: #fff; color: var(--spi-navy); border-radius: .7rem; font-weight: 800; letter-spacing: -.05em; }
.spi-sidebar-brand small { display: block; font-size: .7rem; font-weight: 400; color: #b9cbdc; letter-spacing: 0; }
.spi-sidebar-user { display: flex; flex-direction: column; gap: .25rem; margin: 0 1.25rem 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid #ffffff20; overflow-wrap: anywhere; }
.spi-sidebar .nav-link, .spi-user-menu a { display: block; padding: .8rem 1rem; color: #d8e4f0; border: 0; border-radius: .5rem; text-decoration: none; background: transparent; font-size: .9rem; }
.spi-sidebar .nav-link:hover, .spi-sidebar .nav-link.active, .spi-user-menu a:hover { background: #ffffff16; color: #fff; }
.spi-user-menu .nav { display: block; }
.spi-user-menu p { display: inline; }
.spi-user-menu i { margin-right: .5rem; }
.spi-admin-main { margin-left: 15.5rem; min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s ease; }
.spi-admin-main > main { flex: 1; }
.spi-admin-topbar { display: flex; gap: .75rem; align-items: center; min-height: 4.5rem; padding: .75rem 1.5rem; background: #fff; border-bottom: 1px solid #e0e7ef; }
.spi-sidebar-collapsed .spi-sidebar { transform: translateX(-100%); }
.spi-sidebar-collapsed .spi-admin-main { margin-left: 0; }
.spi-footer { border-top: 1px solid #e0e7ef; background: #fff; }
.spi-sidebar-backdrop { position: fixed; inset: 0; z-index: 1035; background: #102b4680; border: 0; }
/* Application-specific dashboard components, independent of the old theme. */
.tile-stats, .small-box { position: relative; padding: 1.2rem; background: #fff; border: 1px solid #dfe6ef; border-radius: .75rem; margin-bottom: 1.25rem; overflow: hidden; }
.tile-stats .count { font-size: 2rem; font-weight: 700; color: var(--spi-blue); }
.tile-stats .icon, .small-box .icon { float: right; font-size: 2.25rem; color: #9bb3ca; }
.tile-stats h3 { font-size: 1rem; margin-top: .6rem; }
.tile-stats p { margin-bottom: 0; color: var(--spi-muted); }
.tile-stats .icon a { color: inherit; }
.chart { display: inline-block; position: relative; height: 110px; width: 110px; margin: .75rem; vertical-align: middle; }
.chart canvas { position: absolute; top: 0; left: 0; }
.chart .percent { display: inline-block; width: 100%; line-height: 110px; text-align: center; }
.chart .percent::after { content: "%"; }
.x_panel { background: #fff; padding: 1.25rem; border: 1px solid #dfe6ef; border-radius: .75rem; margin-bottom: 1rem; }
.x_title { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e0e7ef; margin-bottom: 1rem; }
.panel_toolbox { gap: .75rem; }
.well { padding: 1rem; background: #f1f5f9; border: 1px solid #dfe6ef; border-radius: .5rem; margin-bottom: 1rem; }
.bg-aqua { background: #e1f1f5; }
.bg-green { background: #d8eee3; }
.bg-red { background: #f9e1e4; }
.bg-blue { background: #e0ecf8; }
.bg-purple { background: #eee5f8; }
.text-navy { color: var(--spi-navy); }
.spi-login { min-height: 100vh; display: grid; place-items: center; background: #eef3f8; padding: 1.5rem; }
.spi-login-card { max-width: 960px; width: 100%; border: 1px solid #dce5ef; border-radius: 1.25rem; overflow: hidden; box-shadow: 0 16px 60px #17365314; }
.spi-login-brand { background: var(--spi-navy); color: #fff; padding: clamp(2rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: space-between; min-height: 470px; }
.spi-login-brand h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); line-height: 1.2; }
.spi-login-brand p { color: #c4d4e4; }
.spi-login-form { padding: clamp(1.75rem, 5vw, 3.5rem); background: #fff; }
@media (max-width: 991.98px) {
    .spi-sidebar { transform: translateX(-100%); }
    .spi-admin-main { margin-left: 0; }
    .spi-sidebar-open .spi-sidebar { transform: translateX(0); }
    .spi-login-brand { min-height: auto; gap: 1.5rem; }
    .spi-admin-topbar { padding: .75rem; }
    .spi-admin-topbar > span { display: none; }
}
@media (prefers-reduced-motion: reduce) { .spi-sidebar, .spi-admin-main { transition: none; } }
@media print {
    body.spi-app { background: #fff; }
    .spi-admin-main { margin: 0; display: block; }
    .spi-page { padding: 0 !important; }
    .spi-sidebar, .spi-footer, .dt-buttons, .dataTables_filter, .dataTables_length, .dataTables_paginate, .spi-sidebar-backdrop { display: none !important; }
    .card { box-shadow: none !important; break-inside: avoid; }
    .table-responsive { overflow: visible; }
}

/* Small application hooks still used by dynamically updated content. */
.hidden { display: none !important; }
.badge:not([class*="bg-"]) { background: #e7eef7; color: #245c83; }
.form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.form-inline .form-control, .form-inline .form-select { width: auto; }
.card > .header { padding: 1rem 1.25rem; border-bottom: 1px solid #e0e7ef; }
.card > .content { padding: 1.25rem; }
