:root {
  --bu-primary: #1f4e79;
  --bu-primary-dark: #163a5a;
  --bu-accent: #f39c12;
  --bu-bg: #f3f5f8;
  --bu-sidebar: #ffffff;
  --bu-border: #e3e7ee;
  --bs-primary: #1f4e79;
  --bs-primary-rgb: 31, 78, 121;
  --bs-link-color: #1f4e79;
  --bs-link-color-rgb: 31, 78, 121;
}
body.app { background: var(--bu-bg); font-size: .925rem; }
.btn-primary { --bs-btn-bg: var(--bu-primary); --bs-btn-border-color: var(--bu-primary); --bs-btn-hover-bg: var(--bu-primary-dark); --bs-btn-hover-border-color: var(--bu-primary-dark); --bs-btn-active-bg: var(--bu-primary-dark); background-image: none; }
.btn-outline-primary { --bs-btn-color: var(--bu-primary); --bs-btn-border-color: var(--bu-primary); --bs-btn-hover-bg: var(--bu-primary); --bs-btn-hover-border-color: var(--bu-primary); }
.text-primary { color: var(--bu-primary) !important; }
.bg-primary { background-color: var(--bu-primary) !important; }

.topbar { background: var(--bu-primary); height: 56px; position: sticky; top: 0; z-index: 1030; background-image: none; }
.brand-logo { background: #fff; border-radius: 8px; padding: 2px 8px; display: inline-flex; align-items: center; height: 38px; }
.brand-logo img { height: 30px; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 240px; flex-shrink: 0; background: var(--bu-sidebar); border-right: 1px solid var(--bu-border); }
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; }
}
.sidebar .nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #8a94a6; padding: .9rem 1.25rem .3rem; font-weight: 600; }
.sidebar .nav-link { color: #344054; padding: .45rem 1.25rem; border-left: 3px solid transparent; font-size: .9rem; }
.sidebar .nav-link:hover { background: #f1f5fb; color: var(--bu-primary); }
.sidebar .nav-link.active { background: #e8f0fa; color: var(--bu-primary); border-left-color: var(--bu-primary); font-weight: 600; }
.content { flex: 1; min-width: 0; padding: 1.25rem; }
.content-full { padding: 0; }
@media (max-width: 575.98px) { .content { padding: .75rem; } }

.page-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.page-title h1 { font-size: 1.35rem; margin: 0; font-weight: 600; color: #1d2939; }
.card { border: 1px solid var(--bu-border); border-radius: .6rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; font-weight: 600; border-bottom: 1px solid var(--bu-border); }
.form-label { font-weight: 500; font-size: .85rem; color: #475467; margin-bottom: .25rem; }
.form-control, .form-select { font-size: .925rem; }
.required::after { content: " *"; color: #d92d20; }
.table { font-size: .875rem; }
.table thead th { background: #f8fafc; color: #475467; font-weight: 600; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-sticky thead th { position: sticky; top: 0; z-index: 1; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-badge { font-weight: 500; }
.badge.text-bg-light { border: 1px solid var(--bu-border); }

.stat-card { border-radius: .6rem; padding: 1rem; background: #fff; border: 1px solid var(--bu-border); height: 100%; }
.stat-card .label { color: #667085; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; color: #1d2939; }
.stat-card .sub { font-size: .8rem; color: #667085; }
.stat-card .icon { width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }

.quick-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: 1rem .5rem; background: #fff; border: 1px solid var(--bu-border); border-radius: .6rem; color: #344054; text-decoration: none; height: 100%; text-align: center; font-size: .85rem; font-weight: 500; }
.quick-action i { font-size: 1.4rem; color: var(--bu-primary); }
.quick-action:hover { border-color: var(--bu-primary); color: var(--bu-primary); box-shadow: 0 2px 8px rgba(31,78,121,.12); }

.item-card { border: 1px dashed #b9c6d6; background: #f8fbff; border-radius: .6rem; padding: .8rem 1rem; }
.item-card .model { font-weight: 600; font-size: 1rem; }
.item-card dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: .15rem .75rem; font-size: .85rem; }
.item-card dt { color: #667085; font-weight: 500; }
.item-card dd { margin: 0; }

.pay-row .form-select { min-width: 0; }
.balance-box { font-size: 1.15rem; font-weight: 700; padding: .45rem .75rem; border-radius: .5rem; text-align: right; }
.balance-ok { background: #d1fadf; color: #05603a; }
.balance-bad { background: #fee4e2; color: #b42318; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1f4e79 0%, #2d6aa3 100%); padding: 1rem; }
.login-card { width: 100%; max-width: 400px; border-radius: 1rem; }

.autocomplete-list { position: absolute; z-index: 1050; background: #fff; border: 1px solid var(--bu-border); border-radius: .4rem; max-height: 260px; overflow-y: auto; width: 100%; box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.autocomplete-list div { padding: .35rem .6rem; cursor: pointer; font-size: .875rem; }
.autocomplete-list div:hover, .autocomplete-list div.active { background: #e8f0fa; }
.chip-check { display: inline-block; margin: 0 .35rem .35rem 0; }
.chip-check input { display: none; }
.chip-check span { display: inline-block; padding: .2rem .6rem; border: 1px solid #cdd5df; border-radius: 99px; cursor: pointer; font-size: .8rem; background: #fff; }
.chip-check input:checked + span { background: var(--bu-primary); color: #fff; border-color: var(--bu-primary); }
.muted-small { font-size: .8rem; color: #667085; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
@media print {
  .no-print, .topbar, .sidebar, .alert-dismissible .btn-close { display: none !important; }
  body.app { background: #fff; font-size: 11px; }
  .layout { display: block; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  .table-responsive { overflow: visible !important; max-height: none !important; }
  .stat-card { border: 1px solid #ccc; }
  a { color: inherit; text-decoration: none; }
}
