:root { --brand: #073a43; --brand-light: #e3eff0; }
html { color-scheme: light only; }
body { background: #f4f6f5; }
.bg-brand { background: var(--brand) !important; }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: #052a30; color: #fff; }
.sidebar { width: 240px; flex-shrink: 0; background: #fff; border-right: 1px solid #e3e6e4; min-height: calc(100vh - 56px); }
.sidebar .nav-link { color: #333; padding: .55rem 1.2rem; display: flex; gap: .6rem; align-items: center; }
.sidebar .nav-link:hover { background: var(--brand-light); }
.sidebar .nav-link.active { background: var(--brand-light); color: var(--brand); font-weight: 600; border-left: 3px solid var(--brand); }
/* sidebar groups */
.sidenav .nav-link.top { font-weight: 600; }
.sidenav .nav-group { display: flex; align-items: center; gap: .6rem; margin: .45rem .6rem 0; padding: .55rem .75rem;
  border-radius: .5rem; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-light); text-decoration: none; }
.sidenav .nav-group:hover { background: #d3e6e8; }
.sidenav .nav-group.open, .sidenav .nav-group[aria-expanded="true"] { background: var(--brand); color: #fff; }
.sidenav .nav-group .chev { margin-left: auto; transition: transform .2s; font-size: .8rem; }
.sidenav .nav-group[aria-expanded="true"] .chev { transform: rotate(180deg); }
.sidenav .nav-sub { margin: .2rem .6rem .3rem 1.4rem; border-left: 2px solid #d3e6e8; }
.sidenav .nav-sub .nav-link { padding: .42rem .9rem; font-size: .93rem; }
.main { min-width: 0; }
.stat-card { border: 0; border-radius: .75rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-card .icon { width: 44px; height: 44px; border-radius: .6rem; display: grid; place-items: center; font-size: 1.3rem; }
.card { border: 0; border-radius: .75rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.table td, .table th { vertical-align: middle; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #073a43, #0f6b78); }
@media (max-width: 991.98px) { .sidebar { min-height: auto; } }
.items-table input, .items-table select { min-width: 90px; }
.items-table .col-product { min-width: 220px; }
@media print {
  .navbar, .sidebar, .no-print, .alert { display: none !important; }
  body, .main { background: #fff !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 0 !important; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* ---------- Mobile polish ---------- */
@media (max-width: 767.98px) {
  /* 16px inputs stop iPhone from zooming in when a field is tapped */
  input.form-control, select.form-select, textarea.form-control { font-size: 16px; }
  .main { padding: .75rem !important; }
  h4 { font-size: 1.25rem; }
  .btn-sm { padding: .4rem .7rem; }
  /* invoice / purchase item rows become cards */
  .items-table thead { display: none; }
  .items-table, .items-table tbody, .items-table tr, .items-table td { display: block; width: 100% !important; }
  .items-table tr.item { position: relative; border-bottom: 6px solid #f4f6f5; padding: .5rem .25rem .25rem; }
  .items-table tr.item td { border: 0; padding: .2rem .5rem; display: flex; align-items: center; gap: .5rem; }
  .items-table tr.item td[data-label]::before { content: attr(data-label); flex: 0 0 82px; font-size: .78rem; color: #6c757d; }
  .items-table tr.item td.col-product { flex-wrap: wrap; }
  .items-table tr.item td > input, .items-table tr.item td > select { flex: 1; min-width: 0; }
  .items-table tr.item td.line { justify-content: flex-start; font-weight: 600; }
  .items-table tr.item td:last-child { position: absolute; top: .2rem; right: .1rem; width: auto !important; padding: 0; }
  .items-table tr.item td:last-child .remove { font-size: 1.1rem; }
  .items-table tfoot tr { display: flex; justify-content: space-between; padding: .5rem; }
  .items-table tfoot td { width: auto !important; border: 0; }
  .items-table tfoot td:empty, .items-table tfoot td:last-child:empty { display: none; }
  .items-table .col-product { min-width: 0; }
  .items-table tr.item td.col-product { padding-right: 2.4rem; }
  .card-header.d-flex { flex-wrap: wrap; gap: .25rem; }
}
@media (display-mode: standalone) { body { overscroll-behavior-y: contain; } }
