:root {
  --brand: #1e3a8a;
  --brand-soft: #eef2ff;
  --sidebar-w: 248px;
  --line: #e5e7eb;
}

body {
  background: #f6f7f9;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: #1f2937;
}

/* ---------- Navbar ---------- */

.app-navbar {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .18);
}

.app-navbar .navbar-brand,
.app-navbar .navbar-brand:hover {
  color: #fff;
}

.btn-nav {
  color: #dbe3ff;
  border: 1px solid transparent;
}

.btn-nav:hover,
.btn-nav:focus,
.btn-nav.show {
  color: #fff;
  background: rgba(255, 255, 255, .14);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  color: var(--brand);
  font-weight: 700;
  font-size: .8rem;
}

.notif-menu {
  width: min(380px, 92vw);
  max-height: 70vh;
  overflow-y: auto;
  padding: 0;
}

.notif-item {
  white-space: normal;
  border-bottom: 1px solid #f1f3f5;
}

.notif-body {
  font-size: .78rem;
  line-height: 1.3;
}

.min-w-0 {
  min-width: 0;
}

/* ---------- Layout ---------- */

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 56px);
}

.app-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--line);
}

.app-sidebar .nav-wrap {
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-wrap {
  padding: 1rem .75rem;
}

.nav-heading {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #9ca3af;
  padding: 1rem .75rem .35rem;
}

.nav-link-app {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .75rem;
  margin-bottom: 2px;
  border-radius: .5rem;
  color: #374151;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
}

.nav-link-app i {
  width: 18px;
  text-align: center;
  color: #6b7280;
}

.nav-link-app:hover {
  background: #f3f4f6;
  color: #111827;
}

.nav-link-app.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.nav-link-app.active i {
  color: var(--brand);
}

/* ---------- Cards and tables ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: .75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
  font-weight: 600;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: .6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.table-app {
  font-size: .875rem;
}

.table-app > thead th {
  background: #f9fafb;
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #6b7280;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table-app > tbody td {
  vertical-align: middle;
}

.ref-link {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  font-weight: 600;
  text-decoration: none;
}

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Detail ---------- */

.detail-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: .15rem;
}

.detail-value {
  font-size: .95rem;
  color: #111827;
}

.photo-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: .5rem;
  border: 1px solid var(--line);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.25rem;
  border-left: 2px solid var(--line);
}

.timeline li {
  position: relative;
  padding: 0 0 1.1rem .25rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -1.62rem;
  top: .3rem;
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
}

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b3f7f 55%, #4c1d95 100%);
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 410px;
  border-radius: 1rem;
  border: none;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .28);
}

/* ---------- Misc ---------- */

.form-label {
  font-weight: 600;
  font-size: .85rem;
  color: #374151;
}

.required-mark {
  color: #dc2626;
}

/* ---------- Request form: items and document reading ---------- */

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

.items-table td:nth-child(2) { min-width: 14rem; }
.items-table td:nth-child(3) { min-width: 5.5rem; }
.items-table td:nth-child(4) { min-width: 5rem; }
.items-table td:nth-child(5) { min-width: 7rem; }
.items-table [data-item-total] { padding-top: .45rem; }

/* A field the scanner filled in, until someone touches it. */
.form-control.ocr-filled,
.form-select.ocr-filled {
  background-color: #fef9c3;
  border-color: #eab308;
}

.scan-text {
  max-height: 16rem;
  overflow: auto;
  white-space: pre-wrap;
  font-size: .75rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: .375rem;
  padding: .5rem;
}

@media print {
  .app-navbar, .app-sidebar, .no-print { display: none !important; }
  .app-shell { display: block; }
  body { background: #fff; }
}
